Module20, Maven test | Selenium Forum
M
Posted on 10/01/2016
Hi Team,

I am able to run the script testng from eclipse.

But when i try to execute in command prompt as "mvn test" , i am getting build failure error message.
Please find the attachment..

Thanks
Manoj

M
Replied on 11/01/2016

zip and upload your project.


M
Replied on 11/01/2016

Uploded. Please find the attachment.


M
Replied on 11/01/2016

i tested your project and is running fine for the error you are getting

try this link http://stackoverflow.com/questions/4123044/maven-3-warnings-about-build-plugins-plugin-version


M
Replied on 15/01/2016

I have added below code in my pom.xml. But didnt worked for me.
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>

Can you please share me latest pom.xml file


M
Replied on 15/01/2016

try this one.


M
Replied on 16/01/2016

Thanks. I am able to sun now.
But the report folder is getting generated as null,
This is working fine if i run the code from eclipse
Attached the report section

Note: this issue only if i run code in cmd>mvn test

Responsive image

M
Replied on 16/01/2016

reports ng has been depreacted you cannot make xslt reports from maven you have to use ANT.

if you are not using ANT and want to make good looking reports with maven use this

1. go to this link <http://relevantcodes.com/testng-listener-using-extentreports/>
2. create class "ExtentReporterNG". This is Listener class and put second block code in it from upper link and save it.
3. put ExtentReporterNG this listener in your testneg.xml. change package name with your package name.
<listeners>
<listener class-name="package.ExtentReporterNG" />
</listeners>
4. Add dependency in you POM.xml
<!-- Extent Reports -->
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.04</version>
</dependency>

5. now open cmd prompt and go to your project location and run command "mvn compile" and after it run "mvn package"
6. go in eclipse and refresh your project and run your testng.xml
7. after running refresh your project and check report in test output folder.
8. a folder generate with your class name. check extent.html in it and open this in web browser.


M
Replied on 16/01/2016

I am fine with report. My query here is i am unable to execute script in command prompt
mvn test is giving build failure


M
Replied on 18/01/2016

i am able to build your project successfully. please delete your entire .m2/repository.

so POM.xml can download again.


M
Replied on 23/01/2016

Thanks
issue solved i have deleted old repository file and compiled again
Responsive image


M
Replied on 27/01/2016

Related, but a bit different issue: When I run the test with "mvn test site", the test is being executed but no reports are being created(under the "target" folder). The POM file is setup with the settings from AUg 2014.
Following your conversation above, I'm wondering whether the depreciating of the NG reports would explain my error!
Thanks!

Responsive image

M
Replied on 28/01/2016

reporty ng has been deprecated you cannot make xslt reports from maven you have to use ANT.

if you are not using ANT and want to make good looking reports with maven use this

1. go to this link <http://relevantcodes.com/testng-listener-using-extentreports/>
2. create class "ExtentReporterNG". This is Listener class and put second block code in it from upper link and save it.
3. put ExtentReporterNG this listener in your testneg.xml. change package name with your package name.
<listeners>
<listener class-name="package.ExtentReporterNG" />
</listeners>
4. Add dependency in you POM.xml
<!-- Extent Reports -->
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.04</version>
</dependency>

5. now open cmd prompt and go to your project location and run command "mvn compile" and after it run "mvn package"
6. go in eclipse and refresh your project and run your testng.xml
7. after running refresh your project and check report in test output folder.
8. a folder generate with your class name. check extent.html in it and open this in web browser.


M
Replied on 01/02/2016

Thanks
It worked fine.


M
Replied on 02/02/2016

Thanks , I have deleted and created new repository through maven
It worked for me


M
Replied on 04/02/2016

I'm glad that for some of you worked Responsive image!
But for me, still does Not. I think I'm missing something: So I saved the code, setup the testing and Pom, all is good, but the copied code gives me some errors which I'm not sure how to deal with( It looks like something with the imports, but Responsive image )
Thank you in advance!

Responsive image

M
Replied on 04/02/2016

have you added extent jar files to reference library in eclipse.


M
Replied on 05/02/2016

Thanks for the reminder! Yes, I just added the jars, but after I run the testng file, that error is coming:

<java.io.FileNotFoundException: C:\MyWorkspace\MyProjectMemocast\Core.qtpselenium.datadriven.framework\target\reports\Fri Feb 05 11_00_12 PST 2016\Report.xlsx (The system cannot find the file specified)>


Looks like Report.xlsx is not being generated or misplaced. Could you advice?


M
Replied on 05/02/2016

i am not aware of any such file is generated in extent report.