Skip to content
enygma edited this page Nov 11, 2010 · 1 revision

By default, frisk will look for a "tests" directory in the same directory as the command lives. It looks inside and runs all the tests it can get its hands on - basically anything with a filename ending in "Test.php". Now, this is perfect if you just have a bunch of tests you want to run, but what happens if you want to break up those tests and make things a bit more civilized?

This is where the test suites come in. They let you organize your tests into more easily manageable chunks according to, well, whatever criteria you want. Say you have thirty tests, but twenty of them really only test your site's API. Now, you can run all of these at one time, but what happens if you only want to test the API and not the whole site (which could end up getting pretty slow). You can create a suite just for the API tests. Here's how you create a suite:

  • In your tests directory, you'll see a file named test.ini.dist. You'll need to either rename or copy this to test.ini. This is the file you'll define the suites in
  • If you open it up, you'll see some sample suites already defined - api and test
  • You'll also see how to define the directory to point the suite to. (You could do the same thing with the --tests-dir command line parameter)
  • There's also a special value you can set called tests. This lets you define specific test names and patterns (regular expression) for the suite to run. For example, if you had your API tests, but you only wanted to run the ones for authentication, you could use tests = /.?AuthTest/* to grab all of the tests ending in "AuthTest". This can be a handy way to split up tests even more.

Here's an example test.ini configuration file showing how this all fits together:

[suite:api]
; run all API tests
directory = /www/htdocs/frisk/tests/api

[suite:api-auth]
; run just the authentication tests
directory = /www/htdocs/frisk/tests/api
tests = /.*?AuthTest/

[suite:other-dir]
directory = /tmp/myTests

Now, the easy part - running the suite. All you have to do is specify the suite to run on the command line and frisk takes care of the rest:

./frisk --suite=api-auth