在黄瓜的其他功能中使用相同的变量值
Use the same variable value in other feature in cucumber
以下是我的功能和步骤定义
@Regression
Scenario: Validate workflow with research ticket having risk rating 3 and Complexity as No known difficulty (assign to other)
When "Analyst" logs in to application
Then "MISToolKit" page should appear
Then User navigates to "ResearchTicketDashboard" page
When A research ticket with risk rating 3 is created or selected
#Then It should be displayed in Awaiting research tab
Then I Assign that ticket to other analyst
@Smoke
Scenario: Validate if ticket having risk rating 3 and No known difficulty complexity is properly processed on other analyst login
When "otheranalyst" logs in to application
Then "MISToolKit" page should appear
Then User navigates to "ResearchTicketDashboard" page
Then Ticket assigned should be displayed in In research tab of that analyst
When Set complexity as No known difficulty and clicked on commit
Then It should be displayed in Awaiting Review tab
credentials
String researchticketId;
@When("A research ticket with risk rating {int} is created or selected")
public void a_research_ticket_with_risk_rating_is_created_or_selected(Integer int1) {
rs.selectriskratingandresearchattribute();
researchticketId=rs.getrefidlist().get(0).getAttribute("innerHTML");
System.out.println(researchticketId);
WaitActions.wait(3000);
}
@Then("Ticket assigned should be displayed in In research tab of that analyst")
public void ticket_assigned__should_be_displayed_in_in_research_tab_of_that_analyst() {
rs.clickonInResearchtab();
rs.waitforfivesec();
rs.findresearchticketId(researchticketId);
rs.waitforfivesec();
Assert.assertEquals(researchticketId, rs.getrefidlist().get(0).getText());
如您所见,@Regression 功能中的步骤有一个值存储在字符串 researchticketID(step @When("A research ticket with risk rating {int} is created or selected")) 并且我想使用在步骤定义如上的@Smoke 功能中(@Then(“分配的票证应显示在该分析师的研究选项卡中”))。但是在@Smoke 功能步骤定义中,在线 rs.findresearchticketId(researchticketId);由于我的测试失败,researchticketId 值被传递为 null。给出的错误是
java.lang.IllegalArgumentException: Keys to send should be a not null CharSequence
at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:97)
请帮帮我
将变量 researchticketId
声明为 static
。
以下是我的功能和步骤定义
@Regression
Scenario: Validate workflow with research ticket having risk rating 3 and Complexity as No known difficulty (assign to other)
When "Analyst" logs in to application
Then "MISToolKit" page should appear
Then User navigates to "ResearchTicketDashboard" page
When A research ticket with risk rating 3 is created or selected
#Then It should be displayed in Awaiting research tab
Then I Assign that ticket to other analyst
@Smoke
Scenario: Validate if ticket having risk rating 3 and No known difficulty complexity is properly processed on other analyst login
When "otheranalyst" logs in to application
Then "MISToolKit" page should appear
Then User navigates to "ResearchTicketDashboard" page
Then Ticket assigned should be displayed in In research tab of that analyst
When Set complexity as No known difficulty and clicked on commit
Then It should be displayed in Awaiting Review tab
credentials
String researchticketId;
@When("A research ticket with risk rating {int} is created or selected")
public void a_research_ticket_with_risk_rating_is_created_or_selected(Integer int1) {
rs.selectriskratingandresearchattribute();
researchticketId=rs.getrefidlist().get(0).getAttribute("innerHTML");
System.out.println(researchticketId);
WaitActions.wait(3000);
}
@Then("Ticket assigned should be displayed in In research tab of that analyst")
public void ticket_assigned__should_be_displayed_in_in_research_tab_of_that_analyst() {
rs.clickonInResearchtab();
rs.waitforfivesec();
rs.findresearchticketId(researchticketId);
rs.waitforfivesec();
Assert.assertEquals(researchticketId, rs.getrefidlist().get(0).getText());
如您所见,@Regression 功能中的步骤有一个值存储在字符串 researchticketID(step @When("A research ticket with risk rating {int} is created or selected")) 并且我想使用在步骤定义如上的@Smoke 功能中(@Then(“分配的票证应显示在该分析师的研究选项卡中”))。但是在@Smoke 功能步骤定义中,在线 rs.findresearchticketId(researchticketId);由于我的测试失败,researchticketId 值被传递为 null。给出的错误是
java.lang.IllegalArgumentException: Keys to send should be a not null CharSequence
at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:97)
请帮帮我
将变量 researchticketId
声明为 static
。