MakeGood User Guide¶
This user guide describes the versions from MakeGood 0.7.0 to MakeGood 1.2.0.
English | 日本語
- MakeGood User Guide
- Installation
- Running Tests
- Configuration
- Testing Framework Specific Configuration
- Notes
- Known Issues
Installation¶
Installing Prerequisite Software¶
The following software are required to run MakeGood.
- PHP 5.2.0 or greater
- Zend Debugger or Xdebug
- Eclipse Helios (3.6) or Eclipse Galileo (3.5)
- PDT 2.2 or 2.1
- (optional) Stagehand_TestRunner 2.15.0 or greater
- (optional) PHPUnit 3.4.1 or greater
- (optional) SimpleTest 1.0.1 or greater
- (optional) CakePHP 1.3 or 1.2
Install these software refer to the following sites:
- PDT/Installation
- Xdebug: Documentation
- Eclipse PHP Development Tools - Zend.com
- Stagehand_TestRunner - A test runner for Test Driven Development - Piece Framework
- Chapter 3. Installing PHPUnit
- Preparing for testing :: Testing :: Common Tasks With CakePHP :: The Manual :: 1.3 Collection :: The Cookbook
NOTE: Zend Debugger for PHP 5.3 is included in Zend Server Community Edition.
NOTE: Also take a look at the known issue Can't add nested directories to the include path.
Installing MakeGood¶
First, launch your Eclipse and select Help -> Install New Software... from the menu bar. Next, click the Add... button and register the following update site:
| Name | An arbitrary string or empty |
| Location | http://eclipse.piece-framework.com/ |
And, select the feature of MakeGood and click the Next > button.
Next, click the Finish button. Therefore, the installation is started. The dialog for the certificate will be displayed in the middle of the installation process, click the Select All button, and click the OK button.
When the installation is completed, the dialog will be displayed that recommends to restart Eclipse, and click the Yes button. Therefore, Eclipse is restarted and the installation is done.
Configuring a PHP Executable¶
Since MakeGood uses a PHP executable which is already defined in PDT, you should configure at least one PHP executable.
First, select Window -> Preferences... from the menu bar, and select PHP -> PHP Executables. Next, click the Add... button and configure a PHP executable.
Next, click the Finish button, and select PHP -> Debug from the side menu. Next, configure Default Settings as the following:
| PHP Debugger | Zend Debugger or XDebug |
| Server | (any) |
| PHP Executable | (A PHP executable you want to use.) |
Running Tests¶
NOTE: Also take a look at The Conventions for Test Files.
Runs all tests when a file is saved.¶
NOTE: To enable this feature, test folders should be specified in project properties. For more information, see Specifying the Test Folders.
Runs all tests automatically when a file is changed/added/removed in the workspace. If a file is changed outside of the workspace, run tests when the workspace is synchronized.
To enable this feature, click the Run All Tests when File is Saved button on the MakeGood view so that the button is pushed in.
NOTE: Whether this feature is enabled by default is determined by the value of the configuration parameter Configuring the Default Value for the feature "Runs all tests when a file is saved.".
Runs all tests.¶
NOTE: To enable this feature, test folders should be specified in project properties. For more information, see Specifying the Test Folders.
Runs all tests which are included in the specified test folders.
Runs all tests from the PHP Explorer and Package Explorer.¶
Selects any resource in the PHP Explorer/Package Explorer and runs all tests.
To run all tests, select a resource, and select Run all tests from the context menu.
Runs all tests from the PHP Editor.¶
Runs all tests from the active editor.
To run all tests, do right click in the editor, and select Run all tests from the context menu.
Runs tests from the PHP Explorer and Package Explorer.¶
Selects any resource in the PHP Explorer/Package Explorer and runs tests.
To run tests, select a resource, and select Run Tests For from the context menu.
Click here to see the original size.
After the test run is done, the test results are displayed to the MakeGood view.
Click here to see the original size.
The following resources are available:
- Folder
- File
- Class (PHP Explorer only)
- Method (PHP Explorer only)
NOTE: The dialog to select the preload script is displayed only when it is the first time that you run tests in the project. The preload script makes preparations for a test run, which are the include path, autoloading, and error handling, etc. It is evaluated before the test runner body is loaded. If you do not use the preload script, leave empty and click the OK button. For more information, see Using a Preload Script.
Runs tests from the PHP Editor.¶
NOTE: The dependencies of the current editing file should be resolved on Eclipse by user libraries etc. for the following features to work. Especially the resolution of the inheritance hierarchy of a test class (e.g. if your project uses PHPUnit, the hierarchy to PHPUnit_Framework_TestCase) is required.
Runs tests from the active editor.
To run tests, do right click in the editor, and select Run Tests For or Run Tests Related to This File from the context menu.
Click here to see the original size.
Run Tests For has the three sub menus Context, Class, File, which are activated if the current editing file is test code, and these have different behaviors.
Run Tests Related to This File runs tests that are related to the classes that are included in the current editing file, and all its subclasses. This command can be run even though the current editing file is production code.
These behaviors are summarized as follows:
In case of editing test code
| Command | Tests which will be run |
|---|---|
| Run Tests For - Context | Tests which are included in the minimal element at the cursor's position (a method or class or file) |
| Run Tests For - Class | Tests which are included in the class at the cursor's position |
| Run Tests For - File | Tests which are included in the file |
| Run Tests Related to This File | Tests which are included in the class(es) and all its subclasses |
In case of editing production code
| Command | Tests which will be run |
|---|---|
| Run Tests For - Context | n/a |
| Run Tests For - Class | n/a |
| Run Tests For - File | n/a |
| Run Tests Related to This File | Tests that are related to the classes and all its subclasses |
Debugs a test.¶
There are two operation modes for MakeGood, Run Mode and Debug Mode. When the current operation mode is Run Mode, a test is simply run. When Debug Mode, a test is run in the debugger.
To debug a test, click the Debug Test button on the MakeGood view so that the button is pushed in. While The button is being pushed, tests are run in the debugger.
Click here to see the original size.
Reruns the last test.¶
Reruns the previously running test.
NOTE: A test which was run by Runs all tests when a file is saved. is not a target.
To rerun the last test, click the Rerun Test button on the MakeGood view.
Stops the test run.¶
Stops the test run in progress.
To stop the test run, click the Stop Test button on the MakeGood view.
Stops on the first failure or error.¶
Stops the test run when the first failure or error is raised.
To enable this feature, click the Stop on Failure/Error button on the MakeGood view so that the button is pushed in.
Configuration¶
Configuring the Default Value for the feature "Runs all tests when a file is saved."¶
This parameter is used to determine whether or not the feature Runs all tests when a file is saved. is enabled by default. This parameter is enabled by default.
To enable/disable this parameter, configure the preferences for the workspace as the following:
- Open the preferences.
- Select MakeGood.
- Click the check box Run all tests when a file is saved..
Using the System Include Path¶
In PDT PHP executables, the include path which is defined by the PHP ini file is destroyed, and the include path for the project is activated instead.
In MakeGood, the include path can be used explicitly which is defined by the PHP ini file. The configuration process is as the following:
- Open the properties for the project.
- Select PHP Include Path.
- Click the Add the System Include Path button.
NOTE: If using the system include path, PROJECT NAME/.project is displayed at the PHP Include Path on the PHP Exprorer.
Using a Preload Script¶
A script can be specified which makes preparations for a test run, which are the include path, autoloading, and error handling, etc. It is evaluated before the test runner body is loaded.
See a real-world example. The following is a preload script of Stagehand_TestRunner a product of Piece Framework which is used as the backend of MakeGood.
<?php
if (defined('E_DEPRECATED')) {
error_reporting(E_ALL & ~E_DEPRECATED);
} else {
error_reporting(E_ALL);
}
set_include_path(realpath(dirname(__FILE__) . '/../examples') . PATH_SEPARATOR .
realpath(dirname(__FILE__) . '/../src') . PATH_SEPARATOR .
get_include_path()
);
require_once 'PHPUnit/Framework.php';
require_once 'Stagehand/Autoload.php';
$loader = Stagehand_Autoload::legacyLoader();
$loader->addNamespace('Stagehand');
Stagehand_Autoload::register($loader);
Stagehand_LegacyError_PHPError::enableConversion();
To use a preload script, configure the properties for the project as the following:
- Open the properties for the project.
- Select MakeGood.
- Specify the Preload Script.
If you do not use a preload script, empty the textbox.
Selecting a Testing Framework¶
MakeGood supports PHPUnit, SimpleTest, and CakePHP (MakeGood >= 1.1.0). you can select which frameworks to use in the project. The default is PHPUnit.
To select a testing framework, configure the properties for the project as the following:
- Open the properties for the project.
- Select MakeGood.
- Specify the Testing Framework
Specifying the Test Folders¶
Specify the folders to be tested by Run all tests.
To specify the test folders, configure the properties for the project as the following:
- Open the properties for the project.
- Select MakeGood.
- Edit Test Folders using the Add Folder or Remove button.
Key Bindings¶
To run commands from keyboard, shortcut keys can be assigned to the MakeGood commands.
First, select Window -> Preferences... from the menu bar, and select General -> Keys. Next, type makegood into the textbox where type filter text is displayed. Next, configure key bindings.
The Default Key Bindings¶
The default key bindings for MakeGood comamnds are as follows:
| Command | Binding | When |
|---|---|---|
| Run All Tests | Alt+M A | In Windows |
| Rerun Test | Alt+M R | In Windows |
| Stop Test | Atl+M S | In Windows |
| Run All Tests when File is Saved | Alt+M U | In Windows |
| Debug Test | Alt+M B | In Windows |
| Stop on Failure/Error | Alt+M E | In Windows |
| Next Failure/Error | J | In MakeGood View |
| Previous Failure/Error | K | In MakeGood View |
| Show Only Failures/Errors | F | In MakeGood View |
| Run Tests For Context | Alt+M C | Editing PHP source |
| Run Tests For Class | Alt+M L | Editing PHP source |
| Run Tests For File | Alt+M F | Editing PHP source |
| Run Tests Related to This File | Alt+M D | Editing PHP source |
| Run Tests For | Alt+M X | In Windows |
| Show View (View: MakeGood) | Views |
Testing Framework Specific Configuration¶
PHPUnit¶
(MakeGood >= 1.1.0)
Configuring the PHPUnit Runtime Environment by the XML Configuration File¶
The PHPUnit runtime environment can be configured by the XML configuration file.
To specify your XML configuration file, configure the properties for the project as the following:
- Open the properties for the project.
- Select MakeGood.
- Specify the XML Configuration File.
For more information about the format of the XML configuration file, see PHPUnit Manual - Appendix C. The XML Configuration File.
NOTE: The <testsuites> element and <selenium> element are not supported.
NOTE: Also take a look at the known issue Relative paths in a PHPUnit XML file do not work.
CakePHP¶
(MakeGood >= 1.1.0)
Specifying the Path of your App Folder¶
By default, the app folder under the project root folder is used as the path of your app folder.
To specify the path of your app folder, configure the properties for the project as the following:
- Open the properties for the project.
- Select MakeGood.
- Specify the app Folder.
Specifying the Path of your CakePHP Libraries Folder¶
By default, the cake folder under the parent directory of your app folder is used as the path of your CakePHP libraries folder. (/path/to/app/../cake)
To specify the path of your CakePHP libraries folder, configure the properties for the project as the following:
- Open the properties for the project.
- Select MakeGood.
- Specify the CakePHP libraries folder.
Notes¶
The Conventions for Test Files¶
Test files must conform to the following conventions:
| PHPUnit | SimpleTest | CakePHP | |
|---|---|---|---|
| File Names | FooBarTest.php or FooBarTestCase.php | foo_bar.test.php | |
| Class Names | FooBarTest or FooBarTestCase | ||
| The Superclass | PHPUnit_Framework_TestCase | UnitTestCase or WebTestCase (MakeGood >= 1.1.0) | CakeTestCase or CakeWebTestCase |
The Console View and Focusing¶
Whether the Console view gets focused when data is written to standard out and standard error is determined by the following two configuration parameters in the Run/Debug -> Console preference page.
- Show When Program Writes to Standard Out
- Show When Program Writes to Standard Error
The above parameters are temporarily disabled while running a test by MakeGood, and the focus will not to be moved to the Console view.
Known Issues¶
Additional INI files are not loaded.¶
The Eclipse PDT team decided to introduce the -n option to fix the Bug #324073. So only php.ini from /tmp/zend_debug/... has been loaded, and all additional INI files have not been loaded.
This has been introduced since PDT 2.2.0 M201010110334 (2010/10/11).
For more information, see Issue #242.
Relative paths in a PHPUnit XML file do not work.¶
(MakeGood == 1.1.0)
See Issue #240.
No output to the Debug Output view when running a test with Xdebug.¶
This is a known behavior of PDT. This problem occurs when the current operation mode is Run Mode.
Incomplete output of the Console view when running a test with Xdebug.¶
This is a defect of PDT. For more information, see the following page.
Bug 282997 - Run As -> PHP Script: incomplete output
The location where standard output and standard error are redirected to is different by the debugger and current operation mode as follows:
The current operation mode is Run Mode:
| Debugger | Console | Debug Output |
|---|---|---|
| Zend Debugger | standard error, debug information | standard output |
| Zend Debugger without debug information | standard output, standard error | - |
| Xdebug | standard output, standard error | - |
The current operation mode is Debug Mode:
| Debugger | Console | Debug Output |
|---|---|---|
| Zend Debugger | standard error, debug information | standard output |
| Zend Debugger without debug information | standard error, debug information | standard output |
| Xdebug | standard output, standard error | standard output |
This defect appears when standard output is redirected to the Console view.
MakeGood fixes this only for Xdebug. Not fixes for Zend Debugger. However, this does not become an issue because standard output is redirected to the Debug Output view, not to the Console view, if your configuratoin uses debug information.
Can't add nested directories to the include path.¶
At the present time, nested directories cannot be added to the include path in PDT.
If the PEAR directory (php_dir) of your environment is /usr/share/php, Stagehand_TestRunner has been located in the directory /usr/share/php/src. And the dependent packages of Stagehand_TestRunner have been located in the directory /usr/share/php.
The following are solutions to this problem:
- Enable the System Include Path and configure the include_path by PHP ini file.
- Configure the include_path by a Preload Script.
- (not recommend) Move the directories in php_dir/src into php_dir.
NOTE: This problem has been reported to the Eclipse project. Bug 296896 - Allow to use the nested directories as libraries.

















