Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests metadata #20

Closed
thekid opened this issue Oct 17, 2011 · 0 comments
Closed

Unit tests metadata #20

thekid opened this issue Oct 17, 2011 · 0 comments

Comments

@thekid
Copy link
Member

thekid commented Oct 17, 2011

Scope of Change

The unit testing API will make use of the new metadata facility described
in xp-framework/rfc #16.

Rationale

Instead of having to having to rely on method names beginning with the
string "test" or having to supply all test methods from "the outside",
test methods can be simply marked with the annotation @test.

Functionality

Basic usage

The "test" tag is used to identify methods to be used as a test. This
attribute tells the framework that a particular method in the test case
is to be run during the unit testing phase.

Example:

<?php
  class ParserTest extends TestCase {

    #[@test]
    function tokenOrder() {
      // ...
    }
  }
?>

Ignoring certain tests

Sometimes when a unit test is not ready for testing, it is good to ignore
that test while still being able to run the other tests. To that end, it
is allowed to set an @ignore attribute on a test method. Just as the name
would imply, this attribute will cause the method or class to be ignored
when the unit tests are run.

Example:

<?php
  class ComplexNumbersTest extends TestCase {

    #[@test]
    function testAddition() {
      // ...
    }

    #[@test, @ignore('Not yet implemented')]
    function testDivision() { }
  }
?>

Dependencies

Related documents

@thekid thekid closed this as completed Oct 17, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant