Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between test suite and test group?

What's the difference between test suite and test group? If I want to organize my unit tests in phpunit.xml in groups of tests (i.e. groups of directiories), e.g. tests for specific application module.

  • How should the phpunit.xml look like to utilize groups and test suites?
  • How to run specific group/test suite from the command line?

Similar question:

  • PHPUnit - Running a particular test suite via the command line test runner

PHPUnit manual about test suites and groups in xml configuration:

  • http://www.phpunit.de/manual/3.4/en/appendixes.configuration.html
  • http://www.phpunit.de/manual/current/en/organizing-tests.html

How to configure the groups in phpunit.xml, that phpunit --list-groups showed them?

like image 278
takeshin Avatar asked Mar 15 '11 10:03

takeshin


People also ask

What is difference between test suite and test case?

A test case answers the question: What am I going to test? You develop test cases to define the things that you must validate to ensure that the system is working correctly and is built with a high level of quality. A test suite is a collection of test cases that are grouped for test execution purposes.

What is difference between test suite and test plan?

A test suite is a set of test cases which are logically connected. Eg: test cases which test the same functionality of an app. A test plan is plan how you want to execute your tests to reach your desired test coverage.

What means test suite?

In software development, a test suite, less commonly known as a validation suite, is a collection of test cases that are intended to be used to test a software program to show that it has some specified set of behaviors.

What is test suite example?

For example, you can have a test suite for smoke testing, a suite for API testing, a suite for mobile testing, and a suite each per module like a User module test suite, a Task module test suite, etc. Test suites also help gauge the progress of underlying test cases during execution.


1 Answers

Test suites organize related test cases whereas test groups are tags applied to test methods.

Using the @group annotation you can mark individual test methods with descriptive tags such as fixes-bug-472 or facebook-api. When running tests you can specify which group(s) to run (or not) either in phpunit.xml or on the command line.

We don't bother with test suites here, but they can be useful if you need common setup and teardown across multiple tests. We achieve that with a few test case base classes (normal, controller, and view).

We aren't using groups yet, either, but I can already think of a great use for them. Some of our unit tests rely on external systems such as the Facebook API. We mock the service for normal testing, but for integration testing we want to run against the real service. We could attach a group to the integration test methods to be skipped on the continuous integration server.

like image 66
David Harkness Avatar answered Sep 23 '22 18:09

David Harkness