Jump to content

Run tests: Difference between revisions

From NusaATK
Patrick (talk | contribs)
nl -> en
 
Line 6: Line 6:
   And for the admin you go to [http://www.relaxnow.nl/platform/admin/ http://www.relaxnow.nl/platform/admin/]  
   And for the admin you go to [http://www.relaxnow.nl/platform/admin/ http://www.relaxnow.nl/platform/admin/]  
   then you can find the test on [http://www.relaxnow.nl/test.php http://www.relaxnow.nl/test.php]
   then you can find the test on [http://www.relaxnow.nl/test.php http://www.relaxnow.nl/test.php]
WDE Only:
By excecuting '[[sph]] test' in the root of the site.
'''Info:''' sph test knows a flag --dontmail. So when you excecute 'sph test --dontmail' it will not mail
the results.


ATK will search the entire application for .php and .inc files with 'test_' in the filename, execute the setUp() function, run the 'test_' functions and finally execute the tearDown() function.
ATK will search the entire application for .php and .inc files with 'test_' in the filename, execute the setUp() function, run the 'test_' functions and finally execute the tearDown() function.

Latest revision as of 08:58, 11 March 2011

Hier hoort informatie over automatische tests voor het SimpleTest framework voor Platform (>M6) en ATK (>5)

Run tests

Tests can be executed by browsing to test.php (same folder where index.php is).

 So for browsing a site you go to http://www.relaxnow.nl/ 
 And for the admin you go to http://www.relaxnow.nl/platform/admin/ 
 then you can find the test on http://www.relaxnow.nl/test.php

ATK will search the entire application for .php and .inc files with 'test_' in the filename, execute the setUp() function, run the 'test_' functions and finally execute the tearDown() function.

Run Selective

If you want to test a single module, you can use the atkmodule parameter:

 test.php?atkmodule=modulename. 

ATK will execute only the tests it can find in that module.

If you want to execute the tests of a single testcase you can do something like this:

 test.php?include=class.test_mytest.inc

The test framework will only execute the 'test_' functions in this single testcase.

TIP: If you use the include option the framework must still search the entire application for this testcase, since it does not keep track of their locations. This might take several valuable seconds and use quite some memory. This is why there is another test option for running a single testcase where you can include the location:

Example:

 test.php?class=atk.db.testcases.test_atkdb

This will load ./platform/atk/db/testcases/class.test_atkdb.inc and perform its tests.

The class option also works for files that would not be found because they don't have 'test_' in the filename. Since the test framework does not need to search for testcases, it will simply load any given testcase.

Example:

 test.php?class=atk.db.atkdb

Writing tests

See: Writing tests