def testSuite(self):
    suite = TestSuite()
    suite.add(WasRun("testMethod"))
    suite.add(WasRun("testBrokenMethod"))

    suite.run(self.result)
    assert("2 run, 1 failed" == self.result.summary() )
Exemplo n.º 2
0
class TestCaseTest(TestCase):
    def setUp(self):
        self.result = TestResult()
        self.test = WasRun("testMethod")
        self.suite = TestSuite()

    def testRunning(self):
        self.test.run(self.result)
        assert (self.test.wasRun)

    def testSetUp(self):
        self.test.run(self.result)
        assert (self.test.wasSetUp)

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

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

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

    def testSuite(self):
        self.suite.add(WasRun("testMethod"))
        self.suite.add(WasRun("testBrokenMethod"))
        self.suite.run(self.result)
        assert ("2 run, 1 failed" == self.result.summary())
Exemplo n.º 3
0
 def testSuite(self):
     suite= TestSuite()
     suite.add(WasRun("testMethod"))
     suite.add(WasRun("testBrokenMethod"))
     suite.run(self.result)
     assert("2 run, 1 failed" == self.result.summary())
     print('testSuite done')
Exemplo n.º 4
0
 def testSuiteContainsFailingSetup(self):
     suite = TestSuite()
     suite.add(BrokenSetup("testMethod"))
     suite.run(self.result)
     assert ("1 run, 1 failed" == self.result.summary())
Exemplo n.º 5
0
        suite = TestSuite()
        suite.add(BrokenSetup("testMethod"))
        suite.run(self.result)
        assert ("1 run, 1 failed" == self.result.summary())

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

    def tearDownIfFailed(self):
        test = WasRun("testBrokenMethod")
        test.run(self.result)


suite = TestSuite()
suite.add(TestCaseTest("testTemplateMethod"))
suite.add(TestCaseTest("testResult"))
suite.add(TestCaseTest("testFailedResultFormatting"))
suite.add(TestCaseTest("testFailedResult"))
suite.add(TestCaseTest("testSuite"))
suite.add(TestCaseTest("setupFailed"))
suite.add(TestCaseTest("testSuiteContainsFailingSetup"))
suite.add(TestCaseTest("tearDownIfFailed"))

result = TestResult()
suite.run(result)
print(result.summary())
Exemplo n.º 6
0
#!/usr/bin/env python
import os, sys
basedir = os.path.abspath(os.path.dirname(__file__))
libdir = os.path.abspath(os.path.join(basedir, '../lib'))
libtest = os.path.abspath(os.path.join(basedir, '../lib/test'))

sys.path.append(libdir)
sys.path.append(libtest)
import logging as log
log.basicConfig(format='%(message)s', level=log.DEBUG)
from test_suite import TestSuite

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

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

  def testSuite(self):
    suite = TestSuite()
    suite.add(WasRun("testMethod"))
    suite.add(WasRun("testBrokenMethod"))

    suite.run(self.result)
    assert("2 run, 1 failed" == self.result.summary() )

suite = TestSuite()

suite.add(TestCaseTest("testTemplateMethod"))
suite.add(TestCaseTest("testResult"))
suite.add(TestCaseTest("testFailedResult"))
suite.add(TestCaseTest("testFailedResultFormatting"))
suite.add(TestCaseTest("testSuite"))

result = TestResult()
suite.run(result)
print result.summary()

Exemplo n.º 8
0
#!/usr/bin/env python
import os, sys
basedir = os.path.abspath(os.path.dirname(__file__))
libdir = os.path.abspath(os.path.join(basedir, '../lib'));
libtest = os.path.abspath(os.path.join(basedir, '../lib/test'));

sys.path.append(libdir)
sys.path.append(libtest)
import logging as log
log.basicConfig(format='%(message)s', level=log.DEBUG)
from test_suite import TestSuite

ts = TestSuite()
ts.run()
ts.save()