why testing failed test cases code example
Example 1: how to run failed test
- I use a cucumber plugin that is called "rerun",
which allows me to run ONLY failed test cases.
- How did I achieve that is:
- I created a second runner class and
name it FailedTestRunner which dedicated
to running only failed scenarios.
- Let's say I have 100 tests running in the
first run and ten of those tests are failed.
- If we implemented "rerun" structure correctly,
all of the failed tests are going to be
stored in "rerun.txt"
- Our "FailedTestRunner" class will be pointing
to "rerun.txt", and when we run it,
it will only run those failed tests.
Example 2: why testing failed test cases
-> Why we would want to rerun the failed test cases?
- If a bunch of tests are failing from a
big regression suite, we don't want to
rerun the whole suite again.
-> Therefore we just re-run the failed tests to
make sure those tests are actually failing and
it is not a syncronization issue