Komodo has a unit testing interface for Perl, PHP, Ruby and Python. Unit tests can be defined within project or file preferences. Test output is displayed in the Test Results tab in the bottom pane. Click on an error to jump to the relevant file and line number.
To create a test plan for a specific file, click Tools|Test Plans|Create New Test Plan.... File-based test plans can be edited and managed in the file's preferences (Edit|Current File Settings).
To create a project-specific test plan, right-click on a project and select Create New Test Plan.... Project-specific test plans can be edited and managed in the project preferences.
In the "Define a new Test Plan" dialog box:
- Give the test plan a unique name
- Select the language
- Set the directory to run the test command in (usually the base directory of a project).
- Specify any additional command line options (see below).
- Click 'OK' to save the test plan
To edit an existing test plan, select the test plan from the drop list in the Test Results tab and click the Edit Current Test Plan button.
- Perl: Uses 'make test'. If no Makefile is present, it first runs 'perl Makefile.PL' to generate one before running 'make test'. Note: On Windows, if you're testing an XS library, and nmake wants to rebuild part of it, you need to have the Visual C++ environment loaded when Komodo is launched.
- Python: Uses the unittest framework. You need to specify a list of files and/or directories to test.
- PHP: Uses the PHPUnit framework. Set the test plan to point to the base directory of the project. The test harness will look for a subdirectory called tests.
- Ruby: Runs 'rake'. If the default action of the Rakefile is to run tests, no command-line options are needed. If not, enter the appropriate target for rake (e.g. 'rake test').
If the test framework you are running requires additional libraries that are not in the language interpreter's default search path (e.g. PERL5LIB or PYTHONPATH), you can add them to the language settings in the project properties or global preferences.
To run a test plan, select it from the drop list in the Tests Results tab in the bottom pane and click the Run Test Plan button. The drop list shows all test plans available for the current file and in the active project.
These plans can also be started from the Tools|Test menu.
Project-specific test plans can be run by right-clicking on the project to bring up the context menu, then selecting the test plan from the Test sub-menu.
Version 4.3 of Komodo allowed the creation of global test plans. Since these are almost always associated with specific files, version 4.4 has replaced global test plans with file-specific ones.
To copy or move a global test plan into the current document's preferences, select Tools|Test|Move Global Test Plans to Document. This opens the "Import Global Test Plans" dialog. Select the desired test plans and click Move (deletes the global test plans), or Copy (leaves them available for other documents).