To run a unit test, you must have a setUp method, a tearDown method, and one or more test methods whose names begin with "test". Each of them takes self as their first argument.
Here is a mock-up you can use. It's an example test for the Windows Calculator (not tested):
def setUp(self):
setAutoWaitTimeout(10)
openApp("C:\\Windows\\system32\calc.exe") # open windows calculator
wait("CalculatorWindow.png") # wait for calculator window to appear
def test_calculator(self):
with Region(find("CalculatorWindow.png")):
click("1_Button.png") # Click "1"
click("Plus_Button.png") # Click "+"
click("2_Button.png") # Click "2"
click("Equals_Button.png") # Click "="
type("c",KEY_CTRL)
assert Env.getClipboard() == 3
def tearDown(self):
closeApp("Calculator") # Matches text from the window's title bar
Here's a fuller example of a unit test, but it was written for Sikuli 0.9, so many of the Sikuli methods (click, find, etc.) are different from the current version of Sikuli. But the unit testing methods are all there (setUp, tearDown, test*):
http://sikuli.org/documentation.shtml#examples/TestJEdit.sikuli/TestJEdit.html