-
Notifications
You must be signed in to change notification settings - Fork 24
Add support for running tests #144
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5462e49
Add support for running tests
Arthurm1 4682ea0
Add test hierarchy to taskId
Arthurm1 7711c0c
Add TestName to preserve test hierarchy
Arthurm1 4b7938c
Handle exceptions in @BeforeAll
Arthurm1 3da2823
Add TestNG and Spock tests
Arthurm1 46e330a
Don't overwrite testClasses map
Arthurm1 a5f6953
Connector cache test - do not merge
Arthurm1 a1cd395
Revert "Connector cache test - do not merge"
Arthurm1 4f25385
Handle nested tests. Add logging for github error. Split out test me…
Arthurm1 bc2a314
Add logging for github action
Arthurm1 d574df9
Use getTestDisplayName for test info and update to tooling api 8.8
Arthurm1 34f99f4
Merge branch 'develop' into test_run
jdneo 4c01d1c
test
jdneo 0613b26
test gradle version
jdneo b298691
Handle versions before getTestDisplayName
Arthurm1 96b5a64
Add additional sourceset test
Arthurm1 a185f1a
Fix checkstyle and disable env var tests on CI
Arthurm1 2d13cc3
Revert the test change
jdneo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
84 changes: 84 additions & 0 deletions
84
server/src/main/java/ch/epfl/scala/bsp4j/extended/TestFinishEx.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT license. | ||
|
|
||
| package ch.epfl.scala.bsp4j.extended; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| import org.eclipse.lsp4j.jsonrpc.validation.NonNull; | ||
| import org.eclipse.xtext.xbase.lib.Pure; | ||
| import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; | ||
|
|
||
| import ch.epfl.scala.bsp4j.TestFinish; | ||
| import ch.epfl.scala.bsp4j.TestStatus; | ||
|
|
||
| /** | ||
| * Extended {@link TestFinish}, which contains the Suite, class, method. | ||
| * {@link TestFinish} only contains file location which Gradle doesn't have. | ||
| */ | ||
| public class TestFinishEx extends TestFinish { | ||
|
|
||
| private TestName testName; | ||
|
|
||
| private String stackTrace; | ||
|
|
||
| /** | ||
| * Create a new instance of {@link TestFinishEx}. | ||
| */ | ||
| public TestFinishEx(@NonNull String displayName, @NonNull TestStatus status, | ||
| @NonNull TestName testName) { | ||
| super(displayName, status); | ||
| this.testName = testName; | ||
| } | ||
|
|
||
|
|
||
| public TestName getTestName() { | ||
| return testName; | ||
| } | ||
|
|
||
| public void setTestName(TestName testName) { | ||
| this.testName = testName; | ||
| } | ||
|
|
||
| public String getStackTrace() { | ||
| return stackTrace; | ||
| } | ||
|
|
||
| public void setStackTrace(String stackTrace) { | ||
| this.stackTrace = stackTrace; | ||
| } | ||
|
|
||
| @Override | ||
| @Pure | ||
| public String toString() { | ||
| ToStringBuilder b = new ToStringBuilder(this); | ||
| b.add(super.toString()); | ||
| b.add("testName", this.testName); | ||
| b.add("stackTrace", this.stackTrace); | ||
| return b.toString(); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| final int prime = 31; | ||
| int result = super.hashCode(); | ||
| result = prime * result + Objects.hash(testName, stackTrace); | ||
| return result; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) { | ||
| return true; | ||
| } | ||
| if (!super.equals(obj)) { | ||
| return false; | ||
| } | ||
| if (getClass() != obj.getClass()) { | ||
| return false; | ||
| } | ||
| TestFinishEx other = (TestFinishEx) obj; | ||
| return Objects.equals(testName, other.testName) | ||
| && Objects.equals(stackTrace, other.stackTrace); | ||
| } | ||
| } |
117 changes: 117 additions & 0 deletions
117
server/src/main/java/ch/epfl/scala/bsp4j/extended/TestName.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT license. | ||
|
|
||
| package ch.epfl.scala.bsp4j.extended; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| import org.eclipse.lsp4j.jsonrpc.validation.NonNull; | ||
| import org.eclipse.xtext.xbase.lib.Pure; | ||
| import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; | ||
|
|
||
| /** | ||
| * BSP TestName, which contains the test name and the test hierarchy | ||
| * e.g. method/class/suite | ||
| */ | ||
| public class TestName { | ||
|
|
||
| private String displayName; | ||
|
|
||
| private String suiteName; | ||
|
|
||
| private String className; | ||
|
|
||
| private String methodName; | ||
|
|
||
| private TestName parent; | ||
|
|
||
| /** | ||
| * Create a new instance of {@link TestName}. | ||
| */ | ||
| public TestName(@NonNull String displayName, String suiteName, | ||
| String className, String methodName) { | ||
| this.displayName = displayName; | ||
| this.suiteName = suiteName; | ||
| this.className = className; | ||
| this.methodName = methodName; | ||
| } | ||
|
|
||
| public String getDisplayName() { | ||
| return displayName; | ||
| } | ||
|
|
||
| public void setDisplayName(String displayName) { | ||
| this.displayName = displayName; | ||
| } | ||
|
|
||
| public String getSuiteName() { | ||
| return suiteName; | ||
| } | ||
|
|
||
| public void setSuiteName(String suiteName) { | ||
| this.suiteName = suiteName; | ||
| } | ||
|
|
||
| public String getClassName() { | ||
| return className; | ||
| } | ||
|
|
||
| public void setClassName(String className) { | ||
| this.className = className; | ||
| } | ||
|
|
||
| public String getMethodName() { | ||
| return methodName; | ||
| } | ||
|
|
||
| public void setMethodName(String methodName) { | ||
| this.methodName = methodName; | ||
| } | ||
|
|
||
| public TestName getParent() { | ||
| return parent; | ||
| } | ||
|
|
||
| public void setParent(TestName parent) { | ||
| this.parent = parent; | ||
| } | ||
|
|
||
| @Override | ||
| @Pure | ||
| public String toString() { | ||
| ToStringBuilder b = new ToStringBuilder(this); | ||
| b.add("displayName", this.displayName); | ||
| b.add("suiteName", this.suiteName); | ||
| b.add("className", this.className); | ||
| b.add("methodName", this.methodName); | ||
| b.add("parent", this.parent); | ||
| return b.toString(); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| final int prime = 31; | ||
| int result = super.hashCode(); | ||
| result = prime * result + Objects.hash(displayName, suiteName, className, methodName, parent); | ||
| return result; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) { | ||
| return true; | ||
| } | ||
| if (!super.equals(obj)) { | ||
| return false; | ||
| } | ||
| if (getClass() != obj.getClass()) { | ||
| return false; | ||
| } | ||
| TestName other = (TestName) obj; | ||
| return Objects.equals(displayName, other.displayName) | ||
| && Objects.equals(suiteName, other.suiteName) | ||
| && Objects.equals(className, other.className) | ||
| && Objects.equals(methodName, other.methodName) | ||
| && Objects.equals(parent, other.parent); | ||
| } | ||
| } |
69 changes: 69 additions & 0 deletions
69
server/src/main/java/ch/epfl/scala/bsp4j/extended/TestStartEx.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT license. | ||
|
|
||
| package ch.epfl.scala.bsp4j.extended; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| import org.eclipse.lsp4j.jsonrpc.validation.NonNull; | ||
| import org.eclipse.xtext.xbase.lib.Pure; | ||
| import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; | ||
|
|
||
| import ch.epfl.scala.bsp4j.TestStart; | ||
|
|
||
| /** | ||
| * Extended {@link TestStart}, which contains the Suite, class, method. | ||
| * {@link TestStart} only contains file location which Gradle doesn't have. | ||
| */ | ||
| public class TestStartEx extends TestStart { | ||
|
|
||
| private TestName testName; | ||
|
|
||
| /** | ||
| * Create a new instance of {@link TestStartEx}. | ||
| */ | ||
| public TestStartEx(@NonNull String displayName, @NonNull TestName testName) { | ||
| super(displayName); | ||
| this.testName = testName; | ||
| } | ||
|
|
||
| public TestName getTestName() { | ||
| return testName; | ||
| } | ||
|
|
||
| public void setTestName(TestName testName) { | ||
| this.testName = testName; | ||
| } | ||
|
|
||
| @Override | ||
| @Pure | ||
| public String toString() { | ||
| ToStringBuilder b = new ToStringBuilder(this); | ||
| b.add(super.toString()); | ||
| b.add("testName", this.testName); | ||
| return b.toString(); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| final int prime = 31; | ||
| int result = super.hashCode(); | ||
| result = prime * result + Objects.hashCode(testName); | ||
| return result; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) { | ||
| return true; | ||
| } | ||
| if (!super.equals(obj)) { | ||
| return false; | ||
| } | ||
| if (getClass() != obj.getClass()) { | ||
| return false; | ||
| } | ||
| TestStartEx other = (TestStartEx) obj; | ||
| return Objects.equals(testName, other.testName); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.