-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Handle methods which have more than 2 arguments (#1532)
- Use global match when parsing the method parameters list. - Eliminate all spaces in the parameters list of the test IDs. Signed-off-by: Sheng Chen <[email protected]>
- Loading branch information
Showing
8 changed files
with
70 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -311,8 +311,8 @@ org.junit.ComparisonFailure: expected:<hello | |
workspaceFolder: workspace.workspaceFolders?.[0]!, | ||
}; | ||
let analyzer = new JUnitRunnerResultAnalyzer(runnerContext) | ||
// We need to stub this method to avoid isssues with the TestController | ||
// not being set up in the non-test version of the utils file. | ||
// We need to stub this method to avoid issues with the TestController | ||
// not being set up in the non-test version of the utils file. | ||
const stub = sinon.stub(analyzer, "enlistDynamicMethodToTestMapping"); | ||
stub.returnsArg(0); | ||
analyzer.analyzeData(testRunnerOutput); | ||
|
@@ -345,8 +345,8 @@ org.junit.ComparisonFailure: expected:<hello | |
}; | ||
|
||
analyzer = new JUnitRunnerResultAnalyzer(runnerContext); | ||
// We need to stub this method to avoid isssues with the TestController | ||
// not being set up in the non-test version of the utils file. | ||
// We need to stub this method to avoid issues with the TestController | ||
// not being set up in the non-test version of the utils file. | ||
sinon.stub(analyzer, "enlistDynamicMethodToTestMapping"); | ||
analyzer.analyzeData(testRunnerOutput); | ||
|
||
|
@@ -403,4 +403,39 @@ org.opentest4j.AssertionFailedError: expected: <1> but was: <2> | |
assert.strictEqual(testMessage.location?.range.start.line, 10); // =11 - 1, (most precise info we get from the stack trace) | ||
}); | ||
|
||
test("can handle test cases with more than 3 arguments", () => { | ||
const testItem = generateTestItem(testController, '[email protected]#testMultiArguments(String,String,String)', TestKind.JUnit5, new Range(10, 0, 16, 0)); | ||
const testRunRequest = new TestRunRequest([testItem], []); | ||
const testRun = testController.createTestRun(testRunRequest); | ||
const startedSpy = sinon.spy(testRun, 'started'); | ||
const passedSpy = sinon.spy(testRun, 'passed'); | ||
const testRunnerOutput = `%TESTC 0 v2 | ||
%TSTTREE2,junit5.ParameterizedAnnotationTest,true,1,false,1,ParameterizedAnnotationTest,,[engine:junit-jupiter]/[class:junit5.ParameterizedAnnotationTest] | ||
%TSTTREE3,testMultiArguments(junit5.ParameterizedAnnotationTest),true,0,false,2,testMultiArguments(String\\, String\\, String),java.lang.String\\, java.lang.String\\, java.lang.String,[engine:junit-jupiter]/[class:junit5.ParameterizedAnnotationTest]/[test-template:testMultiArguments(java.lang.String\\, java.lang.String\\, java.lang.String)] | ||
%TSTTREE4,testMultiArguments(junit5.ParameterizedAnnotationTest),false,1,true,3,[1] a\\, b\\, c,java.lang.String\\, java.lang.String\\, java.lang.String,[engine:junit-jupiter]/[class:junit5.ParameterizedAnnotationTest]/[test-template:testMultiArguments(java.lang.String\\, java.lang.String\\, java.lang.String)]/[test-template-invocation:#1] | ||
%TESTS 4,testMultiArguments(junit5.ParameterizedAnnotationTest) | ||
%TESTE 4,testMultiArguments(junit5.ParameterizedAnnotationTest) | ||
%RUNTIME162`; | ||
const runnerContext: IRunTestContext = { | ||
isDebug: false, | ||
kind: TestKind.JUnit5, | ||
projectName: 'junit', | ||
testItems: [testItem], | ||
testRun: testRun, | ||
workspaceFolder: workspace.workspaceFolders?.[0]!, | ||
}; | ||
|
||
const analyzer = new JUnitRunnerResultAnalyzer(runnerContext); | ||
|
||
// We need to stub this method to avoid isssues with the TestController | ||
// not being set up in the non-test version of the utils file. | ||
const stub = sinon.stub(analyzer, "enlistDynamicMethodToTestMapping"); | ||
const dummy = generateTestItem(testController, '[__INVOCATION__]-dummy', TestKind.JUnit5, new Range(10, 0, 16, 0)); | ||
stub.returns(dummy); | ||
analyzer.analyzeData(testRunnerOutput); | ||
|
||
sinon.assert.calledWith(startedSpy, dummy); | ||
sinon.assert.calledWith(passedSpy, dummy); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters