Save TestNG Html reports

26 views
Skip to first unread message

Maxime Feraud

unread,
Jun 7, 2016, 9:49:45 AM6/7/16
to testng-users
Hi! 

Is it possible to save or move testng Html reports after a test is done in Jenkins ? 
When i do many tests the files are overwrited.
Do you have an idea about how can I copy or move the files  before they are overwrited ?

I'm using Maven and TestNG in a Java Selenium project.

Thanks !


⇜Krishnan Mahadevan⇝

unread,
Jun 7, 2016, 9:55:06 AM6/7/16
to testng...@googlegroups.com
Maxime,

Here's an ugly hack of getting this done.

Assuming you know where the reports are going to be made available, why not build a utility method which when invoked would move/copy the reports to a different location. This utility would then be called from within a Shutdown hook. That way you have an assurance that the JVM would invoke it just before it gets killed [ yes there are some caveats around using shutdown hooks, but I think that should solve your purpose no ? ]

The other option is basically to build a new reporter [ one which implements IReporter interface ] which when invoked would spin off a new Thread, which would keep an eye on the location where the reports are going to be generated and as soon as the reports are made available, it would perform the move/copy operation and then shut itself down.



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Shawn McCarthy

unread,
Jun 7, 2016, 11:58:35 AM6/7/16
to testng-users
Why not setup a build step or post build step to copy the files to a different location? Maybe change the name too so that you can copy the next run's report to the same location?

Maxime Feraud

unread,
Jun 8, 2016, 2:39:33 AM6/8/16
to testng-users
Thanks for your reply

Effectively, after searching in the web, I finaly choose this solution.

I add the " Post-Build Script " Plug-in in Jenkins to execute a shell script that copy the report to an other location after the build.

Thanks for help 

⇜Krishnan Mahadevan⇝

unread,
Jun 8, 2016, 2:57:39 AM6/8/16
to testng...@googlegroups.com
Yep. That would the be most simplest solution :)


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
Reply all
Reply to author
Forward
0 new messages