Run tests

From Achievo/ATK Wiki

Jump to: navigation, search

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

Personal tools
Navigation