Skip to content

Commit a2bde78

Browse files
committed
add tests
1 parent b39d2c9 commit a2bde78

8 files changed

Lines changed: 811 additions & 33 deletions

File tree

.github/workflows/bat.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [push]
44
jobs:
55
bat:
66
name: Build and Test
7-
runs-on: ubuntu-22.04
7+
runs-on: [ubuntu-22.04, windows-2022, macos-12]
88
steps:
99
- uses: actions/checkout@v4
1010

plugins/+ciplugins/+github/GitHubLogPlugin.m

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,14 @@
33

44
methods (Access=protected)
55
function runTestClass(plugin, pluginData)
6-
% Add GitHub workflow command for starting a test output group
6+
% Add GitHub workflow command for starting a test class output group
77
disp("::group::" + pluginData.Name);
88

99
% Invoke the superclass method
1010
runTestClass@matlab.unittest.plugins.TestRunnerPlugin(plugin, pluginData);
1111

12-
% End the test output group
12+
% End the test class output group
1313
disp("::endgroup::");
1414
end
15-
16-
% function runTest(plugin, pluginData)
17-
% % Add GitHub workflow command for starting a test output group
18-
% disp("::group::" + pluginData.TestSuite.Name);
19-
20-
% % Invoke the superclass method
21-
% runTest@matlab.unittest.plugins.TestRunnerPlugin(plugin, pluginData);
22-
23-
% % End the test output group
24-
% disp("\n::endgroup::");
25-
% end
2615
end
2716
end

src/index.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,13 @@ async function run() {
3535
const command = "addpath('"+ pluginsPath +"');" + "import matlab.unittest.TestRunner; addpath(genpath('sample')); suite = testsuite(pwd, 'IncludeSubfolders', true); runner = TestRunner.withDefaultPlugins(); results = runner.run(suite); results = runner.run(suite); display(results); assertSuccess(results);";
3636
const startupOptions = core.getInput("startup-options").split(" ");
3737

38-
// const helperScript = await core.group("Generate script", async () => {
39-
const helperScript = await matlab.generateScript(workspaceDir, command);
40-
core.info("Successfully generated script");
41-
// return helperScript;
42-
// });
38+
const helperScript = await matlab.generateScript(workspaceDir, command);
39+
core.info("Successfully generated test script!");
4340

44-
// await core.group("Run command", async () => {
45-
await matlab.runCommand(helperScript, platform, architecture, exec.exec, startupOptions).finally(() => {
46-
const { testResults, stats } = testResultsSummary.getTestResults();
47-
testResultsSummary.writeSummary(testResults, stats);
48-
});
49-
// });
41+
await matlab.runCommand(helperScript, platform, architecture, exec.exec, startupOptions).finally(() => {
42+
const { testResults, stats } = testResultsSummary.getTestResults();
43+
testResultsSummary.writeSummary(testResults, stats);
44+
});
5045
}
5146

5247
run().catch((e) => {
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
[
2+
[
3+
{
4+
"TestResult": {
5+
"Duration": 0.1,
6+
"Details": {
7+
"SimulinkTestManagerResults": []
8+
},
9+
"Name": "TestExamples1/testNonLeapYear",
10+
"Passed": true,
11+
"Failed": false,
12+
"Incomplete": false
13+
},
14+
"BaseFolder": "/home/user/workspace/visualization/tests"
15+
},
16+
{
17+
"TestResult": {
18+
"Duration": 0.11,
19+
"Details": {
20+
"SimulinkTestManagerResults": []
21+
},
22+
"Name": "TestExamples1/testNonLeapYear2",
23+
"Passed": true,
24+
"Failed": false,
25+
"Incomplete": false
26+
},
27+
"BaseFolder": "/home/user/workspace/visualization/tests"
28+
},
29+
{
30+
"TestResult": {
31+
"Duration": 0.111,
32+
"Details": {
33+
"SimulinkTestManagerResults": []
34+
},
35+
"Name": "TestExamples1/testNonLeapYear3",
36+
"Passed": true,
37+
"Failed": false,
38+
"Incomplete": false
39+
},
40+
"BaseFolder": "/home/user/workspace/visualization/tests"
41+
},
42+
{
43+
"TestResult": {
44+
"Duration": 0.1111,
45+
"Details": {
46+
"SimulinkTestManagerResults": []
47+
},
48+
"Name": "TestExamples1/testNonLeapYear4",
49+
"Passed": true,
50+
"Failed": false,
51+
"Incomplete": false
52+
},
53+
"BaseFolder": "/home/user/workspace/visualization/tests"
54+
},
55+
{
56+
"TestResult": {
57+
"Duration": 0.4,
58+
"Details": {
59+
"SimulinkTestManagerResults": [],
60+
"DiagnosticRecord": {
61+
"TestDiagnosticResults": [],
62+
"FrameworkDiagnosticResults": {
63+
"Artifacts": [],
64+
"DiagnosticText": "SampleDiagnosticsText1"
65+
},
66+
"AdditionalDiagnosticResults": [],
67+
"Stack": {
68+
"file": "/home/user/workspace/visualization/tests/TestExamples1.m",
69+
"name": "TestExamples1.testLeapYear",
70+
"line": 35
71+
},
72+
"Event": "SampleDiagnosticsEvent1",
73+
"EventScope": "TestMethod",
74+
"EventLocation": "TestExamples1/testLeapYear",
75+
"Report": "SampleDiagnosticsReport1"
76+
}
77+
},
78+
"Name": "TestExamples1/testLeapYear",
79+
"Passed": false,
80+
"Failed": true,
81+
"Incomplete": true
82+
},
83+
"BaseFolder": "/home/user/workspace/visualization/tests"
84+
},
85+
{
86+
"TestResult": {
87+
"Duration": 0.4,
88+
"Details": {
89+
"SimulinkTestManagerResults": [],
90+
"DiagnosticRecord": {
91+
"TestDiagnosticResults": [],
92+
"FrameworkDiagnosticResults": {
93+
"Artifacts": [],
94+
"DiagnosticText": "SampleDiagnosticsText1"
95+
},
96+
"AdditionalDiagnosticResults": [],
97+
"Stack": {
98+
"file": "/home/user/workspace/visualization/tests/TestExamples1.m",
99+
"name": "TestExamples1.testLeapYear2",
100+
"line": 35
101+
},
102+
"Event": "SampleDiagnosticsEvent1",
103+
"EventScope": "TestMethod",
104+
"EventLocation": "TestExamples1/testLeapYear2",
105+
"Report": "SampleDiagnosticsReport1"
106+
}
107+
},
108+
"Name": "TestExamples1/testLeapYear2",
109+
"Passed": false,
110+
"Failed": true,
111+
"Incomplete": true
112+
},
113+
"BaseFolder": "/home/user/workspace/visualization/tests"
114+
},
115+
{
116+
"TestResult": {
117+
"Duration": 0.4,
118+
"Details": {
119+
"SimulinkTestManagerResults": [],
120+
"DiagnosticRecord": {
121+
"TestDiagnosticResults": [],
122+
"FrameworkDiagnosticResults": {
123+
"Artifacts": [],
124+
"DiagnosticText": "SampleDiagnosticsText1"
125+
},
126+
"AdditionalDiagnosticResults": [],
127+
"Stack": {
128+
"file": "/home/user/workspace/visualization/tests/TestExamples1.m",
129+
"name": "TestExamples1.testLeapYear3",
130+
"line": 35
131+
},
132+
"Event": "SampleDiagnosticsEvent1",
133+
"EventScope": "TestMethod",
134+
"EventLocation": "TestExamples1/testLeapYear3",
135+
"Report": "SampleDiagnosticsReport1"
136+
}
137+
},
138+
"Name": "TestExamples1/testLeapYear3",
139+
"Passed": false,
140+
"Failed": true,
141+
"Incomplete": true
142+
},
143+
"BaseFolder": "/home/user/workspace/visualization/tests"
144+
},
145+
{
146+
"TestResult": {
147+
"Duration": 0.1,
148+
"Details": {
149+
"SimulinkTestManagerResults": [],
150+
"DiagnosticRecord": {
151+
"TestDiagnosticResults": [],
152+
"FrameworkDiagnosticResults": {
153+
"Artifacts": [],
154+
"DiagnosticText": "SampleDiagnosticsText2"
155+
},
156+
"AdditionalDiagnosticResults": [],
157+
"Stack": {
158+
"file": "/home/user/workspace/visualization/tests/TestExamples1.m",
159+
"name": "TestExamples1.testValidDateFormat",
160+
"line": 35
161+
},
162+
"Event": "SampleDiagnosticsEvent2",
163+
"EventScope": "TestMethod",
164+
"EventLocation": "TestExamples1/testValidDateFormat",
165+
"Report": "SampleDiagnosticsReport2"
166+
}
167+
},
168+
"Name": "TestExamples1/testValidDateFormat",
169+
"Passed": false,
170+
"Failed": false,
171+
"Incomplete": true
172+
},
173+
"BaseFolder": "/home/user/workspace/visualization/tests"
174+
},
175+
{
176+
"TestResult": {
177+
"Duration": 0,
178+
"Details": {
179+
"SimulinkTestManagerResults": []
180+
},
181+
"Name": "TestExamples1/testInvalidDateFormat",
182+
"Passed": false,
183+
"Failed": false,
184+
"Incomplete": false
185+
},
186+
"BaseFolder": "/home/user/workspace/visualization/tests"
187+
}
188+
],
189+
{
190+
"TestResult": {
191+
"Duration": 0.1,
192+
"Details": {
193+
"SimulinkTestManagerResults": [],
194+
"DiagnosticRecord": {
195+
"TestDiagnosticResults": [],
196+
"FrameworkDiagnosticResults": {
197+
"Artifacts": [],
198+
"DiagnosticText": "SampleDiagnosticsText2"
199+
},
200+
"AdditionalDiagnosticResults": [],
201+
"Stack": {
202+
"file": "/home/user/workspace/visualization/duplicate_tests/TestExamples2.m",
203+
"name": "TestExamples2.testNonLeapYear",
204+
"line": 35
205+
},
206+
"Event": "SampleDiagnosticsEvent2",
207+
"EventScope": "TestMethod",
208+
"EventLocation": "TestExamples2/testNonLeapYear",
209+
"Report": "SampleDiagnosticsReport2"
210+
}
211+
},
212+
"Name": "TestExamples2/testNonLeapYear",
213+
"Passed": false,
214+
"Failed": false,
215+
"Incomplete": true
216+
},
217+
"BaseFolder": "/home/user/workspace/visualization/duplicate_tests"
218+
}
219+
]

0 commit comments

Comments
 (0)