Thanks for looking into this.
I am using JUnit JUnit results plugin, to publish the unit test results from maven(JUnit) and XML reports generated by XML runner.
But, this plugin is failing to parse the test reports(XML file) generated by XML runner.
My concerns are:
what is the best plugin to publish test results from the XML file generated by any kind of utility(JUnit/XML parser etc)
Thanks.
The Jenkins JUnit plugin (https://wiki.jenkins.io/display/JENKINS/JUnit+Plugin) should (normally) work fine:
What is the error that you are getting?
How does/do the JUnit XML file/s look like?
Regards,
Reinhold
P.S.: There is also Jenkins xUnit plugin (https://wiki.jenkins.io/display/JENKINS/xUnit+Plugin), but I am not sure if that parses differently...
Related
Should we need TestNG or Junit framework to integrate Selenium with Jenkins. I have project which is build without TestNG or JUnit can i integrate it with Jenkins.
You can use both JUnit and TestNG frameworks as Jenkins supports both.
Steps in details for TestNG integration with Jenkins.
Step 1: Create Free Style project in Jenkins and fill the details and Save the project.
Step 2: click on Configure
Step 3: In the Build section of Configure:
java -cp J:\taf\testng\*;J:\taf\workspace\TestNGExamples\bin;J:\automation\* org.testng.TestNG J:\taf\workspace\TestNGExamples\testng1.xml
Note: you have to change the paths as per your system.
In -cp argument, we must provide testng.jar, project location and ``selenium jarslocations/paths.
org.testng.TestNG- TestNG Main Class.
andlocation to the XML of testng configuration`
Download and install the testng-plugin for jenkins from here and restart Jenkins in order to take effect.
Step 4: In the Post-build Actions section,
Select Publish TestNG Results from Add post-build action dropdown.
provide the path where to look for TestNG results (.xml file containing results).
Click Apply and Save buttons.
Screenshot for reference:
TestNG and JUnit on simple terms can be visualised as "java code execution" mechanisms with support to do validations.
So instead of you having only one main() method that would be the single point of entry for execution of your selenium code, TestNG/JUnit takes up that role and lets you run multiple java classes via themselves.
Jenkins is an orchestrator tool that lets you build, test, deploy as per your wish.
The test phase can be skipped by not using TestNG and JUnit, and you resorting to executing your selenium based tests via a main() method which takes care of doing all validations as well (assertions in the JUnit/TestNG world)
We are executing our Selenium WebDriver GUI tests as a Nunit 3.0 build step in TeamCity 10 and after going through the documentation, we were expecting to see the test execution log in a separate "Tests" tab in the build log. However, there is no "Tests" tab at all in our log and the nunit.xml file with the results is saved only as an artifact in the tmp folder.
Have you come into the same issue? Could you please assist us?
Thank you in advance.
The tests results should be somehow reported into TeamCity. Test can reported by build runner (see the list of the supported frameworks), using XML Report processing build feature or via service messages. In your case you can use XML report processing feature to parse nunit.xml and report test in TeamCity.
Is the TestNG Executable JAR files alone is enough to work with TestNG framework or the TestNG plugin is essential? I have the JAR files, can i add to my library and work with TestNG?
Plugin just simplifies running things. You do not need it so to say. But, if you say want to run a single test or a suite file - a plugin would give you a simple way to right click and trigger it off. But with no plugin you will have to run with the java run command or through maven command if that's what you are running.
So the answer is yes - you can run but the plugin will always help while you are developing your tests.
I am getting following error in my script
does that mean i am missing any jar file which i need to include in liabrary or something else.
Looks like you need to include the jmeter library in your project.
Include all jars from the following JMeter folders:
/lib
/lib/ext
into your project classpath as well as Selenium libraries.
By the way, are you aware of existing WebDriver Sampler which integrates JMeter and Selenium so you won't have to recompile your JUnit code in case of any changes on Selenium side of things.
I just connected Allure report to my TestNG tests and Maven build. All works fine and reports are supercool. Just one thing - #Step annotation doesn't work. Steps are not appearing in report. I followed the examples.
In order to make #Step, #Parameter and #Attachment annotations work you need to correctly enable AspectJ load-time weaving. Basically this is as simple as passing path to aspectjweaver.jar as -javaagent JVM argument.
Here’s how it can be done in Maven Surefire Plugin: https://github.com/allure-examples/allure-junit-example/blob/master/pom.xml#L63
You must have a aspectjweaver dependency in your pom too (like in the given example), so that this library will be downloaded automatically by Maven. Otherwise the annotations still won't work. Or maybe the tests will not even start, I'm not sure...
To run from the IDE you can specify the same option to the JVM (not the testclass) in the IDE runner window. Replacing the ${settings.localRepository} property with the real path of course. Since that's a maven property and the IDE doesn't know anything about it.
SOLVED!
I ran the tests via InteliJIDEA testng runner, but should have run via maven only.
You need to run mvn clean test
and then mvn site