Project Issue Running Through Maven Test | Selenium Training|Java|WebDriver|TestNG|Frameworks|Videos

Selenium Training Forum

Project Issue Running Through Maven Test

Y
youralok Post on 30/05/2019

I am trying to run my project through 'Maven test', but I am getting various errors related to apache poi. I right click on the project folder in Eclipse and run the test as 'Maven test', but it ends up in giving error.

Please find one of the example errors given below:

-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@e73f9ac
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@3224f60b
Tests run: 3, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 10.595 sec <<< FAILURE!
init(com.Shree_Automate_Feb2019.base.BaseTest) Time elapsed: 7.486 sec <<< FAILURE!
java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Font
at com.Shree_Automate_Feb2019.base.BaseTest.init(BaseTest.java:61)
Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Font
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 35 more


Results :

Failed tests: init(com.Shree_Automate_Feb2019.base.BaseTest): org/apache/poi/ss/usermodel/Font

Tests run: 3, Failures: 1, Errors: 0, Skipped: 1

S

Instructor

Support Team Reply on 30/05/2019

Please check BaseTest.java, line number 61 for the possible error.

Y
youralok Reply on 30/05/2019

I checked and do not see any issue as the tests run fine with testng.xml and directly the testcase.class files.

The issue is only with maven test while running the project folder. Please find the screenshot for your reference.

Y
youralok Reply on 30/05/2019

I think that Maven expects all the poi files to be latest and/or of same version. We are using your poi files for Xls_Reader which are not latest version and maybe that is causing the problem?

S

Instructor

Support Team Reply on 31/05/2019

Please use POI 3.6 everywhere.

Y
youralok Reply on 04/06/2019

Yes, I am already using that. As said, the same configuration is working fine at testng.xml and individual testcases level.

S

Instructor

Support Team Reply on 04/06/2019

Please share your project in a compressed zip file.

Y
youralok Reply on 11/06/2019

I am unable to attach the zip file sized 16mb. How to do it?

S

Instructor

Support Team Reply on 12/06/2019

share the screenshot for the error.

Alternatively, share the file in OneDrive or Google Drive

Y
youralok Reply on 24/07/2019

Please access the zip file at https://drive.google.com/open?id=1k-uw12KSJzU448uZllxpiO32pQq5xP9a.

S

Instructor

Support Team Reply on 25/07/2019

As I imported your code and found many issues with your project structure. I would suggest you watch the framework videos again and rebuild the framework accordingly.

I found issues with dependencies in POM.xml and when we're using maven, we need not to import jars manually.

Y
youralok Reply on 05/08/2019

You can close this for now. I will open separate specific ticket as needed.