|__author__ = 'k0emt'|
|from Experiment import Greeter|
|greeter = Greeter()|
|# this test will fail until you change the Greeter to return this expected message|
|self.assertEqual(greeter.message, 'Hello world!')|
|if __name__ == '__main__':|
Thank you k0emt - totally what I needed to get a basic understanding of what unittest was about!
To help others understand in ExperimentTests.py change 'self.assertEqual(greeter.message, 'Hello world!')' to expect something slightly different such as 'self.assertEqual(greeter.message, 'Hello world?')' to get a failure message :) This means that the expected message was not received thus the failure, otherwise if the expected message was received (i.e. they match) then it prints out OK after the test is run.
Have a look at this with additional basic test cases appended to the above python files.