Jump to content

Run tests: Difference between revisions

From NusaATK
No edit summary
Patrick (talk | contribs)
nl -> en
Line 13: Line 13:
  the results.
  the results.


ATK zal dan zoeken door heel de applicatie en zal alle .php en .inc bestanden waar 'test' in de bestandsnaam staat openen, de setup() functie uitvoeren, daarna alle functies uitvoeren die met test_ beginnen en als laatste de teardown() functie uitvoeren.
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 ==
== Run Selective ==


Als je alleen 1 enkele module wil testen, dan kun je test.php?atkmodule=modulenaam uitvoeren. Hij voert dan alleen de tests uit die hij in die module kan vinden.
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.


Als je enkel de tests van een bepaald bestand wil uitvoeren kan je ook
If you want to execute the tests of a single testcase you can do something like this:
   test.php?include=class.test_eentest.inc
   test.php?include=class.test_mytest.inc
gebruiken in je URI, het test framework zal dan enkel dat bestand uitvoeren.
The test framework will only execute the 'test_' functions in this single testcase.


'''TIP:''' Als je de include variabele gebruikt met enkel het bestandsnaam dan moet het framework nog steeds heel de applicatie doorzoeken, bij grote Platform sites kan dit wel 8 seconden duren en veel geheugen kosten. Er is dan ook de optie om een test class direct te draaien: de 'class' variabele. Het framework zal dan het zoeken overslaan en enkel die testklasse draaien.
'''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:


Voorbeeld:  
Example:  
   test.php?class=atk.db.testcases.test_atkdb
   test.php?class=atk.db.testcases.test_atkdb


Dit zal ./platform/atk/db/testcases/class.test_atkdb.inc laden en uitvoeren voor een Platform installatie.
This will load ./platform/atk/db/testcases/class.test_atkdb.inc and perform its tests.


Dit werkt ook met bestanden die zowiezo niet gevonden zouden worden als test bestand (m.a.w. bestanden zonder 'test' in de bestandsnaam). In dat geval zoekt hij zelf de bijbehorende testcases op.
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:
Example:

Revision as of 12:38, 16 May 2007

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

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.

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