TestNG with Cucumber -


i running cucumber testng. cucumberrunner class extends abstracttestngcucumbertests , cucumberrunner class specified in testng.xml file.

if run simple testng class testng.xml output testng results gets displayed in console i.e total tests run, failures, skips shown below:-

test.java

package com.cucumber.test; import org.testng.assert; public class test { @org.testng.annotations.test public void test() {     assert.assertequals(true, true); } } 

testng.xml:-

<!doctype suite system "http://testng.org/testng-1.0.dtd" > <suite name="testng" verbose="1"> <test name="testcuke"> <classes> <class name="com.cucumber.test.test"> </class> </classes> </test> </suite> 

enter image description here

but when run testng.xml cucumberrunner output testng results not getting displayed in console.

testng.xml

<!doctype suite system "http://testng.org/testng-1.0.dtd" > <suite name="testng" verbose="1"> <test name="testcuke"> <classes> <class name="com.cucumber.test.cucumberrunner"> </class> </classes> </test> </suite> 

cucumberrunner.java

package com.cucumber.test; import cucumber.api.cucumberoptions; simport cucumber.api.testng.abstracttestngcucumbertests;  @cucumberoptions(tags= "@smoketest",features="src\\newtestfile.feature") public class cucumberrunner extends abstracttestngcucumbertests{ } 

enter image description here

how display testng results output in console cucumber?

you need define parameter in test.java , testng.xml that:

package com.cucumber.test; import org.testng.assert; public class test { @org.testng.annotations.test("mytest") public void test() {     assert.assertequals(true, true); } }  <!doctype suite system "http://testng.org/testng-1.0.dtd" > <suite name="testng" verbose="1"> <test name="testcuke"> <parameter name="myname"  value="true"/> <classes> <class name="com.cucumber.test.test"> </class> </classes> </test> </suite> 

Comments