use of gherkin.pickles.PickleTag in project page-factory-2 by sbtqa.
the class DataAspect method run.
@Around("sendCaseStart(event)")
public Object run(ProceedingJoinPoint joinPoint, TestCaseStarted event) throws Throwable {
List<PickleTag> tags = event.testCase.getTags().stream().filter(pickleTag -> pickleTag.getName().startsWith(DataUtils.DATA_TAG)).collect(Collectors.toList());
if (!tags.isEmpty()) {
String dataTagName = tags.get(tags.size() - 1).getName();
String data = DataUtils.getDataTagValue(dataTagName);
for (TestStep testStep : event.testCase.getTestSteps()) {
if (!(testStep instanceof HookTestStep)) {
PickleStepTestStep pickleStepTestStep = (PickleStepTestStep) testStep;
PickleStepTag stepCustom = getPickleStepTag(pickleStepTestStep);
stepCustom.setDataTag(data);
replaceByPickleStepTag(pickleStepTestStep, stepCustom);
}
}
}
return joinPoint.proceed();
}
Aggregations