public void TestCaseFailureWithoutExceptionEventTest() { _lifecycle = Allure.DefaultLifecycle; var tsevt = new TestSuiteStartedEvent(SuiteUid, "suite42"); _lifecycle.Fire(tsevt); var tcsevt = new TestCaseStartedEvent(SuiteUid, "test name"); _lifecycle.Fire(tcsevt); var evt = new TestCaseFailureEvent(); _lifecycle.Fire(evt); Assert.AreEqual(status.broken, _lifecycle.TestSuiteStorage.Get(SuiteUid).testcases[0].status); Assert.AreEqual("Test broken with unknown reason", _lifecycle.TestSuiteStorage.Get(SuiteUid).testcases[0].failure.message); }
public void TestCaseFailureWithAssertionExceptionAndStackTraceEventTest() { _lifecycle = Allure.DefaultLifecycle; var tsevt = new TestSuiteStartedEvent(SuiteUid, "suite42"); _lifecycle.Fire(tsevt); var tcsevt = new TestCaseStartedEvent(SuiteUid, "test name"); _lifecycle.Fire(tcsevt); var evt = new TestCaseFailureEvent { Throwable = new AssertionException("assertion exception"), StackTrace = "stack trace" }; _lifecycle.Fire(evt); Assert.AreEqual(status.failed, _lifecycle.TestSuiteStorage.Get(SuiteUid).testcases[0].status); Assert.AreEqual("assertion exception", _lifecycle.TestSuiteStorage.Get(SuiteUid).testcases[0].failure.message); Assert.AreEqual("stack trace", _lifecycle.TestSuiteStorage.Get(SuiteUid).testcases[0].failure.stacktrace); }
public void TestCaseFailureWithOtherExceptionEventTest() { _lifecycle = Allure.DefaultLifecycle; var tsevt = new TestSuiteStartedEvent(SuiteUid, "suite42"); _lifecycle.Fire(tsevt); var tcsevt = new TestCaseStartedEvent(SuiteUid, "test name"); _lifecycle.Fire(tcsevt); var evt = new TestCaseFailureEvent { Throwable = new NullReferenceException("null reference exception") }; _lifecycle.Fire(evt); Assert.AreEqual(status.broken, _lifecycle.TestSuiteStorage.Get(SuiteUid).testcases[0].status); Assert.AreEqual("null reference exception", _lifecycle.TestSuiteStorage.Get(SuiteUid).testcases[0].failure.message); }