我正在使用黄瓜来编写测试,但是我有一个探查,在@When步骤中,我有一个Log来指示我所在的步骤和其他变量,但是当我执行测试时,它消失了。
在这里定义步骤和功能:
package com.ergo.risks.bdd.runner;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import com.enax.test.core.Environment;
import cucumber.api.CucumberOptions;
import cucumber.api.SnippetType;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(
glue = {
"com.enax.test.core.hooks",
"com.enax.test.global.bdd",
"com.ergo.risks.bdd.steps"
},
plugin = {
"com.enax.test.reporter.BBVAGherkinTestReporter",
"json:target/cucumber/cucumber.json"
},
//features = { "classpath:features" },
features = { "classpath:features/requestExternalFilters.feature" },
snippets = SnippetType.CAMELCASE,
tags = { "~@to-implement" }
)
public class RunIntegradoTest {
@BeforeClass
public static void prepareEnvironment() {
System.setProperty("ENV", Environment.EI.toString());
}
}
我用胶水编写的代码结构很好,我已经对其进行了修改。这是我的@When方法:
@When("^solicito la recuperación de la informacion de los filtros para el cliente conectado$")
public void lisCountries() {
LOG.debug("\n\nSe esta ejecutando el escenario: " + scenarioHolder.getCucucmberScenario().getName());
LOG.debug("LA URL ES: " + Endpoints.EXTERNAL_FILTERS);
ObjectNode jsonDataIn = (ObjectNode) scenarioHolder.getProperty(ScenarioHolder.CURRENT_JSON_DATA_IN);
ObjectMapper mapper = new ObjectMapper();
LOG.debug("Antes de convertir: jsonDataIn - "+ jsonDataIn);
request = mapper.convertValue(jsonDataIn, Map.class);
MapHttpResponse response = enaxClient.executePost(Endpoints.EXTERNAL_FILTERS, request);
scenarioHolder.setMapHttpResponse(response);
}
安德(Ande),这就是我在控制台中看到的内容:
1 Scenarios ([33m1 undefined[0m)
8 Steps ([36m1 skipped[0m, [33m1 undefined[0m, [32m6 passed[0m)
0m1,210s
You can implement missing steps with the snippets below:
@When("^solicito la recuperación de la informacion de los filtros para el cliente conectado$")
public void solicitoLaRecuperaciónDeLaInformacionDeLosFiltrosParaElClienteConectado() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
有什么想法吗?