Hi there,
I have a scenario which applies to different sizes of browser. According to the trigger tag, I want to instantiate a different implementation which implements the same interface.
For example, there are three implementations (LoginSmallImpl, LoginMediumImpl and LoginBigImpl), I would like to instantiate Login login = new LoginSmallImpl(); if the trigger tag is @small.
I have tried the @Before hook, but it applies to all tags on the scenario. I'm wondering if it's possible to detect the trigger tags?
Cheers.
@small @medium @large
Scenario: Login
Given I am on the login page
When I login with a valid username and password
Then login should be successful
public class LoginSteps
{
@Before("@small")
public void small(Scenario sc)
{
}
@Before("@large")
public void big(Scenario sc)
{
}
@Given("^I am on the login page$")
public void i_am_on_the_login_page() throws Throwable {
}
@When("^I login with a valid username and password$")
public void i_login_with_a_valid_username_and_password() throws Throwable {
}
@Then("^login should be successful$")
public void login_should_be_successful() throws Throwable {
}
}