Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 6ccc534

Browse files
committed
address feedback, fix ui elements
1 parent 3a1bc14 commit 6ccc534

File tree

5 files changed

+64
-58
lines changed

5 files changed

+64
-58
lines changed

src/main/java/com/mathworks/ci/TestResultsViewAction.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public List<List<MatlabTestFile>> getTestResults() throws ParseException, Interr
7777
this.passedCount = 0;
7878
this.failedCount = 0;
7979
this.incompleteCount = 0;
80-
this.notRunCount = totalCount;
80+
this.notRunCount = 0;
8181

8282
JSONArray testArtifact = (JSONArray) new JSONParser().parse(reader);
8383
Iterator<JSONArray> testArtifactIterator = testArtifact.iterator();
@@ -130,11 +130,11 @@ private void getTestSessionResults(List<MatlabTestFile> testSessionResults, JSON
130130
}
131131

132132
// Calculate the relative path
133-
Path path1 = Paths.get(baseFolder.toURI());
134-
Path path2 = Paths.get(this.workspace.toURI());
135-
Path relPath = path2.relativize(path1);
133+
Path baseFolderPath = Paths.get(baseFolder.toURI());
134+
Path workspacePath = Paths.get(this.workspace.toURI());
135+
Path relativePath = workspacePath.relativize(baseFolderPath);
136136

137-
matlabTestFile.setPath(this.workspace.getName() + File.separator + relPath.toString());
137+
matlabTestFile.setPath(this.workspace.getName() + File.separator + relativePath.toString());
138138

139139
MatlabTestCase matlabTestCase = new MatlabTestCase(matlabTestCaseName);
140140
matlabTestCase.setDuration(new BigDecimal(matlabTestCaseResult.get("Duration").toString()));

src/main/resources/+ciplugins/+jenkins/TestResultsViewPlugin.m

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function reportFinalizedSuite(plugin, pluginData)
66
% Checkout MATLAB Test license
77
license('checkout', 'matlab_test');
88

9-
testDetails = {};
9+
testDetails = struct([]);
1010
for idx = 1:numel(pluginData.TestResult)
1111
testDetails(idx).TestResult = pluginData.TestResult(idx);
1212
testDetails(idx).BaseFolder = pluginData.TestSuite(idx).BaseFolder;
@@ -21,10 +21,14 @@ function reportFinalizedSuite(plugin, pluginData)
2121
end
2222
testResults{end+1} = testDetails;
2323
JsonTestResults = jsonencode(testResults, "PrettyPrint", true);
24-
25-
fID = fopen(testArtifactFile, "w");
26-
fprintf(fID, '%s', JsonTestResults);
27-
fclose(fID);
24+
25+
[fID, msg] = fopen(testArtifactFile, "w");
26+
if fID == -1
27+
warning("ciplugins:jenkins:TestResultsViewPlugin:UnableToOpenFile","Could not open a file for Jenkins tests result table due to: %s", msg);
28+
else
29+
closeFile = onCleanup(@()fclose(fID));
30+
fprintf(fID, '%s', JsonTestResults);
31+
end
2832

2933
% Invoke the superclass method
3034
[email protected](plugin, pluginData);

src/main/resources/com/mathworks/ci/BuildArtifactAction/summary.jelly

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@
66
xmlns:f="/lib/form"
77
xmlns:i="jelly:fmt">
88
<t:summary icon="document.png">
9-
<p><a href="${it.urlName}">MATLAB Build Results</a></p>
10-
<span class="${pst.cssClass}">
11-
<j:if test="${it.totalCount == 0}">
12-
<font class="jenkins-!-error-color"><h5>Unable to generate a build artifact.</h5></font>
13-
</j:if>
14-
</span>
15-
<p><b>Tasks run: <font>${it.totalCount}</font></b></p>
16-
<br></br>
17-
<br>
18-
<b>Failed: <font class="jenkins-!-error-color">${it.failCount}</font></b>
19-
</br>
20-
<br>
21-
<b>Skipped: <font class="jenkins-!-color-dark-blue">${it.skipCount}</font></b>
22-
</br>
9+
<div id="${it.urlName}">
10+
<p><a href="${it.urlName}">MATLAB Build Results</a></p>
11+
<span class="${pst.cssClass}">
12+
<j:if test="${it.totalCount == 0}">
13+
<font class="jenkins-!-error-color"><h5>Unable to generate a build artifact.</h5></font>
14+
</j:if>
15+
</span>
16+
<p><b>Tasks run: <font>${it.totalCount}</font></b></p>
17+
<br />
18+
<br>
19+
<b>Failed: <font class="jenkins-!-error-color">${it.failCount}</font></b>
20+
</br>
21+
<br>
22+
<b>Skipped: <font class="jenkins-!-color-dark-blue">${it.skipCount}</font></b>
23+
</br>
24+
</div>
2325
</t:summary>
2426
</j:jelly>

src/main/resources/com/mathworks/ci/TestResultsViewAction/index.jelly

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,39 @@
11
<?jelly escape-by-default='true'?>
22
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:st="jelly:stapler" xmlns:c="/charts">
33
<l:layout title="MATLAB Test Results">
4-
<l:side-panel>
5-
<st:include page="sidepanel.jelly" it="${it.build}" optional="true" />
6-
</l:side-panel>
7-
8-
<l:app-bar title="MATLAB Test Results">
9-
<t:help href="https://github.com/jenkinsci/matlab-plugin/blob/master/CONFIGDOC.md" tooltip="Plugin Configuration Guide" />
10-
</l:app-bar>
4+
<st:include page="sidepanel.jelly" it="${it.build}" optional="true" />
115

