def test_suite(self): suite = TestSuite() suite.add(WasRun("test_method")) suite.add(WasRun("test_broken_method")) suite.run(self.result) assert ("2 run, 1 failed" == self.result.summary())
class TestCaseTest(TestCase): def setUp(self): self.test = WasRun("testMethod") def testRunning(self): self.test.run() assert(self.test.wasRun) def testSetUp(self): self.test.run() assert(self.test.wasSetUp)
class TestCaseTest(TestCase): def setUp(self): self.test = WasRun("testMethod") self.brokenTest = WasRun("testBrokenMethod") self.result = TestResult() self.brokenSetup = BrokenSetup("testMethod") def testTemplate(self): self.test.run(self.result) assert(self.test.log == "setUp|testMethod|tearDown|") def testResult(self): self.test.run(self.result) assert("1 run, 0 failed" == self.result.summary()) def testFailedResult(self): self.brokenTest.run(self.result) assert("testBrokenMethod FAILED\n1 run, 1 failed" == self.result.summary()) def testFailedResultFormat(self): self.result.startedTest() self.result.failedTest("failingTestName") assert("failingTestName FAILED\n1 run, 1 failed" == self.result.summary()) def testSuite(self): suite = TestSuite() suite.addTest(WasRun("testMethod")) suite.addTest(WasRun("testBrokenMethod")) suite.run(self.result) assert("testBrokenMethod FAILED\n2 run, 1 failed" == self.result.summary()) def testTearDownRunsAfterFailedTest(self): self.brokenTest.run(self.result) assert("setUp|testBrokenMethod|tearDown|" == self.brokenTest.log) def testSetUpFailIsReported(self): self.brokenSetup.run(self.result) assert("setUp FAILED\n0 run, 0 failed" == self.result.summary()) def testAddingTestCaseToTestSuite(self): suite = TestSuite(); suite.addTestCase(WasRun); suite.run(self.result); assert("testBrokenMethod FAILED\n2 run, 1 failed" == self.result.summary())
def testTemplateMethod(self): test = WasRun("testMethod") test.run() assert ("setUp testMethod tearDown " == test.log)
def testFailedResult(self): test = WasRun("testBrokenMethod") result = test.run() assert ("1 run, 1 failed" == result.summary())
def testResult(self): test = WasRun("testMethod") result = test.run() assert ("1 run, 0 failed" == result.summary())
def setUp(self): self.test = WasRun("testMethod")
def test_template_method(self): test = WasRun("test_method") test.run(self.result) assert (test.log == "setup test_method tear_down ")
def test_failed_result(self): test = WasRun("test_broken_method") test.run(self.result) assert ("1 run, 1 failed" == self.result.summary())
def setUp(self): self.test = WasRun("testMethod") self.brokenTest = WasRun("testBrokenMethod") self.result = TestResult() self.brokenSetup = BrokenSetup("testMethod")
from wasrun import WasRun test = WasRun("testMethod") print(test.wasRun) test.run() print(test.wasRun)
def testTemplateMethod(self): test = WasRun("testMethod") self.test.run() assert ("setUp testMethod" == self.test.log)
def testRunning(self): test = WasRun("testMethod") assert(not test.wasRun) test.run() assert(test.wasRun)