DependencyLibrary - Skip test if depending test failed

Is it possible to skip a test if depending test failed?

I would like to have a clear difference in my report between true failed tests and failed tests that failed due to depending test failure, maybe mark them as skipped.

Also, is it possible to add multiple dependencies? One test to depend on several tests?

You can manage this with Tags. Your failed test can set a special tag for you to analyse in the setup of dependent test case.
I think :tm: that a variable with the last test execution state, is also set. You can try to see Log Variablesat the setup of the dependent test case.

I also think :tm: that you can define in the command line a certain tag to skip tests when it is set.

2 Likes

Have you tried the robotframework-dependencylibrary?

2 Likes

Yes. This answers my second question.

Thanks!

1 Like

Log Variables is rally helpful. Thanks a lot!

I found previous test execution variables:
${PREV_TEST_MESSAGE}} = TimeoutError: locator.waitFor: Timeout 10000ms exceeded.
${PREV_TEST_NAME} = Test1
${PREV_TEST_STATUS} = FAIL

This could help me if my depending test is the previous one, but this is not the case.

I found this variable:
&{OPTIONS} = { include= | exclude= | skip= | skip_on_failure= }

I suppose this is on suite level and I can add some tags here in the middle of execution?

Have you used this skip on failure option? I found some info on github but have no idea how it works.

Regarding skip-on-failure, while I have not used it myself (though I have used exit-on-failure): you can find more information here and here.

These are built-in tags that you can add to your test cases or keywords, as well as set from the CLI.

3 Likes

Have you used this skip on failure option?

I have not used the feature before. Like @FrancisG mentioned, our source of knowledge is the official User Guide and other docs, from Robot Framework documentation

2 Likes