126
<l:main-panel>
7+
<l:app-bar title="MATLAB Test Results">
8+
<t:help href="https://github.com/jenkinsci/matlab-plugin/blob/master/CONFIGDOC.md" tooltip="Plugin Configuration Guide" />
9+
</l:app-bar>
10+
1311
<button id="TOTAL" onclick="showTests(id)" class="jenkins-button jenkins-!-margin-4 jenkins-!-padding-0" style="display: inline; width:8em;" tooltip="Total tests">
14-
<p>${it.totalCount}<br></br><br></br>Total Tests</p>
12+
<p>${it.totalCount}<br /><br />Total Tests</p>
1513
</button>
1614

1715
<button id="PASSED" onclick="showTests(id)" class="jenkins-button jenkins-!-margin-4 jenkins-!-padding-0" style="display: inline; width:8em;" tooltip="Passed tests">
1816
<p>${it.passedCount}<br>
1917
<l:icon class="symbol-checkmark-circle-outline plugin-ionicons-api icon-lg jenkins-!-success-color"/>
20-
</br><br></br>Passed</p>
18+
</br><br />Passed</p>
2119
</button>
2220

2321
<button id="FAILED" onclick="showTests(id)" class="jenkins-button jenkins-!-margin-4 jenkins-!-padding-0" style="display: inline; width:8em;" tooltip="Failed tests">
2422
<p>${it.failedCount}<br>
2523
<l:icon class="symbol-close-circle-outline plugin-ionicons-api icon-lg jenkins-!-error-color"/>
26-
</br><br></br>Failed</p>
24+
</br><br />Failed</p>
2725
</button>
2826

2927
<button id="INCOMPLETE" onclick="showTests(id)" class="jenkins-button jenkins-!-margin-4 jenkins-!-padding-0" style="display: inline; width:8em;" tooltip="Incomplete tests">
3028
<p>${it.incompleteCount}<br>
3129
<l:icon class="symbol-alert-circle-outline plugin-ionicons-api icon-lg jenkins-!-warning-color"/>
32-
</br><br></br>Incomplete</p>
30+
</br><br />Incomplete</p>
3331
</button>
3432

3533
<button id="NOT_RUN" onclick="showTests(id)" class="jenkins-button jenkins-!-margin-4 jenkins-!-padding-0" style="display: inline; width:8em;" tooltip="Tests that have not run">
3634
<p>${it.notRunCount}<br>
3735
<l:icon class="symbol-remove-circle-outline plugin-ionicons-api icon-lg"/>
38-
</br><br></br>Not Run</p>
36+
</br><br />Not Run</p>
3937
</button>
4038

4139
<j:forEach var="testSession" items="${it.testResults}" varStatus="status">
@@ -124,7 +122,7 @@
124122
<l:icon class="symbol-remove plugin-ionicons-api icon-sm" tooltip="Hide diagnostics" />
125123
</a>
126124
<div id="stack-${matlabTestCase.name}-${diagnostic.id}" style="display: none; white-space: pre-line;">
127-
<br></br><pre>${diagnostic.report}</pre>
125+
<br /><pre>${diagnostic.report}</pre>
128126
</div>
129127
</div>
130128
</j:forEach>
Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
<?jelly escape-by-default='true'?>
22
<j:jelly xmlns:j="jelly:core" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
3-
<t:summary icon="document.png">
4-
<p><a href="${it.urlName}">MATLAB Test Results</a></p>
5-
<p>
6-
<b>
7-
Tests run: ${it.totalCount}
8-
</b>
9-
</p>
10-
<br></br>
11-
<br>
12-
<b>Passed: <font class="jenkins-!-success-color">${it.passedCount}</font></b>
13-
</br>
14-
<br>
15-
<b>Failed: <font class="jenkins-!-error-color">${it.failedCount}</font></b>
16-
</br>
17-
<br>
18-
<b>Incomplete: <font class="jenkins-!-warning-color">${it.incompleteCount}</font></b>
19-
</br>
20-
<br>
21-
<b>Not Run: ${it.notRunCount}</b>
22-
</br>
23-
</t:summary>
3+
<t:summary icon="document.png">
4+
<div id="${it.urlName}">
5+
<p><a href="${it.urlName}">MATLAB Test Results</a></p>
6+
<p>
7+
<b>
8+
Tests run: ${it.totalCount}
9+
</b>
10+
</p>
11+
<br />
12+
<br>
13+
<b>Passed: <font class="jenkins-!-success-color">${it.passedCount}</font></b>
14+
</br>
15+
<br>
16+
<b>Failed: <font class="jenkins-!-error-color">${it.failedCount}</font></b>
17+
</br>
18+
<br>
19+
<b>Incomplete: <font class="jenkins-!-warning-color">${it.incompleteCount}</font></b>
20+
</br>
21+
<br>
22+
<b>Not Run: ${it.notRunCount}</b>
23+
</br>
24+
</div>
25+
</t:summary>
2426
</j:jelly>

0 commit comments

Comments
 (0)