-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Adapt JUnit4 runner according new API #5710
Conversation
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/3084/ |
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/3085/ |
parameters.setJavaExecutable(JAVA_EXECUTABLE); | ||
parameters.setMainClassName(MAIN_CLASS_NAME); | ||
|
||
List<String> classPath = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several testing frameworks or test runners (such as arquillian, etc ...) assume that the current working directory should be the root directory of the project.
See this issue as an example.
So it seems that the working directory should be explicitly set to the root directory of the project being tested.
This would also be consistent with the way tests are run inside maven afaik.
This has already been done for the TestNG part ( see this discussion and this line ).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Miss to set a value of the working directory. Thank you!
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/3087/ |
|
||
private static final Logger LOG = LoggerFactory.getLogger(AbstractJavaTestRunner.class); | ||
protected static final String PROJECTS_ROOT_FOLDER = "/projects"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we replace hrdcoded "/projects" with
@Named("che.user.workspaces.storage") File projectsRoot
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can. I've replaced
public static void treeNode(PrintStream out, Description description) { | ||
String location = description.getClassName() + "." + description.getMethodName(); | ||
out.println(create("suiteTreeNode", | ||
new Pair("name", escape(description.getMethodName())), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe some constant here for "name", "location" and etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to constants
/** | ||
* JUnit implementation for the test runner service. | ||
*/ | ||
public class TestRunner extends AbstractJavaTestRunner { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to JUnit4TestRunner ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/3104/ |
public List<TestResultDto> getTestResults(List<String> testResultsPath) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
import java.util.Set; | ||
|
||
/** | ||
* JUnit implementation for the test runner service. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't you an author of this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am. But we decided (inside our team) don't add an author to the javadoc.
@svor 👍 . Few feedbacks:
|
Build # 3110 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/3110/ to view the results. |
@slemeur I've updated the PR, please take a look |
# Conflicts: # plugins/plugin-testing-java/plugin-testing-junit/che-plugin-testing-junit-ide/pom.xml # plugins/plugin-testing-java/plugin-testing-testng/che-plugin-testing-testng-ide/pom.xml
thanks @svor ! |
Build # 3114 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/3114/ to view the results. |
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/3117/ |
What does this PR do?
Added a base implementation of JUnit4 framework.
What was made:
The simple demo:
https://youtu.be/fEM9dLDzRmo
What issues does this PR fix or reference?
#5473
Changelog
Release Notes
In this version we have been implementing JUnit4 API for running tests. We added default interfaces and mecanism which will allow to bring better test capabilities inside of Eclipse Che. We have also reworked the JUnit runner in order to use features:
Run one test method:
Run all tests from the test class:
Debug test: