java - How to run TestNG with JBehave -


my story file:

**given** calculator **when** add 2 , 9 **then** outcome should 11 

my java class:

import org.jbehave.core.annotations.given; import org.jbehave.core.annotations.when; import org.jbehave.core.annotations.then; import org.testng.assert; import org.testng.annotations.test;  @test public class debugpluginsteps { private calculator mycal; @given("a calculator") public void setcal() {     mycal=new calculator();     system.out.println("created"); }   @when("i add $number1 , $number2") public void addcal(int x,int y) {     mycal.addtwonumber(x, y); }  @then("the outcome should $result") public void testresult(int output) {      assert.assertequals(output, mycal.getresult());     //system.out.println("result : " + output); } 

another java class in have written method sum 2 integer values:

public class calculator { private int sum;  public calculator() {     this.sum = 0; }  public void addtwonumber(int x, int y) {     sum = x + y; }  public int getresult() {     return this.sum; } 

i have included testng, jbehave , gherkins(jar) file in build path. not getting option run testng. also, have created testng.xml file. first question how interlink story file , feature file testng , second thing how run using testng


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -