Skip to content

Commit

Permalink
Fix for JUnit result parsing (#33)
Browse files Browse the repository at this point in the history
* npm audit fix
* upgrade to test parser 0.1.19
* additional tests for metadata
* mstest support enabled
  • Loading branch information
bryanbcook authored Jul 18, 2024
1 parent 9362692 commit f1bd916
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 24 deletions.
4 changes: 2 additions & 2 deletions PublishTestPlanResultsV1/framework/TestFrameworkFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export enum TestFrameworkFormat {
cucumber = "cucumber",
mocha = "mocha",
nunit = "nunit",
testng = "testng"
//mstest = "mstest"
testng = "testng",
mstest = "mstest"
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export async function readResults(parameters: TestFrameworkParameters): Promise<
let result = new TestFrameworkResult(test.name, test.status);
result.failure = test.failure;
result.stacktrace = test.stack_trace;
result.properties = test.meta_data;
// 0.1.19 separated tags from metadata
result.properties = new Map<string,string>(Object.entries(test.metadata));

results.push(result);
})
Expand Down
14 changes: 7 additions & 7 deletions PublishTestPlanResultsV1/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion PublishTestPlanResultsV1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"azure-devops-node-api": "^12.1.0",
"azure-pipelines-task-lib": "^4.6.1",
"test-results-parser": "^0.1.7"
"test-results-parser": "0.1.19"
},
"devDependencies": {
"@types/chai": "^4.3.11",
Expand Down
3 changes: 2 additions & 1 deletion PublishTestPlanResultsV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@
"cucumber": "cucumber",
"nUnit": "nUnit",
"testng": "testng",
"mocha": "mocha"
"mocha": "mocha",
"mstest": "mstest"
},
"helpMarkDown": "Represents which compatible framework the test results are formatted in. (JUnit, XUnit, TestNG, Mocha, Cucumber, etc)"
},
Expand Down
25 changes: 13 additions & 12 deletions PublishTestPlanResultsV1/test/TestFrameworkResultReader.specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ describe("TestFramework Results Reader", () => {

// assert
expect(results.length).to.eq(1);
expect(String(results[0].properties.get("TestID"))).to.equal('1234');
expect(results[0].properties.get("TestLevel")).to.equal('Regression');
expect(results[0].properties.get("TestProduct")).to.equal('TestProductExample');
});


Expand Down Expand Up @@ -90,20 +93,18 @@ describe("TestFramework Results Reader", () => {
expect(results.length).to.be.greaterThan(1);
});


// waiting for 0.1.7 that includes this
// it("Can read MStests results", async () => {
// // arrange
// var files = [];
// files.push(path.join(baseDir, "mstest", "testresults.trx"));
// var parameters = new TestFrameworkParameters(files, "mstest");
it("Can read MStests results", async () => {
// arrange
var files = [];
files.push(path.join(baseDir, "mstest", "testresults.trx"));
var parameters = new TestFrameworkParameters(files, "mstest");

// // act
// var results = await TestFrameworkResultReader.readResults(parameters);
// act
var results = await TestFrameworkResultReader.readResults(parameters);

// // assert
// expect(results.length).to.eq(1);
// });
// assert
expect(results.length).to.eq(10);
});


})

0 comments on commit f1bd916

Please sign in to comment.