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

Errors while using @runTestsInSeparateProcesses annotation #1556

Closed
etki opened this Issue Nov 22, 2014 · 4 comments

Comments

Projects
None yet
2 participants
@etki
Copy link
Contributor

commented Nov 22, 2014

Hi, i can't run tests in separate processes, PHPUnit dies telling there is nothing to call ->run() on:

PHPUnit_Framework_Exception: PHP Fatal error:  Call to a member function run() on a non-object in %project home%/vendor/codeception/codeception/src/Codeception/TestCase/Test.php on line 30

(Full output with example as a gist)

tested using codeception 2.0.8 and 2.1.x-dev (dev-master)

@DavertMik

This comment has been minimized.

Copy link
Member

commented Dec 19, 2014

Codeception does not support running tests in separate processes. Looks like the first time someone used this feature of PHPUnit )

@etki

This comment has been minimized.

Copy link
Contributor Author

commented Dec 19, 2014

@DavertMik that's a pity, it's an essential feature to run isolated tests in tightly coupled systems

@DavertMik

This comment has been minimized.

Copy link
Member

commented Dec 19, 2014

PHP does not support threading. So there is no clean way to do isolation for testing. The way PHPUnit does it looks ugly to me. It starts new processes by generating PHP file from a template and executing external PHP command in it, and parsing output. Unfortunately this makes its architecture a complete disaster.

@DavertMik DavertMik closed this Dec 19, 2014

@etki

This comment has been minimized.

Copy link
Contributor Author

commented Dec 19, 2014

@DavertMik

PHP does not support threading. So there is no clean way to do isolation for testing.

Well, the only way to provide complete isolation is to run test in separate process. Tightly coupled systems usually are complete disaster at all stages and can enworse your life in funny ways. One of my particular tasks was to test both Yii 1.x console and web applications, and Yii allows only one application at a time, and provides static access to it. If we were on Java, for example, the question would be in place as well. Threading is usually done just to speed up tests.

There is Spork that provides easy interface for forks - quite not the same as threads and just not the same as separate process, of course, but allows creating new relatively-clean environment for the process.

I'd love to say i'd look in it and try to implement it myself, but i'm afraid, i will never have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.