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

tester tries to run non-existing test methods #61

Closed
paranoiq opened this issue Dec 8, 2013 · 7 comments
Closed

tester tries to run non-existing test methods #61

paranoiq opened this issue Dec 8, 2013 · 7 comments

Comments

@paranoiq
Copy link

paranoiq commented Dec 8, 2013

class Test {

/*
    public function testSomething() // it will try to run this
    {
        ///
    }
*/

}
@milo
Copy link
Member

milo commented Dec 8, 2013

How do you run it? I tried the most simple case and nothing happend. Tester takes methods by reflection.

use Tester\Assert;

require __DIR__ . '/bootstrap.php';  # from Tester libs

class Test extends Tester\TestCase {

/*
    public function testSomething() // it will try to run this
    {
        ///
    }
*/

}

$t = new Test;
$t->run();

EDIT: I guess you run it manually by $t->run('testSomething').

@paranoiq
Copy link
Author

paranoiq commented Dec 8, 2013

TestHandler runs it and this is the reason: https://github.com/nette/tester/blob/master/Tester/Runner/TestHandler.php#L145

@dg
Copy link
Member

dg commented Dec 11, 2013

This (and #62) should be solved in initiateTestCase():

  1. by running testcase with special argument that returns list of methods
  2. by parsing file via tokenizer

I think 1) is better solution.

@milo
Copy link
Member

milo commented Dec 11, 2013

Choice 1) seems better, but because of TestCases with constructor, new static method would be better. On the other side, there is a need to find a descendant of TestCase class name. It can be done by regexp, but tokenizer is better. And when the tokenizer is used, it can be used for all.

@milo
Copy link
Member

milo commented Dec 15, 2013

@dg What about 3) option: Set TESTER_LIST_TEST_METHODS environment var, and TestCase::run() prints serialized methods and die.

@fprochazka
Copy link
Contributor

Evironment variable is actually a great idea :)

@milo
Copy link
Member

milo commented Dec 15, 2013

In addition, by expecting an output of TestCase::run() in pre-run phase can be checked that method has been called at all :)

milo added a commit to milo/tester that referenced this issue Jan 7, 2014
milo added a commit to milo/tester that referenced this issue Jan 7, 2014
@milo milo mentioned this issue Jan 7, 2014
milo added a commit to milo/tester that referenced this issue Jan 8, 2014
milo added a commit to milo/tester that referenced this issue Jan 8, 2014
@milo milo closed this as completed in 96b192c Jan 9, 2014
milo added a commit to milo/tester that referenced this issue Jan 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants