use of io.cucumber.plugin.event.HookTestStep in project cucumber-jvm by cucumber.
the class TeamCityPlugin method extractName.
private String extractName(TestStep step) {
if (step instanceof PickleStepTestStep) {
PickleStepTestStep pickleStepTestStep = (PickleStepTestStep) step;
return pickleStepTestStep.getStep().getText();
}
if (step instanceof HookTestStep) {
HookTestStep hook = (HookTestStep) step;
HookType hookType = hook.getHookType();
switch(hookType) {
case BEFORE:
return "Before";
case AFTER:
return "After";
case BEFORE_STEP:
return "BeforeStep";
case AFTER_STEP:
return "AfterStep";
default:
return hookType.name().toLowerCase(Locale.US);
}
}
return "Unknown step";
}
use of io.cucumber.plugin.event.HookTestStep in project cucumber-jvm by cucumber.
the class JsonFormatter method handleTestStepStarted.
@SuppressWarnings("unchecked")
private void handleTestStepStarted(TestStepStarted event) {
if (event.getTestStep() instanceof PickleStepTestStep) {
PickleStepTestStep testStep = (PickleStepTestStep) event.getTestStep();
if (isFirstStepAfterBackground(testStep)) {
currentElementMap = currentTestCaseMap;
currentStepsList = (List<Map<String, Object>>) currentElementMap.get("steps");
}
currentStepOrHookMap = createTestStep(testStep);
// add beforeSteps list to current step
if (currentBeforeStepHookList.containsKey(before)) {
currentStepOrHookMap.put(before, currentBeforeStepHookList.get(before));
currentBeforeStepHookList.clear();
}
currentStepsList.add(currentStepOrHookMap);
} else if (event.getTestStep() instanceof HookTestStep) {
HookTestStep hookTestStep = (HookTestStep) event.getTestStep();
currentStepOrHookMap = createHookStep(hookTestStep);
addHookStepToTestCaseMap(currentStepOrHookMap, hookTestStep.getHookType());
} else {
throw new IllegalStateException();
}
}
Aggregations