Here is the software, library i am using:
1) Eclipse Neon
2) TestNG - 6.10
3) Maven Project
TestNG intelli-sense not working for me in Testng.xml file. Earlier it was working.
Earlier it was showing suggestions for following tags i.e. methods, method, listener etc.
Can someone faced the same issue.
Here is my testng.xml.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" >
<listeners>
<listener class-name="x listener" />
</listeners>
<test name="Smoke">
<parameter name="platform" value="test" />
<classes>
<class name="smoke" />
</classes>
</test>
</suite>
Related
I have this TestNG part :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
<listeners>
<listener class-name="ShufersalMiron.Sprod.Listeners"/>
</listeners>
<test name="Test1">
<classes>
<class name="ShufersalMiron.Sprod.PA_Coupons"/>
</classes>
</test> <!-- Test -->
<test name="Test2">
<classes>
<class name="ShufersalMiron.Sprod.PA_SupermeCoins"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
When I am trying to run it as a suite I get this error :
Can someone please tell me what could be wrong and how to solve it please ?
Thanks.
The error might be due to conflicting dependencies.
extentreports-java version 5.0.9 (latest for now)
https://github.com/extent-framework/extentreports-java/blob/master/pom.xml
uses io.reactivex.rxjava3:rxjava-3.0.4 and org.testng:testng-7.3.0.
I can suggest 2 options:
Try to add io.reactivex.rxjava3 dependency, since
NoClassDefFound error references this.
Maven:
<dependency>
<groupId>io.reactivex.rxjava3</groupId>
<artifactId>rxjava</artifactId>
<version>3.0.4</version>
</dependency>
Gradle:
implementation 'io.reactivex.rxjava3:rxjava:3.0.4'
Try to use testNG 7.3.0 instead of 7.4.0.
I have a testng xml file that is setup to run a specific class that has methods containing the following group tags or are grouped as one of the following:
parallel-test
sequential-test
smoke-test
Although some of my tests are designated as either parallel or sequential, some of the test may contain an additional tag 'smoke-test.' In this scenario, I want to be able to just run those that are grouped as 'smoke-test.' When I run the tests, it either cannot find any tests or it just runs all tests grouped as 'sequential-test.' I cannot seem to restrict the test run from this xml file to just those tests grouped as 'smoke-test.' In the same class, I have multiple testNG methods that have either the 'parallel-test' group or the 'sequential-test' group. What it looks like the TestNG xml file is doing is just ignoring the 'parallel-test' group. Thats great, but what if there is Testng method that contains the group 'parallel-test' and 'smoke-test?' I want to run every test regardless of whether it is for parallel testing or sequential, but ONLY those that have the additional group tag 'smoke-test.' My environment is the following:
IntelliJ
Maven
TestNG
Java
Please help. See sample test method in the WebTest.Test class:
#Test(groups = {"sequential-test","smoke-test"},description = "Test will validate something")
public void RunTest()
{
//do something
}
Here is the sample xml file below
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<!--This is a template to be modified for QA environment tests-->
<suite name="Smoke Test">
<listeners>
<listener class-name="Listeners.Listeners"/>
<listener class-name="Listeners.ExtentListeners"/>
</listeners>
<parameter name="environment" value="QA"></parameter>
<test verbose="2" name="Sequential tests" parallel="methods" thread-count="1">
<!--<groups>
<run>
<exclude name="parallel-test"/>
</run>
</groups>-->
<classes>
<class name="WebTests.Test">
<methods>
<include name="smoke-test"/>
</methods>
</class>
</classes>
</test>
</suite>
Below XML Suite should run the all test method having group 'smoke-test'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<!--This is a template to be modified for QA environment tests-->
<suite name="Smoke Test">
<listeners>
<listener class-name="Listeners.Listeners"/>
<listener class-name="Listeners.ExtentListeners"/>
</listeners>
<parameter name="environment" value="QA"></parameter>
<test verbose="2" name="Sequential tests" parallel="methods" thread-count="1">
<groups>
<run>
<include name="smoke-test"/>
</run>
</groups>
<classes>
<class name="WebTests.Test"/>
</classes>
</test>
</suite>
I am executing TestNG test with Jenkins build and Allure plugin. My problem is that if I am executing them from IDEA all test results are displayed.
If I am using same configuration from Jenkins some tests are missing.
XML Suite file
<suite name="All in one" verbose="1" thread-count="2" parallel="methods" >
<test name="Chrome:MainPage">
<parameter name="browser" value="chrome"/>
<classes>
<class name="mainPage.MainPageTest" />
<class name="patients.PatientsPageTest"/>
</classes>
</test>
<test name="Firefox:MainPage">
<parameter name="browser" value="firefox"/>
<classes>
<class name="mainPage.MainPageTest" />
<class name="patients.PatientsPageTest"/>
</classes>
</test>
Result from Allure when directly "called" on results is good.
Allure plugin from Jenkins ignores some tests , and i have no idea why.
I found solution after 2 days , i am not sure which of them worked , but maybe someone will run into same issue someday...
Check Jenkins version of Allure plugin
Check Gradle version of Allure plugin
Check TestNG for validity i missed this
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
I want to execute many test ng suites, which are included in one testng.xml file
testng.xml:
<?xml version="1.0" encoding="UTF-8"?>
<suite name="main_file">
<suite-files>
<suite-file path="testng1.xml"></suite-file>
<suite-file path="testng2.xml"></suite-file>
</suite-files>
</suite>
testng1.xml is done that way
<?xml version="1.0" encoding="UTF-8"?>
<suite name="testng1" parallel="methods" thread-count="8" >
<test name="testng1">
<classes>
<class name="myclasses1" />
<class name="myclasses2" />
<class name="myclasses3" />
<class name="myclasses4" />
</classes>
</test>
</suite>
So now the main tests suites are executed sequentially and the included test cases are running parallel.
So what I want is, that test cases of testng1.xml can be executed at the same time when testng2.xml are executed. Is there any way to set some tags or something?
Actually I'm testing multiple website for my company. All the website have the same structure and i'm testing various things on each.
For my test i have a Selenium Java Maven project using TestNG. For each web site, i've created a sub folder and generate a specific testing.xml file to specify each test i'm doing for the website.
Here the structure : http://imgur.com/g0VHfMw
My testing.xml files are like this :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Test suite website 1" parallel="tests" thread-count="2">
<test name="Test1">
<classes>
<class name="package.for.mytest1"></class>
</classes>
</test>
<test name="Test2">
<classes>
<class name="package.for.mytest2"></class>
</classes>
</test>
<test name="Test3">
<classes>
<class name="package.for.mytest3"></class>
</classes>
</test>
</suite>
How can I merge this 4 test suite in one testNG report ? And if it's possible, is there a way to only show the unstable or failed test on it ?
Any ideas ? Thanks for your help
Try Allure it could easily generate combined report for several suites and show only failed/broken tests by default.
Either you can Use Suite-XML tag in TestNG.xml file to report all your test in single report or implement a reporter of your own to collect all the results and then at the end flush everything into report of your own format with whatever information you need.
You can create a separate testng.xml file in which you can give the path of other testsuites files.
eg:-
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name= "Allsuites" verbose="1" preserve-order="true" >
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter"/>
<listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
</listeners>
<suite-files preserve-order="true">
<suite-file path="testng1.xml" />
<suite-file path="testng2.xml" />
<suite-file path="testng3.xml" />
</suite-files>
</suite>