Changes between Version 120 and Version 121 of Dev/Tests


Ignore:
Timestamp:
02/15/10 00:58:09 (3 years ago)
Author:
jnguyenx
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Dev/Tests

    v120 v121  
    204204Have a look at the file ''example_test.py'' to see how functional tests are written. 
    205205 
     206---- 
     207 
    206208If you create a new conference, you might want this conference to be deleted automatically if a test fails. Add this line just after the creation of the new conference or meeting: 
    207209{{{ 
     
    209211SeleniumTestCase.setConfID(self, sel.get_location()) 
    210212}}} 
     213 
     214---- 
    211215 
    212216Since it is very time consuming and painful to debug Selenium's generated code, tests should be small and test specific part of Indico. Of course, a few overall tests are needed. 
     
    216220 1. Javascript Calendar does not work either.[[BR]] ''Solution:'' Enter the date by hand. 
    217221 1. Do not make ''clicks'' or ''assertions'' on element containing '''IDs'''.[[BR]] ''Solution:'' Use XPath instead. Xpaths are easy to find with Firefox's plugin ''XPather''. 
    218  1. When replaying, Selenium can get confused with buttons' names and can end up clicking on the wrong button.[[BR]] ''Solution:'' Once again, use XPath instead. Xpaths are easy to find with Firefox's plugin ''XPather''. 
     222 1. When replaying, Selenium can get confused with buttons' names and can end up clicking on the wrong button.[[BR]] ''Solution:'' Once again, use XPath instead. Xpaths are easy to find with Firefox's plugin ''XPather''. For example, instead of having ''//td/tr['select']'', we use the whole path which starts with ''//html/etc'' 
    219223 1. Popups and AJAX requests are very bothersome to test with Selenium. The latter would not wait for a page or a tab to load if we do not explicitly tell to do so.[[BR]] ''Solution:'' Use Selenium ''waitForText'' function whenever a window pops up, a tab is loading or an AJAX request is sent.[[BR]] 
    220224And since Selenium is so unreliable about AJAX, to ensure that the action is performed, we do some brute forcing. 
     
    245249}}} 
    246250The only line to add is '''else: sel.click("addLink")'''. 
     251 
     252---- 
    247253 
    248254Finally, a test might work at several times and suddenly fail in the next run because of the reasons mentioned earlier. Running a test several times is a good indication to say if it is reliable or not. Use the script located in ''tests/python/functional/loop.py'', it will run the test 10 times and see if it fails. You just need to configure the path to your root indico directory and to define the test you want to run, using nose style. Here's an example: