PHPUnitTestGroups

Contents

Issue: 197279 - Run just specific group of tests

Problem:

There's a need to keep test executing as simple as possible. Most of developers don't want to handle test groups selecting dialog everytime they invoke the test action (almost everyone needs a fast response if his/her tests are failing or ok, they don't want to be delayed by clicking and confirming something). That's why I would just add a checkbox (unchecked by default) into Project Properties -> PHPUnit which turns on test groups selecting dialog.

+-+
| | Ask for test groups before running tests.
+-+

Use cases:

Unchecked "ask" checkbox:

+-+
| | Ask for test groups before running tests.
+-+

Running all tests in a project:

  • everything works as expected, that means "as is" nowadays

Running a single test:

  • everything works as expected, that means "as is" nowadays

Checked "ask" checkbox:

+-+
|x| Ask for test groups before running tests.
+-+

Running all tests in a project:

  • fetch actual test groups before test execution (phpunit --list-groups TestSuite.php [another options])
  • parse the output:
    • More then ONE group returned (one should be returned everytime - at least __nogroup__)
      • display dialog with all fetched test groups (__nogroup__ is returned for tests without any group)
			+-------------------------+---------+
			|       Group name        | Test it |
			+-------------------------+---------+
			| No group tests          |         |
			| firstGroup              |    x    |  // tests belonging to "firstGroup" will be executed
			| secondGroup             |         |
			+-------------------------+---------+
			          +----+  +--------+
			          | OK |  | Cancel |  // maybe implement some functionality to check all groups as "run all tests"
			          +----+  +--------+
      • let user check groups which will be tested
      • click OK to run selected test groups
      • save somewhere selected test groups for future use (to pre-check last checked groups in the next test execution)
      • run phpunit with correctly set --group attribute
    • Just ONE group was returned
      • run all tests "as is" nowadays

Running a single test:

  • same flow as for all tests

Possible parameters for running test groups:

  • All tests:
  • Tests without group: --group __nogroup__
  • Tests from one group: --group foo
  • Tests from more groups: --group foo,bar
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo