eclipse - Maven test - java.lang.ClassNotFoundException: org.testng.AssertJUnit -
i'm trying guide learn integrate maven, jenkins , selenium. issue guides erosion of time , serious compatibility issues. i've been trying debug go, right i'm @ step 15 , can't go further due issue:
t e s t s ------------------------------------------------------- running example.newtest tests run: 1, failures: 1, errors: 0, skipped: 0, time elapsed: 2.255 sec <<< failure!
results :
failed tests: example.newtest.testeasy(): org/testng/assertjunit
tests run: 1, failures: 1, errors: 0, skipped: 0
[info] ------------------------------------------------------------------------ [info] build failure [info] ------------------------------------------------------------------------ [info] total time: 9.145s [info] finished at: tue sep 12 09:42:36 pdt 2017 [info] final memory: 7m/17m [info] ------------------------------------------------------------------------ [error] failed execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project wdtest: there test failures. [error] [error] please refer c:\st\kpimuiws-build-changes\wdtest\target\surefire-reports individual test results.
the surefire reports textfile shows:
test set: example.newtest
tests run: 1, failures: 1, errors: 0, skipped: 0, time elapsed: 2.255 sec <<< failure! example.newtest.testeasy() time elapsed: 2.25 sec
<<< failure! java.lang.noclassdeffounderror: org/testng/assertjunit @ example.newtest.testeasy(newtest.java:34) caused by: java.lang.classnotfoundexception: org.testng.assertjunit
@ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.misc.launcher$appclassloader.loadclass(unknown source) @ java.lang.classloader.loadclass(unknown source) ... 19 more
here pom;
<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>wdtest</groupid> <artifactid>wdtest</artifactid> <version>0.0.1-snapshot</version> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>2.3.2</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>2.12</version> <inherited>true</inherited> <configuration> <suitexmlfile>testng.xml</suitexmlfile> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>3.8.1</version> <scope>compile</scope> </dependency> <dependency> <groupid>org.seleniumhq.selenium</groupid> <artifactid>selenium-java</artifactid> <version>2.45.0</version> </dependency> </dependencies> </project> and here newtest.java
package example; import java.io.file; import org.testng.annotations.test; //import org.testng.assert; import org.testng.assertjunit; //import org.openqa.selenium.by; import org.openqa.selenium.webdriver; import org.openqa.selenium.firefox.firefoxbinary; import org.openqa.selenium.firefox.firefoxdriver; import org.openqa.selenium.firefox.firefoxprofile; //import org.testng.annotations.test; import org.testng.annotations.beforetest; import org.testng.annotations.aftertest; public class newtest { //private webdriver driver; file pathbinary = new file("c:\\users\\t667627\\appdata\\local\\mozillafirefox\\firefox.exe"); firefoxbinary firefoxbinary = new firefoxbinary(pathbinary); firefoxprofile firefoxprofile = new firefoxprofile(); webdriver driver = new firefoxdriver(firefoxbinary, firefoxprofile); @test public void testeasy() { driver.get("http://demo.guru99.com/selenium/guru99home/"); string title = driver.gettitle(); assertjunit.asserttrue(title.contains("demo guru99 page")); } @beforetest public void beforetest() { driver = new firefoxdriver(); } @aftertest public void aftertest() { driver.quit(); } }
assertjunit part of testng library. can try including testng in pom?
<dependency> <groupid>org.testng</groupid> <artifactid>testng</artifactid> <version>6.11</version> <scope>test</scope> </dependency>
Comments
Post a Comment