Skip to content

Commit d5a88fb

Browse files
System tests for lobster-online-report (#446)
Add two valid system tests
1 parent a1bfdbe commit d5a88fb

10 files changed

Lines changed: 368 additions & 21 deletions

tests_system/lobster_online_report/BUILD.bazel

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,13 @@ py_test(
2929
"//tests_system",
3030
],
3131
)
32+
33+
py_test(
34+
name = "test_valid_cases",
35+
srcs = ["test_valid_cases.py"],
36+
deps = [
37+
":lobster_online_report",
38+
"//tests_system",
39+
"//lobster/common:common"
40+
],
41+
)

tests_system/lobster_online_report/data/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ filegroup(
55
srcs = glob([
66
"*.py",
77
"*.lobster",
8+
"*.yaml",
89
]),
910
visibility = ["//visibility:public"],
1011
)
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"schema": "lobster-report",
3+
"version": 2,
4+
"generator": "lobster_report",
5+
"levels": [
6+
{
7+
"name": "code",
8+
"kind": "implementation",
9+
"items": [
10+
{
11+
"tag": "python basic.trlc_reference",
12+
"location": {
13+
"kind": "github",
14+
"gh_root": "https://github.com/bmw-software-engineering/lobster",
15+
"commit": "abcdef1234567890abcdef1234567890abcdef12",
16+
"file": "main_repo_file1.py",
17+
"line": 5
18+
},
19+
"name": "basic.trlc_reference",
20+
"messages": [],
21+
"just_up": [
22+
"helper function"
23+
],
24+
"just_down": [],
25+
"just_global": [],
26+
"tracing_status": "JUSTIFIED",
27+
"language": "Python",
28+
"kind": "Function"
29+
},
30+
{
31+
"tag": "python basic.Example.helper_function",
32+
"location": {
33+
"kind": "github",
34+
"gh_root": "https://github.com/bmw-software-engineering/lobster",
35+
"commit": "abcdef1234567890abcdef1234567890abcdef12",
36+
"file": "system-test-repo/main_repo_folder/main_repo_file2.py",
37+
"line": 13
38+
},
39+
"name": "basic.Example.helper_function",
40+
"messages": [],
41+
"just_up": [],
42+
"just_down": [],
43+
"just_global": [],
44+
"tracing_status": "OK",
45+
"language": "Python",
46+
"kind": "Method"
47+
}
48+
],
49+
"coverage": 66.66666666666667
50+
}
51+
],
52+
"policy": {
53+
"code": {
54+
"name": "code",
55+
"kind": "implementation",
56+
"traces": [],
57+
"source": [
58+
{
59+
"file": "basic.lobster"
60+
}
61+
],
62+
"needs_tracing_up": false,
63+
"needs_tracing_down": false,
64+
"breakdown_requirements": []
65+
}
66+
},
67+
"matrix": []
68+
}

