ANT and other file's configuration to generate XSLT Reports for selenium webdriver software automation test Is already done In previous STEP 19. So now configuration part Is over to generate XSLT reports. In this step, We will learn how to generate XSLT reports for selenium software test data driven framework.
STEP 20
Prerequisite : All previous 19 steps of selenium webdriver software testing data driven framework should be Implemented. You will find the links for all the previous steps on THIS PAGE.
Run Test Suites To Generate TestNG Report
Before generating XSLT reports, You need to run your test suites from "testng.xml" file because XSLT reports are generated using "testng-results.xml" file and this file will be generated when your run your test from testng.xml file.
Please keep this thing In your mind -> If you are changing something In your software automation test cases or project configuration after running your test cases and then you are going to generate XSLT reports then you can get wrong result or error during XSLT reports generation. So always generate XSLT reports just next to your test suites execution completion.
Run your test suites from testng.xml file. Your testng result report will look like bellow when you will open index.html file from test-output folder.
Note : Now you can execute your test suites from command prompt too using ant run command. See bellow given steps.
Generate XSLT Reports
Once your test execution get completed and testng results generated, We can go to generate XSLT report. You need to follow bellow given steps to generate XSLT report.
- Open command prompt.
- Set Project Path : Go to your "WDDF" project directory In command prompt where your "build.xml" file Is stored as shown In bellow Image. Command = cd E:\backup\Training\WDDF
- Verify build.xml Is Accessible : Type command = ant In command prompt and press enter to check that we are at correct place to generate XSLT reports or not. It should give message "BUILD SUCCESSFUL" as shown In bellow given Image.
- Remove Previous Build Folder If Any : Type Command = ant clear In command prompt and press enter. It should give message "BUILD SUCCESSFUL" as shown In bellow given Image.
- Verify Build Folder Is Generated : Now Refresh your "WDDF" project In eclipse. ant compile command will created new folder with name = build under your project as shown In bellow given Image.
- Execute Test Suites : Type Command = ant run In command prompt and press enter. It will execute your all software automation test suites which are included In testng.xml file.
So now you can execute your software test suites from command prompt Instead of testng.xml file.
- Generate XSLT Reports : Type Command = ant reports In command prompt and press enter. It should give message "BUILD SUCCESSFUL" as shown In bellow given Images.
- Open XSLT Report : Once more refresh your "WDDF" project In eclipse. ant reports command will create new folder with name = XSLT_Reports under your project as shown In bellow given Image.
- You will find index.html file In XSLT_Reports folder. That Is XSLT Report of your webdriver test. Open that file In any web browser. It will look like bellow.
XSLT Report
You can click on test case name In left side column(TestNG Results column) to view test case result In detail. If you look at above report, It Is Interactive and easy to understand that how many test cases are Pass, Fail and Skip for specific test case.
So we achieved our target of generating XSLT reports for our selenium webdriver software test data driven framework.
Hi,
ReplyDeleteI followed all the steps which you have mentioned.
After copying the "build.xml" file i am getting the following error.
Due to this i couldn't compile.
taskdef class org.testng.TestNGAntTask cannot be found using the classloader AntClassLoader
Hi,
ReplyDeleteAll the steps worked properly but i am not getting anything inside reports folder.
Even in command prompt also after typing "ant reports", I am getting some error message.
Please help me out with this.
Thanks
What Is the error?
DeleteIts showing in command prompt Build Failed....and the reports are not generated inside reports folder.
DeleteHave you followed steps properly? check path sand everything else once more..
Deleteat line 91 in the build.xml you have style="/com/stta/xslt/testng-results.xsl"
DeleteYou should have style="${project.home}/com/stta/xslt/testng-results.xsl"
It happened to me as well. Hope it helps.
in the build.xml at line 91, you have style="/com/stta/xslt/testng-results.xsl". You should have style="${project.home}/com/stta/xslt/testng-results.xsl"
DeleteHope it helps.
Hi Arvind,
DeleteThank you for great article, but when I am trying to generate the report below is the error I am facing kindly help me with this please.
javax.xml.transform.TransformerFactoryConfigurationError: Provider net.sf.saxon.TransformerFactoryImpl not found
Hi Aravind, i followed each and every step of what you have mentioned above and in command prompt 'clear' and 'compile' works perfectly but when i enter 'ant run' command then build is failing and displaying one error message as 'Cannot Find Class in ClassPath : Name of the class ', kindly help me please.
ReplyDeleteHi Aravind.
ReplyDeleteAll the steps worked properly so far. But at this step after compiling i am getting following error "taskdef class org.testng.TestNGAntTask cannot be found using the classloader AntClassLoade " Can u please suggesst what to be done?
Hi Aravind,
DeleteThis happens because the TestNG classes are not correctly defined within your classpath. An easy fix will be to include this jars hardcoded in the build.xml file (line 32). It should be something like this:
It works for me..
ReplyDeleteThanks Aravind
This comment has been removed by the author.
Deleteant compile is failing on this line in the build.xml file. What should it be set to? I can't do anything with ANT until this is corrected.
ReplyDeletetaskdef class org.testng.TestNGAntTask cannot be found using the classloader AntClassLoader[]
I get errors pointing to this line in the build.xml file. What should it be set too? I can't continue with ant until this is corrected. Thanks!
ReplyDeletetaskdef class org.testng.TestNGAntTask cannot be found using the classloader AntClassLoader[]
Hi!
ReplyDeleteUnfortunately, I get the same error as Thomas.
taskdef class org.testng.TestNGAntTask cannot be found using the classloader AntClassLoader[]
Could you please help me with it?
Also I noticed that there was a warning message in the build.xml in the 33-34 lines.
Thanks.
Maybe I should write something here in the build.xml ?
ReplyDeleteI got below mention error when I tried to compile
ReplyDeletetaskdef class org.testng.TestNGAnt taskdef class org.testng.TestNGAnt
taskdef class org.testng.TestNGAnt
Can you please help me ?
[javac] C:\Users\stirumalaraju\workspace\Testing_Subhash\src\Test\CopyOfTes
ReplyDeleteNG_testing1.java:3: error: package org.openqa.selenium does not exist
[javac] import org.openqa.selenium.By;
Please help me. While I am compiling I am getting the above error message.
Hi Subhash Tirumalaraju!
DeleteYou put selenium-java-x.x.x.jar and selenium-java-x.x.x-srcs.jar in your classpath?
Hi Arvind, I have follwed these steps, and run successfully till this. It is very easy to understand also friendly. I am getting more clear concepts from this posts. Thankful to you....
ReplyDeleteTo execute with Ant,Update build.xml at line no.72 with ${project.home}/test-output
ReplyDeleteHello Aravind ,
ReplyDeleteThank you so much for the tutorial..
Could you plz post us on how to email XSLT reports using build.xml file..I have gone through many blogs but none of them are clear..So plz post us on that topic which will be very helpful.
Hello Arvind,
ReplyDeleteThanks so much for the tutorials.
I am unable to download build.xml from the page where all Jars are listed out. Could you please help me with that .
Thanks
Hi!
ReplyDeleteI have a problem when I execute my tests. See below the stack trace:
java.lang.RuntimeException: java.lang.NullPointerException
at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:162)
at org.testng.internal.Parameters.handleParameters(Parameters.java:430)
at org.testng.internal.Invoker.handleParameters(Invoker.java:1276)
at org.testng.internal.Invoker.createParameters(Invoker.java:992)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1082)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:773)
at org.testng.TestRunner.run(TestRunner.java:623)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1181)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
at org.testng.TestNG.run(TestNG.java:1018)
at org.testng.TestNG.privateMain(TestNG.java:1325)
at org.testng.TestNG.main(TestNG.java:1294)
Caused by: java.lang.NullPointerException
at MyPackage.SuiteUtility.GetTestDataUtility(SuiteUtility.java:22)
at MyPackage.MyClass.MyProvider(MyClass.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:136)
... 20 more
Can you help me?
Thanks a lot!
something is missing here....most of us are getting "taskdef class org.testng.TestAntTask cannot be found" error.
ReplyDeleteBUILD FAILED
ReplyDeletee:\Selenium_WebDrivers\WDDF_DataDriven_Framework\build.xml:71: No suites, classes, methods or jar file was specified.
suitename="Suite1" Suggest the correct suite name ?
Thanks a lot.
I am getting the same error. It compiles but failed on ant run command.
DeleteThis comment has been removed by the author.
ReplyDeleteHI When I am compiling "ant compile" getting below error
ReplyDeleteAny help appreciated otherwise I can not go to next step...
C:\backup\Training\WDDF\test-output>ant compile
Buildfile: C:\backup\Training\WDDF\test-output\build.xml
setPath:
initialization:
BUILD FAILED
C:\backup\Training\WDDF\test-output\build.xml:34: taskdef class org.testng.TestNGAntTask cannot be found
using the classloader AntClassLoader[C:\backup\Training\WDDF\JarFiles\ATUTestRecorder_2.1.jar;C:\backup\Training\WDDF\JarFiles\JSErrorCollector-0.5.jar;C:\backup\Training\WDDF\JarFiles\SaxonLiaison.jar;C:\backup\Training\WDDF\JarFiles\dom4j-1.6.1.jar;C:\backup\Training\WDDF\JarFiles\guice-3.0.jar;C:\backup\Training\WDDF\JarFiles\mysql-connector-java-3.1.13-bin.jar;C:\backup\Training\WDDF\JarFiles\phantomjsdriver-1.2.1.jar;C:\backup\Training\WDDF\JarFiles\poi-3.13-20150929.jar;C:\backup\Training\WDDF\JarFiles\poi-examples-3.13-20150929.jar;C:\backup\Training\WDDF\JarFiles\poi-excelant-3.13-20150929.jar;C:\backup\Training\WDDF\JarFiles\poi-ooxml-3.13-20150929.jar;C:\backup\Training\WDDF\JarFiles\poi-ooxml-schemas-3.13-20150929.jar;C:\backup\Training\WDDF\JarFiles\poi-scratchpad-3.13-20150929.jar;C:\backup\Training\WDDF\JarFiles\reportng-1.1.4.jar;C:\backup\Training\WDDF\JarFiles\velocity-dep-1.4.jar;C:\backup\Training\WDDF\JarFiles\saxon-8.7.jar;C:\backup\Training\WDDF\JarFiles\testng-xslt-maven-plugin-test-0.0.jar;C:\backup\Training\WDDF\JarFiles\xmlbeans-2.3.0.jar]
Total time: 0 seconds
C:\backup\Training\WDDF\test-output>
BY replacing the below lines for taskdef issue got resolved
ReplyDeleteHi Dhanunjya, I know its been quite long, but what steps did u follow to get it resolved? I am facing same error.
DeleteHi,
ReplyDeletei was also having the same problem.
Please find the testng-results.xsl file from this link in src\main\resources
https://docs.google.com/file/d/0B3OQaZlrVrdJZUtSMWJseGVzVGs/edit?pli=1
and
add it in the code as it is... without making any changes in com\stta\xslt package in a testng-results.xsl file.
Thanks
I followed the steps and double checked the paths for the lines. ant will compile and run but it will not generate a report in my project. I refreshed to be sure.
ReplyDeleteHi Arvind i m not getting test-output folder
ReplyDeletehi arvind i m not getting test-output folder ..pls help me
ReplyDeletehi arvind
ReplyDeleteHi Arvind,
ReplyDeleteWhen I look at index.html not seeing pie chart.
Shows error:
SVG Pie Charts are not available. Please install a SVG viewer for your browser.
make sure you add all libraries to jarFiles folder.
ReplyDeleteAnd testng-results.xsl is added to com.stta.xslt..
make sure all steps are done as defines...step 2, 3 etc..
it works
Hi,
ReplyDeleteGetting same error as in the previous comments, java.lang.ClassNotFoundException: org.testng.TestNGAntTask, can someone help explain how was this error resolved.
BUILD FAILED
C:\Users\Mazen\workspace\WDDF\build.xml:34: taskdef class org.testng.TestNGAntTask cannot be found
using the classloader AntClassLoader[C:\Users\Mazen\workspace\WDDF\JarFiles\SaxonLiaison.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\cglib-nodep-3.2.4.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\client-combin
ed-3.0.0-beta2-nodeps.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\commons-codec-1.10.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\commons-exec-1.3.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\commons-logging-1.2.
jar;C:\Users\Mazen\workspace\WDDF\JarFiles\gson-2.3.1.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\guava-19.0.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\hamcrest-core-1.3.jar;C:\Users\Mazen\workspace\WDDF\JarF
iles\hamcrest-library-1.3.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\httpclient-4.5.2.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\httpcore-4.4.4.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\httpmime-4.5.2.jar;C
:\Users\Mazen\workspace\WDDF\JarFiles\jna-4.1.0.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\jna-platform-4.1.0.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\junit-4.12.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\
log4j-1.2.17.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\netty-3.5.7.Final.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\phantomjsdriver-1.2.1.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\poi-3.14-20160307.jar;C:\
Users\Mazen\workspace\WDDF\JarFiles\poi-examples-3.14-20160307.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\poi-excelant-3.14-20160307.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\poi-ooxml-3.14-20160307.jar;C:\
Users\Mazen\workspace\WDDF\JarFiles\poi-ooxml-schemas-3.14-20160307.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\poi-scratchpad-3.14-20160307.jar;C:\Users\Mazen\workspace\WDDF\JarFiles\saxon-8.7.jar;C:\Users\M
azen\workspace\WDDF\JarFiles\testng-xslt-maven-plugin-test-0.0.jar]
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:607)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:237)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.Main.runBuild(Main.java:854)
at org.apache.tools.ant.Main.startAnt(Main.java:236)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
Caused by: java.lang.ClassNotFoundException: org.testng.TestNGAntTask
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1388)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1337)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1089)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:579)
Hi,
ReplyDeleteWhen I am viewing results at index.html, it's not displaying pie chart.
Showing an error:
SVG Pie Charts are not available. Please install a SVG viewer for your browser.
D:\backup\Training\WDDF>ant
ReplyDeleteBuildfile: build.xml does not exist!
Build failed
The steps were carefully followed, build.xml has warning on the line 33 which says "taskdef class org.testng.TestNGAntTask cannot be found using the classloader AntClassLoader[]"
how to fix this issue, can't proceed any further.
cannot proceed any further as its throwing this error in the build.xml file
ReplyDeletetaskdef class org.testng.TestNGAntTask cannot be found using the classloader AntClassLoader[D:\backup\Training\WDDF\JarFiles\SaxonLiaison.jar;D:\backup\Training\WDDF
\JarFiles\cglib-nodep-3.2.4.jar;D:\backup\Training\WDDF\JarFiles\client-combined-3.0.0-beta2-nodeps.jar;D:\backup\Training\WDDF\JarFiles\commons-codec-1.10.jar;D:\backup\Training
\WDDF\JarFiles\commons-exec-1.3.jar;D:\backup\Training\WDDF\JarFiles\commons-logging-1.2.jar;D:\backup\Training\WDDF\JarFiles\curvesapi-1.04.jar;D:\backup\Training\WDDF\JarFiles
\gson-2.3.1.jar;D:\backup\Training\WDDF\JarFiles\guava-19.0.jar;D:\backup\Training\WDDF\JarFiles\hamcrest-core-1.3.jar;D:\backup\Training\WDDF\JarFiles\hamcrest-library-1.3.jar;D:
\backup\Training\WDDF\JarFiles\httpclient-4.5.2.jar;D:\backup\Training\WDDF\JarFiles\httpcore-4.4.4.jar;D:\backup\Training\WDDF\JarFiles\httpmime-4.5.2.jar;D:\backup\Training\WDDF
\JarFiles\jna-4.1.0.jar;D:\backup\Training\WDDF\JarFiles\jna-platform-4.1.0.jar;D:\backup\Training\WDDF\JarFiles\junit-4.12.jar;D:\backup\Training\WDDF\JarFiles\log4j-1.2.17.jar;D:\backup
\Training\WDDF\JarFiles\netty-3.5.7.Final.jar;D:\backup\Training\WDDF\JarFiles\phantomjsdriver-1.2.1.jar;D:\backup\Training\WDDF\JarFiles\poi-3.15-beta2.jar;D:\backup\Training\WDDF
\JarFiles\poi-examples-3.15-beta2.jar;D:\backup\Training\WDDF\JarFiles\poi-excelant-3.15-beta2.jar;D:\backup\Training\WDDF\JarFiles\poi-ooxml-3.15-beta2.jar;D:\backup\Training\WDDF
\JarFiles\poi-ooxml-schemas-3.15-beta2.jar;D:\backup\Training\WDDF\JarFiles\poi-scratchpad-3.15-beta2.jar;D:\backup\Training\WDDF\JarFiles\saxon-8.7.jar;D:\backup\Training\WDDF
\JarFiles\testng-xslt-maven-plugin-test-0.0.jar;D:\backup\Training\WDDF\JarFiles\xmlbeans-2.6.0.jar]
I was getting the same error as "taskdef class org.testng.TestNGAntTask cannot be found using the classloader AntClassLoader[" and it got solved when i placed testng-6.8.5.jar in the Project/JarFiles Folder.
ReplyDeleteI was also getting same error as "askdef class org.testng.TestNGAntTask cannot be found using the classloader AntClassLoader..."
ReplyDeleteIt got solved when i placed "testng-6.8.5.jar" inside my project/JarFiles folder. I hope it works for you all.
I got this error one week already but still can not fix it even though I tried you guys solutions already. Is there someone help me!!!
ReplyDelete"taskdef class org.testng.TESTNGAntTask cannot be found
using the classloader AntClassLoader[/Users/phandungmykieu/Documents/Master Program/Testing/workspace/DataDriven/testng-6.0.1.jar:/Users/phandungmykieu/Documents/Master Program/Testing/workspace/DataDriven/testng-6.8.5.jar] "
Hi in build.xml remove the quotes for 'suite.classpath' like the below
Deletei was getting the Testng issue on compiling too; solved it by adding testng-6.8.5.jar to the Jarfiles folder
ReplyDeletehttp://www.java2s.com/Code/Jar/t/Downloadtestng685jar.htm
i hope it works for you
when i open index.html file i am getting this message SVG Pie Charts are not available. Please install a SVG viewer for your browser how can i slove it
ReplyDeletewhen i opend index.html file it display like ..SVG Pie Charts are not available. Please install a SVG viewer for your browser
ReplyDeleteHi, Im not getting any Build folder after running ant compile successfully. May I know what to do?
ReplyDeleteHi, this method works for me.
ReplyDeletethe problem for me was: build.xml:34: taskdef class org.testng.TestNGAntTask can not be found using the classloader AntClassLoader[C:\Bckup......]
Total time: 0 seconds
I did what pratibha chikhale told. I got " BUILD SUCCESSFUL. even there are a warning.
thank you Pratibha Chikhale!
Thank you Aravind
another problem for me was after "run reports", there are no XSL_Repoets folder, and build folder. but I check in Windows Explore, there are there and index.html with a pie image which just looks like the one above.