-
Notifications
You must be signed in to change notification settings - Fork 161
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
Fix for issue 2994 - unable to run JUnit tests locally #3255
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3255 +/- ##
==============================================
+ Coverage 39.89% 54.43% +14.54%
- Complexity 694 785 +91
==============================================
Files 1455 1455
Lines 29749 29749
Branches 2498 2498
==============================================
+ Hits 11867 16195 +4328
+ Misses 16956 12638 -4318
+ Partials 926 916 -10 |
5f23fa9
to
7a05fe7
Compare
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.
There are some things to change and also why there are plenty of test that have been removed?
.../test/java/org/eclipse/kapua/broker/core/plugin/DefaultConnectorDescriptionProviderTest.java
Outdated
Show resolved
Hide resolved
.../test/java/org/eclipse/kapua/service/authentication/shiro/utils/AuthenticationUtilsTest.java
Outdated
Show resolved
Hide resolved
Hey @Coduz,
The problem is, that IntelliJ has a different runner than e.g. GHA or Terminal. Because of this, some of the tests were failing when running locally (but not failing when running on Travis, GHA, IntelliJ or Eclipse). By removing them, we are not losing anything, as they should not be there in the first place (tests should always be successfull, no matter how they are run). If this is not OK, I can try and find a different solution. |
I have changed the category for running pure JUnit tests. Before this user could only run the tests with command "mvn test -Dgroups='org.eclipse.kapua.test.junit.JUnitTests'", but this changed, when this category got moved to qa/markers/... Instead of using this default category for running JUnit tests, I have added a profile ("junitTests") that enable developers and testers to run tests in Terminal on local machine with command: "mvn test -PjunitTests". This is the same as running tests with command "mvn test -Dgroups='org.eclipse.kapua.qa.markers.Categories$junitTests'", but is much shorter and therfore easier to executed. I recommend running this command prior to every push/PR to see, if everything is OK. I have added ony one category in "qa/markers" module ("junitTests"), but I will also add one for running cucumber unit tests and one for running cucumber integration tests later. I have deleted a "unit" test that has been in "console" module for a long period of time, but it does nothing and should actually not be there anyway: deleted kapua/console/module/api/src/test/java/org/eclipse/kapua/app/console/module/api/test/SplitTooltipStringTest.java POMs changed: - root kapua pom.xml - qa/integration/pom.xml - github actions yml file RunTests.md file has also been updated (with new command and some minor syntax errors). Signed-off-by: Leonardo Gaube <leonardo.gaube@endava.com>
I have run it on Ubuntu 18.04.5 and the tests finished successfully. |
I have changed the category for running pure JUnit tests. Before this user could only run
the tests with command "mvn test -Dgroups='org.eclipse.kapua.test.junit.JUnitTests'", but
this changed, when this category got moved to qa/markers/...
Instead of using this default category for running JUnit tests, I have added a profile ("junitTests")
that enable developers and testers to run tests in Terminal on local machine with command:
"mvn test -PjunitTests".
This is the same as running tests with command "mvn test -Dgroups='org.eclipse.kapua.qa.markers.Categories$junitTests'",
but is much shorter and therfore easier to executed.
I recommend running this command prior to every push/PR to see, if everything is OK.
I have added ony one category in "qa/markers" module ("junitTests"), but I will also add one for running cucumber unit
tests and one for running cucumber integration tests later.
I have deleted a "unit" test that has been in "console" module for a long period of time, but it does nothing
and should actually not be there anyway:
deleted kapua/console/module/api/src/test/java/org/eclipse/kapua/app/console/module/api/test/SplitTooltipStringTest.java
POMs changed:
Related Issue
this fixes issue #2994.
Description of the solution adopted
This is a fairly simpel solution, I only modified the Category for running unit tests, POMs (added "junitTests" profile) and GHA yaml file, becasuse category has been changed.
Any side note on the changes made
RunTests.md file has also been updated (with new command and some minor syntax errors).
@nezau-ct , @sonja-ct Can you please checkout this branch and run the tests locally on your machines with command "mvn test-PjunitTests" and report if the results are OK? Tests should be running for a couple of minutes (on my machine it takes 5 minutes, it may take more on your machines).
@Coduz can you please check the PR and merge it when you have time? Thanks!
Signed-off-by: Leonardo Gaube leonardo.gaube@endava.com