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

Marking test as skipped will prevent execution of all subsequent tests #379

Closed
trebi opened this issue Nov 28, 2017 · 3 comments
Closed

Comments

@trebi
Copy link
Contributor

trebi commented Nov 28, 2017

  • bug report? yes
  • feature request? no
  • version: 2.0.0

Description

If test is marked as skipped, all subsequent tests will not execute.

Steps To Reproduce

  1. Create file
<?php declare(strict_types=1);

namespace Tester\BugReport;

use Tester\Assert;

require __DIR__ . '/../bootstrap.php';

/** @TestCase */
final class BugReportTest extends \Tester\TestCase
{
	public function testSkip(): void
	{
		\Tester\Environment::skip();
	}


	public function testFail(): void
	{
		Assert::true(false);
	}
}

(new BugReportTest)->run();
  1. Run the file, the output will be:
Skipped:


Process finished with exit code 177

giving no indication that second test is failing. Such behaviour causes that I prefer commenting out the test rather than makring it as skipped.

BTW if you swap the order of the tests, it will execute the failing test and fail as expected, which is inconsistent behaviour. Order of methods should never matter.

@milo
Copy link
Member

milo commented Nov 28, 2017

If you run this test by Tester, you'll get two results: sF That's correct. One skipped, one failed. Every test method runs in own separated process.

But if you run it as php test.phpt, the @TestCase is ignored (as mentioned in doc), and all test methods run one by one in one process, so you get only one result.

You can try:

php test.phpt --method testSkip
php test.phpt --method testFail

@trebi
Copy link
Contributor Author

trebi commented Nov 28, 2017

Thanks for reply, but I think it would be handy that even in "serial mode" it would run all the tests until the first real failure (skip is not really a failure), or you will be sure that all tests have passed.

@milo milo reopened this Nov 28, 2017
@milo
Copy link
Member

milo commented Jan 2, 2021

I hope solved by #380

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

2 participants