本文整理汇总了Java中gherkin.formatter.model.Step类的典型用法代码示例。如果您正苦于以下问题:Java Step类的具体用法?Java Step怎么用?Java Step使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Step类属于gherkin.formatter.model包,在下文中一共展示了Step类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fireCanceledStep
import gherkin.formatter.model.Step; //导入依赖的package包/类
protected void fireCanceledStep(final Step unimplementedStep) {
final StepResult stepResult = new StepResult();
stepResult.withName(unimplementedStep.getName())
.withStart(System.currentTimeMillis())
.withStop(System.currentTimeMillis())
.withStatus(Status.SKIPPED)
.withStatusDetails(new StatusDetails().withMessage("Unimplemented step"));
lifecycle.startStep(scenario.getId(), getStepUuid(unimplementedStep), stepResult);
lifecycle.stopStep(getStepUuid(unimplementedStep));
final StatusDetails statusDetails = new StatusDetails();
final TagParser tagParser = new TagParser(feature, scenario);
statusDetails
.withFlaky(tagParser.isFlaky())
.withMuted(tagParser.isMuted())
.withKnown(tagParser.isKnown());
lifecycle.updateTestCase(scenario.getId(), scenarioResult ->
scenarioResult.withStatus(Status.SKIPPED)
.withStatusDetails(statusDetails
.withMessage("Unimplemented steps were found")));
}
示例2: afterStep
import gherkin.formatter.model.Step; //导入依赖的package包/类
private static StepResult afterStep(Reporter reporter, Step step, Match match, Result result, String feature, KarateBackend backend) {
boolean isKarateReporter = reporter instanceof KarateReporter;
CallContext callContext = backend.getCallContext();
if (isKarateReporter) { // report all the things !
KarateReporter karateReporter = (KarateReporter) reporter;
karateReporter.karateStep(step, match, result, callContext);
} else if (!backend.isCalled() && reporter != null) { // can be null for server
reporter.match(match);
reporter.result(result);
}
StepResult stepResult = new StepResult(step, result);
backend.afterStep(feature, stepResult);
return stepResult;
}
示例3: getStepText
import gherkin.formatter.model.Step; //导入依赖的package包/类
private static String getStepText(Step step, ScenarioWrapper scenario) {
StringBuilder sb = new StringBuilder();
sb.append(step.getKeyword());
sb.append(step.getName());
DocString docString = step.getDocString();
if (docString != null) {
sb.append("\n\"\"\"\n");
sb.append(docString.getValue());
sb.append("\n\"\"\"");
}
if (step.getRows() != null) {
String text = scenario.getFeature().joinLines(step.getLine(), step.getLineRange().getLast() + 1);
sb.append('\n').append(text);
}
return sb.toString();
}
示例4: karateStepProceed
import gherkin.formatter.model.Step; //导入依赖的package包/类
@Override
public void karateStepProceed(Step step, Match match, Result result, CallContext callContext) {
String log = logAppender.collect();
// step should be first
int prevDepth = prevStep == null ? 0 : prevStep.getCallContext().callDepth;
int currDepth = callContext.callDepth;
prevStep = new ReportStep(step, match, result, log, callContext);
if (currDepth > prevDepth) { // called
List<ReportStep> temp = new ArrayList();
temp.add(prevStep);
callStack.push(temp);
} else {
if (currDepth < prevDepth) { // callBegin return
for (ReportStep s : callStack.pop()) {
prevStep.addCalled(s);
}
}
if (callStack.isEmpty()) {
steps.add(prevStep);
} else {
callStack.peek().add(prevStep);
}
}
// just pass on to downstream
formatter.step(step);
reporter.match(match);
reporter.result(result);
}
示例5: fireCanceledStep
import gherkin.formatter.model.Step; //导入依赖的package包/类
private void fireCanceledStep(Step unimplementedStep) {
String name = unimplementedStep.getName();
lifecycle.fire(new StepStartedEvent(name).withTitle(name));
lifecycle.fire(new StepCanceledEvent());
lifecycle.fire(new StepFinishedEvent());
if (PASSED.equals(currentStatus)) {
//not to change FAILED status to CANCELED in the report
lifecycle.fire(new TestCaseCanceledEvent(){
@Override
protected String getMessage() {
return "Unimplemented steps were found";
}
});
currentStatus = SKIPPED;
}
}
示例6: extractStep
import gherkin.formatter.model.Step; //导入依赖的package包/类
protected Step extractStep(final StepDefinitionMatch match) {
try {
final Field step = match.getClass().getDeclaredField("step");
step.setAccessible(true);
return (Step) step.get(match);
} catch (ReflectiveOperationException e) {
//shouldn't ever happen
LOG.error(e.getMessage(), e);
throw new CucumberException(e);
}
}
示例7: karateStepProceed
import gherkin.formatter.model.Step; //导入依赖的package包/类
@Override
public void karateStepProceed(Step step, Match match, Result result, CallContext callContext) {
junit.step(step);
json.step(step);
// step has to happen first !
match(match);
result(result);
}
示例8: StepWrapper
import gherkin.formatter.model.Step; //导入依赖的package包/类
public StepWrapper(ScenarioWrapper scenario, int index, String priorText, Step step, boolean background) {
this.scenario = scenario;
this.index = index;
this.priorText = StringUtils.trimToNull(priorText);
this.background = background;
this.step = step;
this.text = getStepText(step, scenario);
}
示例9: stepHtml
import gherkin.formatter.model.Step; //导入依赖的package包/类
private void stepHtml(ReportStep reportStep, Node parent) {
Step step = reportStep.getStep();
Result result = reportStep.getResult();
String extraClass = "";
if ("failed".equals(result.getStatus())) {
extraClass = " failed";
} else if ("skipped".equals(result.getStatus())) {
extraClass = " skipped";
}
Node stepRow = div("step-row",
div("step-cell" + extraClass, step.getKeyword() + step.getName()),
div("time-cell" + extraClass, getDuration(result)));
parent.appendChild(stepRow);
if (step.getRows() != null) {
Node table = node("table", null);
parent.appendChild(table);
for (DataTableRow row : step.getRows()) {
Node tr = node("tr", null);
table.appendChild(tr);
for (String cell : row.getCells()) {
tr.appendChild(node("td", null, cell));
}
}
}
if (reportStep.getCalled() != null) { // this is a 'call'
for (ReportStep rs : reportStep.getCalled()) {
Node calledStepsDiv = div("scenario-steps-nested");
parent.appendChild(calledStepsDiv);
stepHtml(rs, calledStepsDiv);
}
} else if (step.getDocString() != null) { // only for non-call, else un-synced stack traces may creep in
DocString docString = step.getDocString();
parent.appendChild(node("div", "preformatted", docString.getValue()));
}
appendLog(parent, reportStep.getLog());
}
示例10: ReportStep
import gherkin.formatter.model.Step; //导入依赖的package包/类
public ReportStep(Step step, Match match, Result result, String log, CallContext callContext) {
this.step = step;
this.match = match;
this.result = result;
this.log = log;
this.callContext = callContext;
}
示例11: createStep
import gherkin.formatter.model.Step; //导入依赖的package包/类
private Step createStep(String keyword, String name, Integer line) {
Step step = EasyMock.createMock(Step.class);
EasyMock.expect(step.getKeyword()).andReturn(keyword).anyTimes();
EasyMock.expect(step.getName()).andReturn(name).anyTimes();
EasyMock.expect(step.getLine()).andReturn(line).anyTimes();
EasyMock.replay(step);
return step;
}
示例12: beforeStep
import gherkin.formatter.model.Step; //导入依赖的package包/类
@Override
protected void beforeStep(Step step) {
StartTestItemRQ rq = new StartTestItemRQ();
rq.setName(Utils.buildStatementName(step, stepPrefix, " ", null));
rq.setDescription(Utils.buildMultilineArgument(step));
rq.setStartTime(Calendar.getInstance().getTime());
rq.setType("STEP");
currentStepId = RP.get().startTestItem(currentScenario.getId(), rq);
}
示例13: extractStep
import gherkin.formatter.model.Step; //导入依赖的package包/类
private Step extractStep(StepDefinitionMatch match) {
try {
Field step = match.getClass().getDeclaredField("step");
step.setAccessible(true);
return (Step) step.get(match);
} catch (ReflectiveOperationException e) {
//shouldn't ever happen
LOG.error(e.getMessage(), e);
throw new RuntimeException(e);
}
}
示例14: extractStep
import gherkin.formatter.model.Step; //导入依赖的package包/类
private Step extractStep(StepDefinitionMatch match) {
try {
Field step = match.getClass().getDeclaredField("step");
step.setAccessible(true);
return (Step) step.get(match);
} catch (ReflectiveOperationException e) {
//shouldn't ever happen
LOG.error(e.getMessage(), e);
throw new CucumberException(e);
}
}
示例15: fireCanceledStep
import gherkin.formatter.model.Step; //导入依赖的package包/类
private void fireCanceledStep(Step unimplementedStep) {
String name = getStepName(unimplementedStep);
ALLURE_LIFECYCLE.fire(new StepStartedEvent(name).withTitle(name));
ALLURE_LIFECYCLE.fire(new StepCanceledEvent());
ALLURE_LIFECYCLE.fire(new StepFinishedEvent());
//not to change FAILED status to CANCELED in the report
ALLURE_LIFECYCLE.fire(new TestCasePendingEvent() {
@Override
protected String getMessage() {
return "Unimplemented steps were found";
}
});
currentStatus = SKIPPED;
}