201
edits
No edit summary |
No edit summary |
||
Line 65: | Line 65: | ||
* _some-code-dir_/tests | * _some-code-dir_/tests | ||
** tests for the code/function/feature | ** tests for the code/function/feature | ||
= how to add test cases = | |||
* basic types of tests | |||
** "make check" targets | |||
** jsunit tests | |||
** layout comparison tests | |||
** jssh driver tests | |||
* typical types of tests | |||
** make check | |||
*** does not need entire browser instance | |||
*** stand-alone executables | |||
**** unit tests | |||
**** xpcom consumers | |||
**** xpcshell-based test harness tests | |||
***** interpret tests written in js | |||
***** helper functions exist to implement event loop | |||
** jsunit | |||
*** runs in content in browser | |||
*** supports asynchronous tests via semaphore variables (run test when test_done -> true) | |||
*** good for DOM tests | |||
** layout comparison | |||
*** compare layout/rendering of two different pages using canvas | |||
*** dynamic generation of reference image | |||
*** good for layout/css tests | |||
**** <span style="color: rgb(0,255,0);">This text is green</span> | |||
**** something much more complex that should paint green text | |||
** jssh driver | |||
*** uses jssh as "remote control" of browser, with chrome privileges | |||
*** good for jsunit-style tests that need to muck about with preferences | |||
*** good for tests that should quit or crash the browser | |||
* weaknesses | |||
** make check | |||
*** getting the linking right for standalone executables is hard | |||
*** need to explicitely instantiate all services/components needed | |||
** jsunit | |||
*** can't run chrome stuff | |||
*** can't deal with modal windows | |||
** layout comparison | |||
*** can be a lot of work to generate test cases | |||
** jssh driver | |||
*** only works with modal windows on trunk (1.9) | |||
*** slow |
edits