X

Codeception support added

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.

Requirements

Codeception 2.1 or newer.

Configurations

At first, let's set the Options for Codeception.

Options for Codeception

Next, to enable the Codeception, please select it and your test directories in your project properties.

Enable Codeception

You can also set some configurations per project.

Configurations for Codeception per Project

Run tests

Your tests are run from a context menu of your project and you can review the results using in the Test Results window:

Test Results

Code Coverage

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.

Enable Code Coverage

Show report for code coverage. Right-click the project node and select Code Coverage > Show Report...

Show Report for Code Coverage

See tested lines in files.

Tested Lines for Code Coverage

Debugging

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.

Debugging

Create Tests

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.

Create Tests Dialog
Create Test Dialog

Run Commands

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.

Run Commands

Additional Parameters

You can use this option if you want to specify the group(s) and the env(s) when you run tests.

Additional Parameters for Run Tests

Issues

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.

Join the discussion

Comments ( 2 )
  • guest Tuesday, August 4, 2015

    Wait, there's no NetBeans 8.1

    Do you happen to mean 8.0.1?


  • Tomas Mysik Monday, August 17, 2015

    @guest: No, I meant 8.1 (the current development version, currently Beta released).


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services