Esempio n. 1
0
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())
Esempio n. 3
0
 def testTemplateMethod(self):
     test = WasRun("testMethod")
     test.run()
     assert ("setUp testMethod tearDown " == test.log)
Esempio n. 4
0
 def testFailedResult(self):
     test = WasRun("testBrokenMethod")
     result = test.run()
     assert ("1 run, 1 failed" == result.summary())
Esempio n. 5
0
 def testResult(self):
     test = WasRun("testMethod")
     result = test.run()
     assert ("1 run, 0 failed" == result.summary())
 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())
Esempio n. 8
0
from wasrun import WasRun

test = WasRun("testMethod")
print(test.wasRun)
test.run()
print(test.wasRun)
Esempio n. 9
0
 def testRunning(self):
     test = WasRun("testMethod")
     assert(not test.wasRun)
     test.run()
     assert(test.wasRun)