public void RunAsynchronous_should_propagate_step_exception() { Assert.ThrowsAsync <NotImplementedException>(() => _runner .Integrate() .NewScenario() .WithCapturedScenarioDetails() .WithSteps(new[] { TestStep.Create(Async_test_throwing_exception) }) .RunAsynchronously()); }
public void Invalid_step_descriptors_should_make_scenario_failing_immediately_without_execution() { var step1 = TestStep.Create(Step_that_should_not_run); var step2 = StepDescriptor.CreateInvalid(new Exception("reason1")); var step3 = StepDescriptor.CreateInvalid(new Exception("reason2")); var ex = Assert.Throws <AggregateException>(() => _runner.Test().TestScenario(step1, step2, step3)); Assert.That(ex.InnerExceptions.Select(x => x.Message).ToArray(), Is.EqualTo(new[] { "Scenario steps initialization failed.", "reason1", "reason2" })); var steps = _feature.GetFeatureResult().GetScenarios().Single().GetSteps(); StepResultExpectation.AssertEqual(steps, new StepResultExpectation(1, 3, "Step that should not run", ExecutionStatus.NotRun), new StepResultExpectation(2, 3, "<INVALID STEP>", ExecutionStatus.Failed, "Step 2: reason1"), new StepResultExpectation(3, 3, "<INVALID STEP>", ExecutionStatus.Failed, "Step 3: reason2")); }
public void Invalid_step_descriptors_should_make_composite_failing_immediately_without_execution() { TestCompositeStep Composite_step() => new TestCompositeStep( TestStep.Create(Step_that_should_not_run), StepDescriptor.CreateInvalid(new Exception("reason1")), StepDescriptor.CreateInvalid(new Exception("reason2"))); var ex = Assert.Throws <AggregateException>(() => _runner.Test() .TestScenario( TestStep.CreateComposite(Composite_step), TestStep.Create(Step_that_should_not_run))); Assert.That(ex.InnerExceptions.Select(x => x.Message).ToArray(), Is.EqualTo(new[] { "Sub-steps initialization failed.", "reason1", "reason2" })); var mainSteps = _feature.GetFeatureResult().GetScenarios().Single().GetSteps().ToArray(); StepResultExpectation.AssertEqual(mainSteps[0].GetSubSteps(), new StepResultExpectation("1.", 1, 3, "Step that should not run", ExecutionStatus.NotRun), new StepResultExpectation("1.", 2, 3, "<INVALID STEP>", ExecutionStatus.Failed, "Step 1.2: reason1"), new StepResultExpectation("1.", 3, 3, "<INVALID STEP>", ExecutionStatus.Failed, "Step 1.3: reason2")); Assert.That(mainSteps[1].Status, Is.EqualTo(ExecutionStatus.NotRun)); }