Missing steps - Junit - Cucumber

284 Views Asked by At

I'm using cucumber and Junit in my automation code, I create a Runner class with the follow code:

@RunWith(Cucumber.class) 
@CucumberOptions(features = "src/main/java/CompraVtex/CompraVtex/VtexCompra.feature", glue = { "Steps" }, plugin = {
    "pretty", "html:target/cucumber-reports" }, monochrome = true, dryRun = false)

public class Runner {
}

On my Cucumber feature:

@tag1
Scenario: Acessando Portal Receba em Casa
Given acessei a url do portal
And cliquei no botao de Login com google
And Mudei o foco para a tela do Pop Up

On my Steps class:

public class Steps extends Execute {


    @Test(priority=1)
    @Given("acessei a url do portal")
    public void AcessoUrl() {
           Execute Executar = new Execute();
           Executar.abrirBrowser();
    }

    @Test(priority=2)
    @And("cliquei no botao de Login com google")
    public void Login() throws Exception {
        Execute Executar = new Execute();
        getscreenshot("01 Login","01 - Acessando URL"); 
        Executar.Login();
    }

But when I try to run with Junit, It's show the follow message:

You can implement missing steps with the snippets below: @Given("^acessei a url do portal$")

Can you help me to fix it? Thanks

1

There are 1 best solutions below

0
On

Please try add tag name in file Cucumber Feature :

@RunWith(Cucumber.class) 
@CucumberOptions(features = "src/main/java/CompraVtex/CompraVtex/VtexCompra.feature", glue = { "Steps" },tags = {"@tag1"}, plugin = {
    "pretty", "html:target/cucumber-reports" }, monochrome = true, dryRun = false)

public class Runner {
}