コード例 #1
0
class TestCaseTest(TestCase):
    def setUp(self):
        self.result = TestResult()

    def testTemplateMethod(self):
        test = WasRun("testMethod")
        test.run(self.result)
        assert ("setUp testMethod tearDown " == test.log)

    def testResult(self):
        test = WasRun("testMethod")
        test.run(self.result)
        assert ("1 run, 0 failed" == result.summary())

    def testFailedResult(self):
        test = WasRun("testBrokenMethod")
        test.run(self.result)
        assert ("1 run, 1 failed" == result.summary())

    def testFailedResultFormatting(self):
        self.result.testStarted()
        self.result.testFailed()
        assert ("1 run, 1 failed" == result.summary())

    def testSuite(self):
        suite = TestSuite()
        suite.add(WasRun("testMethod"))
        suite.add(WasRun("testBrokenMethod"))
        suite.run(self.result)
        assert ("2 run, 1 failed" == result.summary())
コード例 #2
0
ファイル: testCaseFacts.py プロジェクト: swzhou/tdd-xUnit
	def testSuite(self):
		suite = TestSuite()
		suite.add(WasRun("testMethod"))
		suite.add(WasRun("testBrokenMethod"))
		result = TestResult()
		suite.run(result)
		assert("2 run, 1 failed" == result.summary())
コード例 #3
0
 def setUp(self):
     self.result = TestResult()
コード例 #4
0
        test.run(self.result)
        assert ("1 run, 0 failed" == result.summary())

    def testFailedResult(self):
        test = WasRun("testBrokenMethod")
        test.run(self.result)
        assert ("1 run, 1 failed" == result.summary())

    def testFailedResultFormatting(self):
        self.result.testStarted()
        self.result.testFailed()
        assert ("1 run, 1 failed" == result.summary())

    def testSuite(self):
        suite = TestSuite()
        suite.add(WasRun("testMethod"))
        suite.add(WasRun("testBrokenMethod"))
        suite.run(self.result)
        assert ("2 run, 1 failed" == result.summary())


suite = TestSuite()
suite.add(TestCaseTest("testTemplateMethod"))
suite.add(TestCaseTest("testResult"))
suite.add(TestCaseTest("testFailedResultFormatting"))
suite.add(TestCaseTest("testFailedResult"))
suite.add(TestCaseTest("testSuite"))
result = TestResult()
suite.run(result)
print(result.summary())
コード例 #5
0
ファイル: testCaseFacts.py プロジェクト: swzhou/tdd-xUnit
	def testFailedResultFormatting(self):
		result = TestResult()
		result.testStarted()
		result.testFailed()
		assert("1 run, 1 failed" == result.summary())
コード例 #6
0
ファイル: testCaseFacts.py プロジェクト: swzhou/tdd-xUnit
	def testFailedResult(self):
		test = WasRun("testBrokenMethod")
		result = TestResult()
		test.run(result)
		assert("1 run, 1 failed" == result.summary())
コード例 #7
0
ファイル: testCaseFacts.py プロジェクト: swzhou/tdd-xUnit
		test = WasRun("testMethod")
		result = TestResult()
		test.run(result)
		assert("1 run, 0 failed" == result.summary())
	def testFailedResult(self):
		test = WasRun("testBrokenMethod")
		result = TestResult()
		test.run(result)
		assert("1 run, 1 failed" == result.summary())
	def testFailedResultFormatting(self):
		result = TestResult()
		result.testStarted()
		result.testFailed()
		assert("1 run, 1 failed" == result.summary())
	def testSuite(self):
		suite = TestSuite()
		suite.add(WasRun("testMethod"))
		suite.add(WasRun("testBrokenMethod"))
		result = TestResult()
		suite.run(result)
		assert("2 run, 1 failed" == result.summary())
		
suite = TestSuite()
suite.add(TestCaseFacts("testTemplateMethod"))
suite.add(TestCaseFacts("testResult"))
suite.add(TestCaseFacts("testFailedResult"))
suite.add(TestCaseFacts("testFailedResultFormatting"))
suite.add(TestCaseFacts("testSuite"))
result = TestResult()
suite.run(result)
print result.summary()