Reputation: 85
Following are my features and step definitions
@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());
As you can see the step in @Regression feature has a value stored in string researchticketID(step @When("A research ticket with risk rating {int} is created or selected")) and that I want to use in @Smoke feature whose step definition is as above (@Then("Ticket assigned should be displayed in In research tab of that analyst")). But in the @Smoke feature step definition, on line rs.findresearchticketId(researchticketId); the researchticketId value is passed as null as a result my tests are failing. The error been given is
java.lang.IllegalArgumentException: Keys to send should be a not null CharSequence
at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:97)
Please help me.
Upvotes: 0
Views: 1094
Reputation: 302
Declare variable researchticketId
as static
.
Refer https://www.javatpoint.com/static-keyword-in-java
Upvotes: 1