Summer of Code/2014/Activity Unit Tests: Difference between revisions

No edit summary
No edit summary
Line 30: Line 30:
* 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.
* 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:  
- 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:  


     root = uitree.get_root()
     root = uitree.get_root()
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.
- 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")