Skip to content

add keyword to explicitly skip a test #812

Closed
Closed

Description

@spooning

Originally submitted to Google Code by bryan.oakley on 1 Apr 2011

It would be nice if there was a keyword that would skip a test under certain conditions. For example "Skip" would simply skip the remainder of the test. Another example would be a "Skip if" keyword, that works like "Run keyword if" keyword. This would skip the test only under certain conditions (eg: skip if | ${featureA} != "enabled")

Use cases:

One use case is for testing robot itself (or robot libraries) -- both test cases and test data in the form of other test cases could be in the same suite. Test cases used as test data could have their first statement as "Skip" so that they don't actually run. Then, robot could write tests using those cases, such as making sure they parse ok, etc.

As a real world example, we're writing a tool that can run a test suite through a set of rules to measure the quality of the suite or to certify that the suite is ready to be committed to ci (for example, no duplicate names, every test must have a tag that identifies a defect or story id, etc). This skip feature would be useful for writing test suites that test this functionality.

Another use case is for dynamically skipping tests. For example, if a smoke test fails you could set a flag so that subsequent tests of a module aren't run. Or, you could determine at runtime which portions of a system under test are configured or online or whatever, and skip those that aren't. For example, if a suite of tests required the services of a networked device and it wasn't online, those tests could be skipped.

It would be best if Robot could support the status of "Skip" in addition to "Pass" and "Fail". If that's not possible I think it could have one of three behaviors; not sure which would be best:

  1. the skipped test simply wouldn't appear in the report. It would be as if it had a tag that was in the ignored tags list.

  2. the skipped test could show up on the report as passed, with a message of "skipped" or "skipped; condition '${feature!} != "enabled" not met'

  3. the skipped test could show up on the report as failed, but it could automatically be flagged as non-critical so that it doesn't fail the whole suite

Activity

  1. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 1 Apr 2011

    Adding separate Skip status would be rather big task requiring changes to reports, logs, etc. It would have a benefit that we could allow showing tests that are skipped with --include/--exclude in reports too, though. Comments to other possibilities you listed below:

    1. I don't like tests vanishing altogether. This would also be quite hard to implement because at this point something has already been written to XML output, listeners have been notified, etc.

    2. The same functionality would be got with Pass keyword proposed in issue 174 . I don't think it makes sense to implement both Pass and Skip that just passes the test.

    3. This is already nowadays possible by failing a test after setting some non-critical tag to it with Set Tags keyword. We've actually used this approach few times, which also shows that there's general need for skipping.

  2. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 27 Apr 2011

    Skipping tests is pretty much a duplicate of issue 174 . A separate issue can be submitted about adding the new Skip status.

  3. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by MMKashiw... on 16 Dec 2013

    Need to report which tests are skipped, as Fitnesse does. Whether this is done as a separate status, or just falls out from tag processing is not important, in my situation. We need to know when changes to --include/--exclude tags cause tests to inadvertently be excluded, how much of our total "test load" is active, and if there is any "dead wood" that can be excised from out test suite.

  4. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by mathias.demare on 16 Feb 2014

    Reporting tests that are skipped (some kind of separate overview) would indeed be useful.

    I like to create a few failing tests to define requirements, skip these tests, and then work on making them work one by one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions