This blog post has been contributed by our NetBeans PHP user Junichi Yamamoto who has created support for Codeception in NetBeans 8.1. He would like to tell you a few words about this new PHP unit testing framework and its support in NetBeans. Thanks, a lot Junichi!
Hi all, today we will show you Codeception support which has been added in NetBeans 8.1 as another PHP testing framework.
If you have used PHPUnit, atoum or Nette Tester in NetBeans IDE, you can use this support the same way as them.
Codeception 2.1 or newer.
At first, let's set the Options for Codeception.
Next, to enable the Codeception, please select it and your test directories in your project properties.
You can also set some configurations per project.
Your tests are run from a context menu of your project and you can review the results using in the Test Results window:
To enable code coverage, you have to add a bit configurations to your configuration file (e.g. codeception.yml, unit.suite.yml). Please refer to the Codeception's web site for details.
Enable code coverage for project.
Show report for code coverage. Right-click the project node and select Code Coverage > Show Report...
See tested lines in files.
Before start with it, you should check the following: How to configure XDebug.
If you are ready, please put breakpoint(s) to your code.Then, open the context menu in the editor for a test file and select Debug file.
Create a test using a generate command (e.g. generate:test).
Open your PHP file in the editor and select Tools > Create/Update Tests.
Then, select a command (e.g. test) and a suite (e.g. unit) in the Create Test dialog.
Run a few commands for Codeception. Supported commands are bootstrap, build and clean.
NOTE: The other commands are currently not supported.
These commands will be available in the project context menu if you enable Codeception in your project.
You can use this option if you want to specify the group(s) and the env(s) when you run tests.
The support is already available in NetBeans development version. Please test it.
If you find some issues or enhancements, please report them to NetBeans Bugzilla (component php, subcomponent Codeception).
Finally, thanks a lot, Tomas! He helped me and gave me some advices when we had some issues.