How to invoke TestNG Custom Test Listener with in Jbehave

7 views
Skip to first unread message

email...@gmail.com

unread,
Dec 3, 2016, 7:27:47 AM12/3/16
to webdriver
I have crated custom TestNG TestListener and need to set Attribute with in @When block in jbehave. I need to access attribute value with in my custom test listener class

@Listeners(TestReportListener.class)
public class MyJBehaveScenario {

@Given("the balance is <balance>")
public void createAccount(@Named("balance") int balance) {
    account
= new Account(balance);
}

@When("the requests <request>")
public void requestMoney(@Named("request") int amount) {
 
Reporter.getCurrentTestResult().setAttribute("ABC", "XYZ");
}

@Then("the card should be returned")
public void cardShouldBeReturned() {
 
System.out.println("Completed")
}
}


Shawn McCarthy

unread,
Dec 4, 2016, 9:04:53 PM12/4/16
to webdriver
This seems like a testng question, and not a webdriver question. You might have better luck in the testng-users google group instead.
Reply all
Reply to author
Forward
0 new messages