Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test results visualization #360

Open
wants to merge 33 commits into
base: dev_main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b7b737a
commit to draft test procedure
mw-kapilg Aug 1, 2024
a65e93f
update finally block
mw-kapilg Sep 3, 2024
49e7bee
fix merge conflicts
mw-kapilg Sep 3, 2024
a7bd44b
Update actions
mw-kapilg Sep 16, 2024
eb83cb6
Change build colors
mw-kapilg Sep 16, 2024
dc059ae
fix merge conflicts
mw-kapilg Sep 16, 2024
9d79737
update colour scheme
mw-kapilg Sep 16, 2024
12ebdc3
add tests
mw-kapilg Sep 18, 2024
f917c1f
remove extra comments
mw-kapilg Sep 18, 2024
284d2df
try fix for ci test failure
mw-kapilg Sep 25, 2024
0f4b801
try fix for ci test failure
mw-kapilg Sep 25, 2024
fe6fab8
add debug statements
mw-kapilg Sep 25, 2024
cfb1795
debug failure
mw-kapilg Sep 25, 2024
2071d66
debug
mw-kapilg Sep 25, 2024
e50a7c7
update input stream
mw-kapilg Sep 25, 2024
620bceb
update paths
mw-kapilg Sep 25, 2024
1c068e4
update test workspace
mw-kapilg Sep 26, 2024
7725c3a
more debugging
mw-kapilg Oct 11, 2024
16f0988
fix testcase workspace
mw-kapilg Oct 11, 2024
213cfad
final fix (hopefully)
mw-kapilg Oct 11, 2024
46666c9
revert filepath
mw-kapilg Oct 11, 2024
cb2f6e8
remove absolute path
mw-kapilg Oct 11, 2024
fb7793b
update workspace path
mw-kapilg Oct 14, 2024
678a12d
add logger
mw-kapilg Oct 14, 2024
7b746fd
update test
mw-kapilg Oct 15, 2024
2d81d41
update test data
mw-kapilg Oct 15, 2024
06b2d12
Specify java version in yml
mw-kapilg Oct 15, 2024
c15e013
update slave label
mw-kapilg Oct 22, 2024
40a7af4
add null checks
mw-kapilg Oct 22, 2024
3517803
add null check
mw-kapilg Oct 22, 2024
34c1a5b
Update as per review comments
mw-kapilg Nov 5, 2024
2a7c908
resolve conflicts
mw-kapilg Jan 16, 2025
49cbe24
resolve conflicts
mw-kapilg Jan 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ src/main/resources/**/run-matlab-command*
src/main/resources/license.txt

.idea/
matlab.iml

**/.DS_Store
6 changes: 6 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ trigger:
- master

steps:
- task: JavaToolInstaller@0
inputs:
versionSpec: '11'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'

- task: Maven@4
inputs:
mavenPomFile: 'pom.xml'
Expand Down
9 changes: 5 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>3.57</version>
<version>4.47</version>
<relativePath />
</parent>
<artifactId>matlab</artifactId>
Expand All @@ -18,7 +18,7 @@
</developer>
</developers>
<properties>
<jenkins.version>2.164.3</jenkins.version>
<jenkins.version>2.350</jenkins.version>
<java.level>8</java.level>
</properties>
<name>MATLAB Plugin</name>
Expand Down Expand Up @@ -52,14 +52,15 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.164.x</artifactId>
<version>4</version>
<artifactId>bom-2.346.x</artifactId>
<version>1763.v092b_8980a_f5e</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since We are updating this, could we consider updating it to the latest ? https://github.com/jenkinsci/bom/blob/master/README.md

<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>

<!-- JSON Parser -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/com/mathworks/ci/MatlabBuilderConstants.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.mathworks.ci;

/*
* Copyright 2019-2020 The MathWorks, Inc.
* Copyright 2019-2024 The MathWorks, Inc.
*/

public class MatlabBuilderConstants {
Expand Down Expand Up @@ -34,10 +34,14 @@ public class MatlabBuilderConstants {
//Temporary MATLAB folder name in workspace
public static final String TEMP_MATLAB_FOLDER_NAME = ".matlab";

// MATLAB default function/plugin paths
// MATLAB default function, plugin, service paths
public static final String DEFAULT_PLUGIN = "+ciplugins/+jenkins/getDefaultPlugins.m";
public static final String BUILD_REPORT_PLUGIN = "+ciplugins/+jenkins/BuildReportPlugin.m";
public static final String TASK_RUN_PROGRESS_PLUGIN = "+ciplugins/+jenkins/TaskRunProgressPlugin.m";
public static final String TEST_RESULTS_VIEW_PLUGIN = "+ciplugins/+jenkins/TestResultsViewPlugin.m";
public static final String TEST_RESULTS_VIEW_PLUGIN_SERVICE = "+matlab/+unittest/+internal/+services/+plugins/TestResultsViewPluginService.m";

public static final String TEST_RESULTS_VIEW_ARTIFACT = "matlabTestResults";
public static final String BUILD_ARTIFACT = "buildArtifact";

public static final String NEW_LINE = System.getProperty("line.separator");
Expand Down
105 changes: 105 additions & 0 deletions src/main/java/com/mathworks/ci/TestCase.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
package com.mathworks.ci;

/**
* Copyright 2024, The MathWorks Inc.
*
*/

import java.util.List;
import java.util.ArrayList;

import org.apache.commons.lang.RandomStringUtils;

public class TestCase {
mw-kapilg marked this conversation as resolved.
Show resolved Hide resolved
private String name;
private List<TestDiagnostics> diagnostics;
private boolean passed;
private boolean failed;
private boolean incomplete;
private String status;
private Double duration;
private String id;

public TestCase() {
name = "";
mw-kapilg marked this conversation as resolved.
Show resolved Hide resolved
diagnostics = new ArrayList<TestDiagnostics>();
passed = false;
failed = false;
incomplete = false;
status = "NotRun";
mw-kapilg marked this conversation as resolved.
Show resolved Hide resolved
mw-kapilg marked this conversation as resolved.
Show resolved Hide resolved
duration = 0.0;
id = RandomStringUtils.randomAlphanumeric(8);
}

public void updateStatus() {
mw-kapilg marked this conversation as resolved.
Show resolved Hide resolved
if (failed){
status = "Failed";
}
else if (incomplete) {
status = "Incomplete";
}
else if(passed) {
status = "Passed";
}
}

public String getName() {
return this.name;
}

public void setName(String name) {
this.name = name;
}

public List<TestDiagnostics> getDiagnostics() {
return this.diagnostics;
}

public void setDiagnostics(List<TestDiagnostics> diagnostics) {
this.diagnostics = diagnostics;
}

public boolean getPassed() {
return this.passed;
}

public void setPassed(boolean passed) {
this.passed = passed;
}

public boolean getFailed() {
return this.failed;
}

public void setFailed(boolean failed) {
this.failed = failed;
}

public boolean getIncomplete() {
return this.incomplete;
}

public void setIncomplete(boolean incomplete) {
this.incomplete = incomplete;
}

public String getStatus() {
return this.status;
}

public void setStatus(String status) {
this.status = status;
}

public Double getDuration() {
return this.duration;
}

public void setDuration(Double duration) {
this.duration = duration;
}

public String getId() {
return id;
}
}
40 changes: 40 additions & 0 deletions src/main/java/com/mathworks/ci/TestDiagnostics.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.mathworks.ci;

/**
* Copyright 2024, The MathWorks Inc.
*
*/

import org.apache.commons.lang.RandomStringUtils;

public class TestDiagnostics {
mw-kapilg marked this conversation as resolved.
Show resolved Hide resolved
private String event;
private String report;
private String id;

public TestDiagnostics() {
event = "";
mw-kapilg marked this conversation as resolved.
Show resolved Hide resolved
report = "";
id = RandomStringUtils.randomAlphanumeric(8);
}

public String getEvent() {
return this.event;
}

public void setEvent(String event) {
this.event = event;
}

public String getReport() {
return this.report;
}

public void setReport(String report) {
this.report = report;
}

public String getId() {
return id;
}
}
94 changes: 94 additions & 0 deletions src/main/java/com/mathworks/ci/TestFile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package com.mathworks.ci;

/**
* Copyright 2024, The MathWorks Inc.
*
*/

import java.util.List;
import java.util.ArrayList;

import org.apache.commons.lang.RandomStringUtils;

public class TestFile {
private String filePath;
private String name;
private Double duration;
private String status;
private List<TestCase> testCases;
private String id;

public TestFile() {
filePath = "";
name = "";
duration = 0.0;
status = "NotRun";
mw-kapilg marked this conversation as resolved.
Show resolved Hide resolved
testCases = new ArrayList<TestCase>();

mw-kapilg marked this conversation as resolved.
Show resolved Hide resolved
id = RandomStringUtils.randomAlphanumeric(8);
}

public void incrementDuration(Double testCaseDuration) {
this.duration += testCaseDuration;
}

public void updateStatus(TestCase testCase) {
if (!status.equals("Failed")){
mw-kapilg marked this conversation as resolved.
Show resolved Hide resolved
if (testCase.getFailed()){
status = "Failed";
}
else if (!status.equals("Incomplete")){
mw-kapilg marked this conversation as resolved.
Show resolved Hide resolved
if (testCase.getIncomplete()){
status = "Incomplete";
}
else if (testCase.getPassed()){
status = "Passed";
}
}
}
}

public String getFilePath() {
return this.filePath;
}

public void setFilePath(String filePath) {
mw-kapilg marked this conversation as resolved.
Show resolved Hide resolved
this.filePath = filePath;
}

public String getName() {
return this.name;
}

public void setName(String name) {
this.name = name;
}

public Double getDuration() {
return this.duration;
}

public void setDuration(Double duration) {
this.duration = duration;
}

public String getStatus() {
return this.status;
}

public void setStatus(String status) {
this.status = status;
}

public List<TestCase> getTestCases() {
return this.testCases;
}

public void setTestCases(List<TestCase> testCases) {
this.testCases = testCases;
}

public String getId() {
return id;
}
}
Loading
Loading