Message185024
I'll start with a bit of philosophical guidance :)
1. As much as possible, push logic testing down into the non-GUI tests. Where unittest.mock can help here is when you have a piece of code to test that is *almost* independent of the GUI, but needs to call an API to either get input from the user or to send something to the screen. unittest.mock can then be set up to intercept that call, either to check that it happened as expected (display operations) or to provide a predetermined answer (input operations).
2. For the GUI tests, unittest.mock is likely to be most useful in providing predetermined input. There's only so much you can do with this, it's ultimately about ensuring that the code tested against mocked out APIs in the lower level tests at least doesn't throw exceptions when tested against the real APIs. Proper GUI testing is actually a much harder test automation problem, so it probably makes sense to focus on the non-GUI tests for now. |
|
Date |
User |
Action |
Args |
2013-03-23 01:43:16 | ncoghlan | set | recipients:
+ ncoghlan, terry.reedy, ned.deily, ezio.melotti, roger.serwy, r.david.murray, Todd.Rovito, tshepang, francismb |
2013-03-23 01:43:16 | ncoghlan | set | messageid: <1364002996.79.0.810693265929.issue15392@psf.upfronthosting.co.za> |
2013-03-23 01:43:16 | ncoghlan | link | issue15392 messages |
2013-03-23 01:43:15 | ncoghlan | create | |
|