Created
February 25, 2014 17:19
-
-
Save RobinDavid/9213471 to your computer and use it in GitHub Desktop.
Sample of a Pyunit test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
class Test1 (unittest.TestCase): #Define a class which extend unittest | |
def runTest(self): | |
self.failIf (1+1 != 2, '1+1 failed !') | |
def suite(): | |
suite = unittest.TestSuite() #create an object testsuite | |
suite.addTest(Test1()) | |
return suite | |
if __name__ == '__main__': | |
runner = unittest.TextTestRunner() #Declare the runner | |
test_suite = suite() | |
runner.run(test_suite) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment