Shutterbug NoClassDefFound - java

I am executing some selenium tests and wanted to add Shutterbug to my project for screenshots. I Added a mvn dependency:
<dependency>
<groupId>com.assertthat</groupId>
<artifactId>selenium-shutterbug</artifactId>
<version>1.3</version>
</dependency>
and started to code. It works as expected local, but when I wanted to run it on Jenkins, it gave me NoClassDefFound exception:
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] SomeTest.test:38 » NoClassDefFound com/assertthat/selenium_shutterbug/util...
[INFO]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
I have deleted all the code related to this library and just have now only the dependency in pom.xml. It fails even now. I found out that failure occures when I run it on Jenkins or when I run it local but in headless mode. How can I get it work?

Related

Maven: Get Compilation error case in surefire-reports

I'm running mvn test, and based on the generated xml results file, i'm preparing the results summary.
Here now i'm only able to handle right or wrong testcases.
and if any issue in the code, i'm getting the compilation error in the mvn test
Can we log the compilation errors as well in the surefire-reports ?
Outcome expected: include the compilation error case in the below result itself.
-------------------------------------------------------------------------------
Test set: com.example.helloworld.HelloWorldApplicationTests
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.666 s - in com.example.helloworld.HelloWorldApplicationTests

Failures when running "mvn test"

What can be the reason that I can successfully run testNG suite (14 tests) directly from selenium eclipse but when I am trying to run it throw CMD with command : mvn test
It's stops after 6 tests every time ?
Also The 1st test success from selenium and here is always failed.
BTW : When I am trying to do : mvn clean or compile its success.
[ERROR] Failures:
[ERROR] OrderBE.order:75->addItems:113 » IndexOutOfBounds Index: 22, Size: 22
[INFO]
[ERROR] Tests run: 6, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:20 min
[INFO] Finished at: 2022-03-01T17:06:15+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project miron: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Program Files\Selenium\Projects\BE UAT\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
are you running them in parallel?
it could be the limit of the number of browers per processor (I had an issue like that)
Try restarting the driver if grid, and changing the limit
Make sure your TestNG tests in src\main\test folder and not in main\java

Jenkins is unable to locate file that can be located manually

When I added the commands that I use manually at the command prompt to run my project to Jenkins, Jenkins is unable to find the file that's referenced.
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.631 s <<< FAILURE! - in TestSuite
[ERROR] main(test.java.IterateToEAMethods) Time elapsed: 0.016 s <<< FAILURE!
java.io.FileNotFoundException: Q:\A_Parts routing\03_Systeme\Selenium\Vega Automatisierung Teil 1\AutomatisierterSteuerungsantrag.xls (The system cannot find the path specified)
at test.java.IterateToEAMethods.main(IterateToEAMethods.java:162)
When I run this project through the command line using the exact same commands it runs fine.
CD C:\Users\D171_o_QECJACK031\eclipse-workspace\VegaAutomatisierungPart2
mvn --settings settings.xml compile clean test
Does anyone know how to get Jenkins to have access to the file?
None of my other projects that use files have this problem and they run through Jenkins.
You need to replace \ with \\ when accessing paths in windows.
You could use dir with the path where your scripts are present :
// dir("<Your path where scripts are present>")
dir ("C:\\Users\\D171_o_QECJACK031\\eclipse-workspace\\VegaAutomatisierungPart2"){
<Your commands>
}

SeekTool - what can that be?

