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

Timeouts for unit tests #59

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

Timeouts for unit tests #59

thekid opened this issue Oct 17, 2011 · 2 comments

Comments

@thekid
Copy link
Member

thekid commented Oct 17, 2011

Scope of Change

A timeout facility will be added to unit tests. When a test runs longer
than the time span defined by the timeout facility, the test will be
marked as timeouted.

Rationale

Integration tests that test certain system parts such as an LDAP server
might want to test not only that accessing the server works but also
that a query succeeds in a certain time.

Functionality

A test can be annotated with the @limit annotation as follows:

<?php
  class LdapIntegrationTest extends TestCase {

    #[@test, @limit(time= 1.0)]
    function lookup() {
      // ...
    }
  }
?>

Test failure message:

<?php
  util.profiling.unittest.AssertionFailedError (Timeout) { 
    expected: ["0.100"] but was: ["0.201"] 
  }
?>

Security considerations

n/a

Speed impact

Minimal overhead for checking the existance of the @limit annotation.

Dependencies

n/a

Related documents

@thekid thekid closed this as completed Oct 17, 2011
@thekid
Copy link
Member Author

thekid commented Oct 17, 2011

Maybe for timeout we should not have TestFailure as result but
TestTimeout to be able to distinguish?

friebe, Tue, 20 Jun 2006 16:27:39 +0200

@thekid
Copy link
Member Author

thekid commented Oct 17, 2011

Based on discussion with the PHP-Dev team and Frank Kleine of
Schlund+Partner, we decided to name the annotation @limit which
is a more generic name for this and may be enhanced in the future
to support @limit(memory= ...) etc.

friebe, Mon, 26 Jun 2006 16:23:00 +0200

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