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

Launch failed tests with signature or regex #6609

Open
ccsuperstar opened this issue Nov 30, 2022 · 1 comment
Open

Launch failed tests with signature or regex #6609

ccsuperstar opened this issue Nov 30, 2022 · 1 comment

Comments

@ccsuperstar
Copy link

ccsuperstar commented Nov 30, 2022

What are you trying to achieve?

It's possible to launch a single test with its signature or regex

vendor/bin/codecept run --env myenv tests/Api/MyCest.php:testWithDataprovider#0
vendor/bin/codecept run --env myenv tests/Api/MyCest.php:testByName$ (if you have also testByNameAndId)

But when I want rerun failed tests, and in failed file I have this naming convention

tests/Api/MyCest.php:testWithDataprovider#0
tests/Api/MyCest.php:testByName$

It doesn't work

What do you get instead?

How to run tests with a signature or a regex from the failed file, with the command -g failed

The Filter Class allows to launch the tests with the signature or the regex, but when we pass by the failed file, we don't launch explicitly the test, but a group of tests

This is to "fix" the problem encountered, when more than one failed test matches the test name or more than one test of a test with dataprovider fails, we have in the failed file

tests/Api/MyCest.php:testByName
tests/Api/MyCest.php:testByNameAndId
tests/Api/MyCest.php:testWithDataprovider
tests/Api/MyCest.php:testWithDataprovider
tests/Api/MyCest.php:testWithDataprovider
tests/Api/MyCest.php:testWithDataprovider

And so if we re-run the failed tests, we run we run tests/Api/MyCest.php:testByName, it launch tests/Api/MyCest.php:testByName and tests/Api/MyCest.php:testByNameAndId, after tests/Api/MyCest.php:testByNameAndId again and x times the test with dataprovider and they re-run them all x times

Details

  • Codeception version: 5.0.4
  • PHP Version: 8.1
@Naktibalda
Copy link
Member

There is no x, testWithDataprovider is executed with all values from data provider but they aren't executed multiple times.

There are a few things that could be improved with dataproviders, especially inconsistencies of console output between Test and Cest formats, but none of them are critical.

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