When doing a mvn test on a Java project on Win10 I get 2 failure notes:
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[ERROR] SeekTools: Seek for the Project Tool Folder (give option '-h' for help)
[ERROR] ERROR: reached root of filesystem
... test runs smoothly, but Surefire reports:
[INFO] Results:
[INFO]
[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[ERROR] There are test failures.
I am using Maven 3.6.3 and Java 11.0.10 on Win10.
When doing the same to the same project on Debian-10, I get no such errors. Here I am using Maven 3.6.0 and Java 11.0.9.
I doubt that the small version difference causes the failures. But I got no clue how to start to solve them. Google did not help.
I am applying the plugins
maven-compiler-plugin 3.8.1
maven-surefire-plugin 3.0.0-M5
Do you got any hint for me how to approach this problem?
The complete output is here.
The pom.xml is here
#ngong
<forkCount>0</forkCount> and <forkMode>never</forkMode> is not a fix.
You are using JDK11. I guess you do not use JPMS.
We have a bug in Surefire and you can workaround it by <useModulePath>false</useModulePath>.
Setting forkCount to zero or forkMode to never is inherently wrong idea in this case because any changes in the environment may affect your tests on any machine.
Please see https://stackoverflow.com/a/65806777/2758738

Neo4j-spatial maven build failure

I know there is a similar question to this (to question: Neo4j Spatial: can't run spatial), however that question seems to be solved when installing dependencies. I think that is not the solution to my case.
After installing Neo4j and installing maven
$ brew install neo4j
$ brew install maven
making a directory called spatial and cloning neo4j-spatial to this folder.
$ git clone https://github.com/neo4j-contrib/spatial.git
Then i tried to maven install this git clone.
/spatial$ mvn install
After a lot of test it returns a "Build failure"
Results :
Failed tests:
ProgressLoggingListenerTest.testProgressLoggingListnerWithAllLogs:38->testProgressLoggingListenerWithSpecifiedWaits:62
Argument(s) are different! Wanted:
forwardingPrintStream.println(
"100.00 (10/10) - Completed test"
);
-> at org.neo4j.gis.spatial.ProgressLoggingListenerTest.testProgressLoggingListenerWithSpecifiedWaits(ProgressLoggingListenerTest.java:62)
Actual invocation has different arguments:
forwardingPrintStream.println(
"10,00 (1/10) - Running test"
);
-> at org.neo4j.gis.spatial.rtree.ProgressLoggingListener.lambda$new$1(ProgressLoggingListener.java:45)
ProgressLoggingListenerTest.testProgressLoggingListnerWithOnlyStartAndEnd:46->testProgressLoggingListenerWithSpecifiedWaits:62
Argument(s) are different! Wanted:
forwardingPrintStream.println(
"100.00 (10/10) - Completed test"
);
-> at org.neo4j.gis.spatial.ProgressLoggingListenerTest.testProgressLoggingListenerWithSpecifiedWaits(ProgressLoggingListenerTest.java:62)
Actual invocation has different arguments:
forwardingPrintStream.println(
"10,00 (1/10) - Running test"
);
-> at org.neo4j.gis.spatial.rtree.ProgressLoggingListener.lambda$new$1(ProgressLoggingListener.java:45)
Tests run: 146, Failures: 2, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10:34 min
[INFO] Finished at: 2016-09-23T15:55:35+02:00
[INFO] Final Memory: 44M/558M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project neo4j-spatial: There are test failures.
[ERROR]
[ERROR] Please refer to /Volumes/Macintosh HD/Users/Tom/spatial/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
In my queeste to solve this "Build failure" I discovered that most maven install errors are due to dependencies. However these error messages do not indicate any missing dependencies?
I tried using mvn verify however this just seems to try to build the plugin again returning the same Build failure.
/spatial$ mvn verify
Two questions;
- Am I missing dependencies or is the problem in something else?
- If I am missing dependencies, what are they and how to install them?
Thanks in advance!
The tests depend on the locale of the build environment as it checks the result of number formatting with decimal number, expecting a point as the decimal separator:
"100.00 (10/10) - Completed test"
Your locale uses the comma as the decimal separator, based on the actual value reported:
"10,00 (1/10) - Running test"
You have 2 options:
Build the project without running the tests:
mvn install -Dmaven.test.skip
Change the locale for the build:
LANG=C mvn install
or
LANG=en_US mvn install

Categories