question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

way to exit a given test if a test case fails and carry on with other test suites

See original GitHub issue

description of the problem:

Currently, the --exitonfailure CLI option allows you to exit a test with failures if a test case fails. This however doesn’t work when you are running multiple robot tests at once (such as in CI). If you are using the --exitonfailure option and a given test fails, the remaining tests will also fail. I want to run a test suite and exit a given test if a test case fails and carry on with the rest of the suites that need to run. This would benefit from finding test failures quicker and reducing the time RF tests take to run in CI. It would be nice to be able to exit a given test if an assertion fails and carry on with any remaining tests in the suite.

proposed solution:

Add a CLI option that allows a user to exit a given test if an assertion fails and carry on with any remaining tests in the suite.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
pekkaklarckcommented, Aug 2, 2021

It’s true there’s no way to stop the current suite when tests are running and continue from the next one. If a failure occurs in suite setup, tests in that suite aren’t run, but there’s no direct way to accomplish this when tests in the suite are already running. --exitonfailure stops the whole execution and Fatal Error keyword works the same way.

Something like this has been requested already earlier (there may even be an issue about it but I don’t have time to search right now). I think the proposal was to add a keyword like ´Fatal Errorthat stops the current suite and I think that's a more flexible solution than a command line option. A benefit of a keyword would be that it could be configured to tell from which suite level to continue. For example, if you have a suite structure like below and are running suite1.1, you may want to continue from suite1.2 or from mid suite 2. Possibly we could just enhanceFatal Error` to accept such configuration.

                 root suite
              /              \ 
     mid suite 1             mid suite 2
    /           \           /           \
suite1.1    suite1.2    suite2.1    suite2.2

0reactions
luke-h1commented, Oct 11, 2021

As an update on this issue, we managed to produce a workaround that exits a test as soon as a given test case fails via injecting a custom python script that runs as part of Test Setup. You can view the full implementation here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exit Test Suite if a particular test fails, but run other test suites
go - Exit Test Suite if a particular test fails, but run other test suites - Stack Overflow. Stack Overflow for Teams –...
Read more >
Stopping Test Suite execution if Test Case fails
Suppose you have to login and then perform some Test case. you can first create a test case where login will happen and...
Read more >
how to stop a test suite if one method fails
That should stop all tests if it fails. You could also create a set of validation @Test methods and put them in a...
Read more >
If a test case fails, how to close the browser and move ...
You should design your test cases to be independent, because modularity decreases complexity: If tests are dependent, you would ...
Read more >
Jest — Fail Early (And Stop Testing If One Test Fails)
It can be helpful to stop large test suites as soon as an error occurs. Stopping the test run after the first failed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found