public virtual void TestMaxFailures() { LuceneTestCase.ReplaceMaxFailureRule(new TestRuleIgnoreAfterMaxFailures(2)); JUnitCore core = new JUnitCore(); StringBuilder results = new StringBuilder(); core.addListener(new RunListenerAnonymousInnerClassHelper(this, results)); Result result = core.run(typeof(Nested)); Assert.AreEqual(500, result.RunCount); Assert.AreEqual(0, result.IgnoreCount); Assert.AreEqual(2, result.FailureCount); // Make sure we had exactly two failures followed by assumption-failures // resulting from ignored tests. Assert.IsTrue(results.ToString(), results.ToString().matches("(S*F){2}A+")); }
public virtual void TestZombieThreadFailures() { LuceneTestCase.ReplaceMaxFailureRule(new TestRuleIgnoreAfterMaxFailures(1)); JUnitCore core = new JUnitCore(); StringBuilder results = new StringBuilder(); core.addListener(new RunListenerAnonymousInnerClassHelper(this, results)); Result result = core.run(typeof(Nested2)); if (Nested2.Die != null) { Nested2.Die.countDown(); Nested2.Zombie.Join(); } base.PrevSysOut.println(results.ToString()); Assert.AreEqual(Nested2.TOTAL_ITERS, result.RunCount); Assert.AreEqual(results.ToString(), "SFAAAAAAAA", results.ToString()); }