Skip to content

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

Closed

Description

@trebi
  • 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.

Activity

  1. milo commented on Nov 28, 2017

    @milo
    Member

    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
    
  2. trebi commented on Nov 28, 2017

    @trebi
    ContributorAuthor

    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.

  3. reopened this on Nov 28, 2017
  4. milo commented on Jan 2, 2021

    @milo
    Member

    I hope solved by #380

  5. added a commit that references this issue on Jan 20, 2021
    a8e9c05
  6. added 3 commits that reference this issue on Jan 31, 2021
    d09fdf1
    ba8a258
    05ebbce
  7. added 3 commits that reference this issue on Mar 1, 2021
    1e03f6a
    1b5ee71
    8a4b60d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions