protected boolean addExpectedChildrenFailureIfNoChildren(final NODE_TYPE node, final List<? extends IExecutionNode> children, final RootNodeExecutionContext context) { final boolean hasChildren = children != null && !children.isEmpty(); if (!hasChildren) { context.addFailure(new SubstepExecutionFailure(new IllegalStateException( "node should have children but doesn't"), node)); } return hasChildren; }
private void addFailure(StepImplementationNode node, RootNodeExecutionContext context, Throwable t) { byte[] screenshotBytes = attemptScreenshot(node, context); context.addFailure(new SubstepExecutionFailure(t, node, screenshotBytes)); }
protected boolean addExpectedChildrenFailureIfNoChildren(final NODE_TYPE node, final List<? extends IExecutionNode> children, final RootNodeExecutionContext context) { final boolean hasChildren = children != null && !children.isEmpty(); if (!hasChildren) { String msg; if (node instanceof RootNode){ msg = "\n\n ** No tests were executed, check Tag configuration in your pom.xml and the tags in the included features **\n\n"; }else { msg = "node should have children but doesn't"; } context.addFailure(new SubstepExecutionFailure(new SubstepsRuntimeException(msg), node)); } return hasChildren; }
private boolean runSetup(final NODE_TYPE node, final RootNodeExecutionContext context) { try { context.getSetupAndTeardown().runSetup(getScope()); return true; } catch (final Throwable t) { log.warn("setup failed", t); context.addFailure(new SubstepExecutionFailure(t, node, true)); return false; } }
private void addFailure(StepImplementationNode node, RootNodeExecutionContext context, Throwable t) { byte[] screenshotBytes = attemptScreenshot(node, context); SubstepExecutionFailure failure; if (context.isNodeFailureNonCritical(node)){ failure = SubstepExecutionFailure.nonCriticalFailure(t, node, screenshotBytes); } else { failure = SubstepExecutionFailure.criticalFailure(t,node, screenshotBytes); } context.addFailure(failure); }
private void runTearDown(final NODE_TYPE node, final RootNodeExecutionContext context) { try { context.getSetupAndTeardown().runTearDown(getScope()); ExecutionContext.clear(getScope()); } catch (final SubstepsRuntimeException t) { log.warn("tear down failed", t); context.addFailure(new SubstepExecutionFailure(t, node, true)); } }
private void runTearDown(final NODE_TYPE node, final RootNodeExecutionContext context) { try { context.getSetupAndTeardown().runTearDown(getScope()); ExecutionContext.clear(getScope()); } catch (final Throwable t) { log.warn("tear down failed", t); context.addFailure(new SubstepExecutionFailure(t, node, true)); } }
private boolean runSetup(final NODE_TYPE node, final RootNodeExecutionContext context) { try { context.getSetupAndTeardown().runSetup(getScope(), node); return true; } catch (final Throwable t) { log.warn("setup failed", t); context.addFailure(new SubstepExecutionFailure(t, node, true)); context.getNotificationDistributor().onNodeFailed(node, t); return false; } }
public RootNode run() { // TODO - why is this here twice? ExecutionContext.put(Scope.SUITE, INotificationDistributor.NOTIFIER_DISTRIBUTOR_KEY, this.notificationDistributor); this.rootNodeRunner.run(this.rootNode, this.nodeExecutionContext); if (!this.nodeExecutionContext.haveTestsBeenRun()) { final Throwable t = new IllegalStateException("No tests executed"); SubstepExecutionFailure sef = new SubstepExecutionFailure(t, this.rootNode, ExecutionResult.FAILED); //this.rootNode.getResult().setFailed(t); this.notificationDistributor.onNodeFailed(this.rootNode, t); this.nodeExecutionContext.addFailure(sef); } this.failures = this.nodeExecutionContext.getFailures(); return this.rootNode; }
@Override public RootNode run() { // TODO - why is this here twice? ExecutionContext.put(Scope.SUITE, INotificationDistributor.NOTIFIER_DISTRIBUTOR_KEY, this.notificationDistributor); this.rootNodeRunner.run(this.rootNode, this.nodeExecutionContext); if (!this.nodeExecutionContext.haveTestsBeenRun()) { final Throwable t = new NoTestsRunException(); SubstepExecutionFailure sef = new SubstepExecutionFailure(t, this.rootNode, ExecutionResult.FAILED); this.notificationDistributor.onNodeFailed(this.rootNode, t); this.nodeExecutionContext.addFailure(sef); } this.failures = this.nodeExecutionContext.getFailures(); return this.rootNode; }
private boolean beforeExecute(final NODE_TYPE node, final RootNodeExecutionContext context) { boolean shouldContinue = true; // node.getResult().setStarted(); if (node.hasError()) { context.getNotificationDistributor().onNodeFailed(node, node.getResult().getThrown()); context.addFailure(new SubstepExecutionFailure(node.getResult().getThrown(), node)); shouldContinue = false; } else { node.getResult().setStarted(); context.getNotificationDistributor().onNodeStarted(node); shouldContinue = runSetup(node, context); } if (!shouldContinue) { log.debug("shouldContinue = false for {}", node); } return shouldContinue; }
private boolean beforeExecute(final NODE_TYPE node, final RootNodeExecutionContext context) { boolean shouldContinue; if (node.hasError()) { context.getNotificationDistributor().onNodeFailed(node, node.getResult().getThrown()); context.addFailure(new SubstepExecutionFailure(node.getResult().getThrown(), node)); shouldContinue = false; } else { node.getResult().setStarted(); context.getNotificationDistributor().onNodeStarted(node); shouldContinue = runSetup(node, context); } if (!shouldContinue) { log.debug("shouldContinue = false for {}", node); } return shouldContinue; }