I'm having this error while running my test suite from jenkins and when i run in eclipse via Maven it's working fine,
I'm using the same pom.xml for jenkins which is giving this error:
Running TestSuite
INFO [main] (BrowserManager.java:124) - Connecting to http://chromedriver.storage.googleapis.com/ to check lastest chromedriver release
INFO [main] (BrowserManager.java:112) - Latest driver version: 2.9
INFO [main] (Downloader.java:56) - Binary driver previously downloaded /var/lib/jenkins/.m2/repository/webdriver/chromedriver/linux64/2.9/chromedriver
INFO [main] (Downloader.java:60) - Exporting webdriver.chrome.driver as /var/lib/jenkins/.m2/repository/webdriver/chromedriver/linux64/2.9/chromedriver
Tests run: 4, Failures: 1, Errors: 0, Skipped: 3, Time elapsed: 2.904 sec <<< FAILURE! - in TestSuite
Setup(webautomation.GetApp) Time elapsed: 2.218 sec <<< FAILURE!
java.lang.NoClassDefFoundError: org/openqa/selenium/ElementNotSelectableException
at webautomation.GetApp.Setup(GetApp.java:57)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.ElementNotSelectableException
at webautomation.GetApp.Setup(GetApp.java:57)
Results :
Failed tests:
webautomation.GetApp.Setup(webautomation.GetApp)
Run 1: GetApp.Setup:57 » NoClassDefFound org/openqa/selenium/ElementNotSelectableExce...
Run 2: PASS
Tests run: 3, Failures: 1, Errors: 0, Skipped: 2
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.671 s
[INFO] Finished at: 2016-10-06T17:27:37+05:00
[INFO] Final Memory: 26M/200M
[INFO] ------------------------------------------------------------------------
Related
If I am trying to run my SpringBoot project while it is stored in any folder located on Desktop on my MacBook - build fails.
If I move project to any other directory except Desktop - it builds fine.
What can be the reason?
Error message after maven clean - install:
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) # my-blog-springboot-v1 ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running ua.shamray.myblogspringbootv1.repository.AccountRepositoryTest
17:49:32.502 [main] DEBUG org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTestContextBootstrapper - Neither #ContextConfiguration nor #ContextHierarchy found for test class [AccountRepositoryTest]: using SpringBootContextLoader
17:49:32.508 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [ua.shamray.myblogspringbootv1.repository.AccountRepositoryTest]: no resource found for suffixes {-context.xml, Context.groovy}.
17:49:32.509 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [ua.shamray.myblogspringbootv1.repository.AccountRepositoryTest]: AccountRepositoryTest does not declare any static, non-private, non-final, nested classes annotated with #Configuration.
17:49:32.804 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Failed to complete search in directory [/Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/test-classes/ua/shamray] for files matching pattern [*.class]: java.nio.file.NoSuchFileException: /Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/test-classes/ua/shamray
17:49:32.805 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Failed to complete search in directory [/Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/classes/ua/shamray] for files matching pattern [*.class]: java.nio.file.NoSuchFileException: /Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/classes/ua/shamray
17:49:32.806 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Failed to complete search in directory [/Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/test-classes/ua] for files matching pattern [*.class]: java.nio.file.NoSuchFileException: /Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/test-classes/ua
17:49:32.807 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Failed to complete search in directory [/Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/classes/ua] for files matching pattern [*.class]: java.nio.file.NoSuchFileException: /Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/classes/ua
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.012 s <<< FAILURE! - in ua.shamray.myblogspringbootv1.MyBlogSpringbootV1ApplicationTests
[ERROR] ua.shamray.myblogspringbootv1.MyBlogSpringbootV1ApplicationTests Time elapsed: 0.012 s <<< ERROR!
java.lang.IllegalStateException: Unable to find a #SpringBootConfiguration, you need to use #ContextConfiguration or #SpringBootTest(classes=...) with your test
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] MyBlogSpringbootV1ApplicationTests » IllegalState Unable to find a #SpringBoot...
[ERROR] AccountControllerTest » IllegalState Unable to find a #SpringBootConfiguration...
[ERROR] AccountRepositoryTest » IllegalState Unable to find a #SpringBootConfiguration...
[ERROR] AccountServiceImplUnitTest » IllegalState Unable to find a #SpringBootConfigur...
[ERROR] MyUserDetailsServiceImplUnitTest » IllegalState Unable to find a #SpringBootCo...
[ERROR] PostServiceImpUnitTest » IllegalState Unable to find a #SpringBootConfiguratio...
[ERROR] RoleServiceImplUnitTest » IllegalState Unable to find a #SpringBootConfigurati...
[INFO]
[ERROR] Tests run: 7, Failures: 0, Errors: 7, Skipped: 0
[INFO]
I'm using JHipster 7.6.0 (Spring boot + React), when I run integration tests I got the following error. I searched on the internet but I have found nothing
Thanks in advance!
[ERROR] MailServiceIT.testSendEmailFromTemplate:143
expected: "test title"
but was: "Activation de votre compte gestionUtilisateurs"
[INFO]
[ERROR] Tests run: 225, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.7:report-integration (post-integration-tests) # gestion-utilisateurs ---
[INFO] Loading execution data file C:\Users\ASUS\.jenkins\workspace\apisation portnet\target\jacoco-it.exec
[INFO] Analyzed bundle 'Gestion Utilisateurs' with 83 classes
[INFO]
[INFO] --- maven-checkstyle-plugin:3.1.2:check (default) # gestion-utilisateurs ---
[INFO] You have 0 Checkstyle violations.
[INFO]
[INFO] --- maven-failsafe-plugin:3.0.0-M5:verify (verify) # gestion-utilisateurs ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:20 min
[INFO] Finished at: 2022-02-21T14:36:42+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:3.0.0-M5:verify (verify) on project gestion-utilisateurs: There are test failures.
[ERROR]
This failure happens if you choose French as a native language of the application. I reported this on JHipster GitHub repository. Also I mentioned how did I solve it so that the integration test won't fail.
here is the details of the failure:
https://github.com/jhipster/generator-jhipster/issues/17946
You can find my solution for the problem in Suggest a Fix
section in the link above
UPDATE
this issue is fixed since JHipster versoin 7.9.0
I've got a problem with maven-surefire-plugin reports. Maven version is 3.3.9, maven-surefire-plugin 2.18.1, version of JUnit is 4.12.
Tests run in Jenkins, there should be info after each test, but sometimes something goes wrong and there is no info in Console and there are no surefire reports.
Should be something like that
11:07:42 Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 194.569 sec - in com.example.content.SomeTest
11:07:42
11:07:42 Results :
11:07:42
11:07:42 Tests run: 8, Failures: 0, Errors: 0, Skipped: 0
11:07:42
11:07:42 [INFO] -------------------------------------------------------------------
11:07:42 [INFO] BUILD SUCCESS
11:07:42 [INFO] -------------------------------------------------------------------
11:07:42 [INFO] Total time: 03:17 min
11:07:42 [INFO] Finished at: 2017-11-15T11:07:39
11:07:42 [INFO] Final Memory: 15M/377M
11:07:42 [INFO] -------------------------------------------------------------------
But as I said sometimes there are no these lines. Previous and next test classes work fine and have all info and reports as it supposed to be
Is this problem really caused by surefire-plugin or maybe it's something different?
Good day! I would like to ask about the error that I'm encountering in Jenkins:
"Build step 'Invoke top-level Maven targets' marked build as failure"
I'm trying to run a selenium script (with JMeter script inside) in Jenkins. I'm getting a BUILD SUCCESS in console output in Jenkins but it marks the job failed because of that error. Kindly see below the console output:
Running TestSuite
Start: 11/04/2016 5:19:29 PM
RawConfigFileScenario3 is created
11/04/2016 5:19:49 PM [PASSED] No Error encountered on the Jmeter Script
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 23.962 sec - in TestSuite
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 48.165 s
[INFO] Finished at: 2016-11-04T17:19:50+08:00
[INFO] Final Memory: 14M/137M
[INFO] ------------------------------------------------------------------------
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE
I also tried to run the same script in Eclipse and I'm getting a SUCCESS result. Please see below the logs:
Running TestSuite
Start: 11/04/2016 4:26:26 PM
RawConfigFileScenario3 is created
11/04/2016 4:26:41 PM [PASSED] No Error encountered on the Jmeter Script
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 17.739 sec - in TestSuite
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 37.743 s
[INFO] Finished at: 2016-11-04T16:26:41+08:00
[INFO] Final Memory: 13M/136M
[INFO] ------------------------------------------------------------------------
I would like to ask for your guidance regarding this matter. Thank you in advance for the answers. :)
i have encounter this problem. and i just change the sdk configuration from java8 to java7.
hope this can help you.
I have a project for running tests. It's a maven project which uses Selenium. It runs correctly when launched locally, but from the Hudson platform, it throws NoClassDefFoundError:
Parsing POMs
[elsevier-selenium] $ "C:\Program Files\Java\jdk1.7.0_25/bin/java" -Xmx1024m -cp E:\hudson\plugins\maven-plugin\WEB-INF\lib\maven-agent-1.353.jar;E:\maven\boot\classworlds-1.1.jar hudson.maven.agent.Main E:\maven E:\hudson\war\WEB-INF\lib\remoting-1.353.jar E:\hudson\plugins\maven-plugin\WEB-INF\lib\maven-interceptor-1.353.jar 1753 E:\hudson\plugins\maven-plugin\WEB-INF\lib\maven2.1-interceptor-1.2.jar
<===[HUDSON REMOTING CAPACITY]===>channel started
Executing Maven: -B -f E:\hudson\jobs\tests-selenium\workspace\elsevier-selenium\pom.xml integration-test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building selenium-elsevier
[INFO] task-segment: [integration-test]
[INFO] ------------------------------------------------------------------------
[INFO] [compiler:testCompile {execution: default}]
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to E:\hudson\jobs\tests-selenium\workspace\elsevier-selenium\target\test-classes
[INFO] [site:attach-descriptor {execution: default-attach-descriptor}]
[INFO] [failsafe:integration-test {execution: default}]
[INFO] Failsafe report directory: E:\hudson\jobs\tests-selenium\workspace\elsevier-selenium\target\failsafe-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running fr.elsevier.tests.disponibilite.SearchTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.203 sec <<< FAILURE!
fr.elsevier.tests.disponibilite.SearchTest Time elapsed: 0.203 sec <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class fr.elsevier.tests.BaseSelenium
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at org.apache.maven.surefire.report.SmartStackTraceParser.getClass(SmartStackTraceParser.java:63)
at org.apache.maven.surefire.report.SmartStackTraceParser.<init>(SmartStackTraceParser.java:53)
at org.apache.maven.surefire.common.junit4.JUnit4StackTraceWriter.smartTrimmedStackTrace(JUnit4StackTraceWriter.java:72)
[...]
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
SearchTest extends BaseSelenium.
Which means it cannot even find a class in my source folder. The project structure is like this:
src/
fr.elsevier.tests/
disponibilite/
SearchTest.java
BaseSelenium.java
pom.xml
Why does the build generates these NoClassDefFoundErrors and how to fix it?
Try using -e or -X command line argument in local and hudson build. Then try to compare the classpath of the java processes launched.
You can then actually figure out which part of maven lifecycle threw the exception with better stacktrace.