tests_system/lobster_online_report/data/report.lobster renamed to tests_system/lobster_online_report/data/main_repo_report.lobster

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"tag": "python basic.trlc_reference",
1212
"location": {
1313
"kind": "file",
14-
"file": "basic.py",
14+
"file": "main_repo_file1.py",
1515
"line": 5,
1616
"column": null
1717
},
@@ -30,7 +30,7 @@
3030
"tag": "python basic.Example.helper_function",
3131
"location": {
3232
"kind": "file",
33-
"file": "basic.py",
33+
"file": "system-test-repo/main_repo_folder/main_repo_file2.py",
3434
"line": 13,
3535
"column": null
3636
},
@@ -42,25 +42,6 @@
4242
"tracing_status": "OK",
4343
"language": "Python",
4444
"kind": "Method"
45-
},
46-
{
47-
"tag": "python basic.Example.nor",
48-
"location": {
49-
"kind": "file",
50-
"file": "basic.py",
51-
"line": 17,
52-
"column": null
53-
},
54-
"name": "basic.Example.nor",
55-
"messages": [
56-
"unknown tracing target req example.req_nor"
57-
],
58-
"just_up": [],
59-
"just_down": [],
60-
"just_global": [],
61-
"tracing_status": "MISSING",
62-
"language": "Python",
63-
"kind": "Method"
6445
}
6546
],
6647
"coverage": 66.66666666666667
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"schema": "lobster-report",
3+
"version": 2,
4+
"generator": "lobster_report",
5+
"levels": [
6+
{
7+
"name": "code",
8+
"kind": "implementation",
9+
"items": [
10+
{
11+
"tag": "python basic1.trlc_reference",
12+
"location": {
13+
"kind": "github",
14+
"gh_root": "https://github.com/bmw-software-engineering/lobster/../bali/trip",
15+
"commit": "abcdef1111111111111111",
16+
"file": "submodule1_file1.py",
17+
"line": 5
18+
},
19+
"name": "basic1.trlc_reference",
20+
"messages": [],
21+
"just_up": [
22+
"helper function"
23+
],
24+
"just_down": [],
25+
"just_global": [],
26+
"tracing_status": "JUSTIFIED",
27+
"language": "Python",
28+
"kind": "Function"
29+
},
30+
{
31+
"tag": "python basic2.Example.helper_function",
32+
"location": {
33+
"kind": "github",
34+
"gh_root": "https://github.com/bmw-software-engineering/lobster/../somewhere/else",
35+
"commit": "abcdef22222222222222",
36+
"file": "submodule2_file1.py",
37+
"line": 13
38+
},
39+
"name": "basic2.Example.helper_function",
40+
"messages": [],
41+
"just_up": [],
42+
"just_down": [],
43+
"just_global": [],
44+
"tracing_status": "OK",
45+
"language": "Python",
46+
"kind": "Method"
47+
},
48+
{
49+
"tag": "python basic3.Example.helper_function",
50+
"location": {
51+
"kind": "github",
52+
"gh_root": "https://github.com/bmw-software-engineering/lobster/../palm/beach",
53+
"commit": "abcdef333333333333",
54+
"file": "submodule2_file2.py",
55+
"line": 13
56+
},
57+
"name": "basic3.Example.helper_function",
58+
"messages": [],
59+
"just_up": [],
60+
"just_down": [],
61+
"just_global": [],
62+
"tracing_status": "OK",
63+
"language": "Python",
64+
"kind": "Method"
65+
}
66+
],
67+
"coverage": 66.66666666666667
68+
}
69+
],
70+
"policy": {
71+
"code": {
72+
"name": "code",
73+
"kind": "implementation",
74+
"traces": [],
75+
"source": [
76+
{
77+
"file": "basic.lobster"
78+
}
79+
],
80+
"needs_tracing_up": false,
81+
"needs_tracing_down": false,
82+
"breakdown_requirements": []
83+
}
84+
},
85+
"matrix": []
86+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"schema": "lobster-report",
3+
"version": 2,
4+
"generator": "lobster_report",
5+
"levels": [
6+
{
7+
"name": "code",
8+
"kind": "implementation",
9+
"items":[
10+
{
11+
"tag": "python basic1.trlc_reference",
12+
"location": {
13+
"kind": "file",
14+
"file": "system-test-repo/submodule1/submodule1_file1.py",
15+
"line": 5,
16+
"column": null
17+
},
18+
"name": "basic1.trlc_reference",
19+
"messages": [],
20+
"just_up": [
21+
"helper function"
22+
],
23+
"just_down": [],
24+
"just_global": [],
25+
"tracing_status": "JUSTIFIED",
26+
"language": "Python",
27+
"kind": "Function"
28+
},
29+
{
30+
"tag": "python basic2.Example.helper_function",
31+
"location": {
32+
"kind": "file",
33+
"file": "system-test-repo/submodule2/submodule2_file1.py",
34+
"line": 13,
35+
"column": null
36+
},
37+
"name": "basic2.Example.helper_function",
38+
"messages": [],
39+
"just_up": [],
40+
"just_down": [],
41+
"just_global": [],
42+
"tracing_status": "OK",
43+
"language": "Python",
44+
"kind": "Method"
45+
},
46+
{
47+
"tag": "python basic3.Example.helper_function",
48+
"location": {
49+
"kind": "file",
50+
"file": "system-test-repo/submodule2/folder/submodule2_file2.py",
51+
"line": 13,
52+
"column": null
53+
},
54+
"name": "basic3.Example.helper_function",
55+
"messages": [],
56+
"just_up": [],
57+
"just_down": [],
58+
"just_global": [],
59+
"tracing_status": "OK",
60+
"language": "Python",
61+
"kind": "Method"
62+
}
63+
],
64+
"coverage": 66.66666666666667
65+
}
66+
],
67+
"policy": {
68+
"code": {
69+
"name": "code",
70+
"kind": "implementation",
71+
"traces": [],
72+
"source": [
73+
{
74+
"file": "basic.lobster"
75+
}
76+
],
77+
"needs_tracing_up": false,
78+
"needs_tracing_down": false,
79+
"breakdown_requirements": []
80+
}
81+
},
82+
"matrix": []
83+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
base_url: "https://github.com/bmw-software-engineering/lobster"
2+
commit_id: "abcdef1234567890abcdef1234567890abcdef12"
3+
repo_root: "system-test-repo"
4+
report: "main_repo_report.lobster"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
base_url: "https://github.com/bmw-software-engineering/lobster/"
2+
commit_id: "abcdef1234567890abcdef1234567890abcdef12"
3+
repo_root: "system-test-repo"
4+
report: "submodule_report.lobster"

tests_system/lobster_online_report/lobster_online_report_test_runner.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
@dataclass
99
class CmdArgs:
1010
config: Optional[str] = None
11+
out: Optional[str] = None
1112

1213
def as_list(self) -> List[str]:
1314
"""Returns the command line arguments as a list"""
@@ -18,6 +19,7 @@ def append_if_string(parameter: str, value: Optional[str]):
1819
cmd_args.append(f"{parameter}={value}")
1920

2021
append_if_string("--config", self.config)
22+
append_if_string("--out", self.out)
2123
return cmd_args
2224

2325

0 commit comments

Comments
 (0)