Summer of Code/2014/Activity Unit Tests: Difference between revisions
AneeshDogra (talk | contribs) No edit summary |
AneeshDogra (talk | contribs) No edit summary |
||
| Line 29: | Line 29: | ||
I'll be using the python unittest library for writing unit tests. Its easy to write unittest for functions, that's pretty standard. Testing the GUI is a bit complex, the initial strategy is to simulate GUI triggers, like a mouse click, key down event etc using the uitree module in the sugar3 toolkit. | I'll be using the python unittest library for writing unit tests. Its easy to write unittest for functions, that's pretty standard. Testing the GUI is a bit complex, the initial strategy is to simulate GUI triggers, like a mouse click, key down event etc using the uitree module in the sugar3 toolkit. | ||
* The initial GUI tests would be to check if all the buttons in the toolbar exists, and buttons and other elements on the screen/canvas exists as they are expected to. | |||
Basic structure of the code would look like: | Basic structure of the code would look like: | ||
| Line 41: | Line 41: | ||
assert (activity_button != None) | assert (activity_button != None) | ||
* The second stage would be to test if the buttons work as expected, we'd get the button reference using the uitree module and use the do_action method to run that particular action. | |||
one_button = activity_node.find_child(name="1", | one_button = activity_node.find_child(name="1", | ||
role_name="push button") | role_name="push button") | ||