nette / tester

Tester: enjoyable unit testing in PHP with code coverage reporter. 🍏🍏🍎🍏
https://tester.nette.org
Other
464 stars 71 forks source link

Run testcase method separately with Dataprovider #166

Closed hrach closed 10 years ago

hrach commented 10 years ago

Would be very useful when adding @dataprovider would still run test methods separately. Or, at least, it could create new testcase instance.

milo commented 10 years ago

Do you mean @dataProvider for test file or for TestCase's method?

hrach commented 10 years ago

for testFile.

milo commented 10 years ago

In 1.2.0, you can use @dataProvider and @testCase annotations simultaneously. And you get count(dataProvider) * count(TestCase methods) standalone processes.

Commit, Blog (one of last paragraph).

So I think it should work as you wrote, or I didn't undestand.

hrach commented 10 years ago

Yay! I have both! Going investigate! Is there something what I should check?

milo commented 10 years ago

I'm not sure. This example should create 4 processes and it creates for me. Don't you have a typo in annotation?

; test.ini
[one]

[two]
<?php

/**
 * @testCase
 * @dataProvider test.ini 
 */ 

use Tester\Assert;

require __DIR__ . '/bootstrap.php';

class MyTest extends Tester\TestCase
{
    public function testOne()
    {
        Assert::true(TRUE);
    }

    public function testTwo()
    {
        Assert::true(TRUE);
    }

}

(new MyTest)->run();
hrach commented 10 years ago

Please, see this:

and yes, it creates just 2 processes (2 dots)... see https://github.com/nextras/orm/blob/5258e54b6cbab5d15931d198e7373cf70a2555a1/tests/cases/integration/NetteDatabase/relationships.manyHasMany.1.phpt, it has correct annotation.

hrach commented 10 years ago

probably missing something...

milo commented 10 years ago

https://github.com/nextras/orm/commit/5258e54b6cbab5d15931d198e7373cf70a2555a1#commitcomment-7687939

hrach commented 10 years ago

Thank you!