mercredi 23 septembre 2020

Skip multi tests in Xcode

I'm writing unit tests in my Swift app.

I have tests that i want to skip over, using the flag shouldSkip, something like -

if shouldSkip {
     throw XCTSkip()
}

The problem is - I don't want all the tests to have to write this line over and over + all the skipped test needs to be marked as "skipped" (the gray arrow, NOT pass or fail).

So I thought about override invokeTest or using the setup to skip all the tests when the flag in true, something like -

override func setUp() {
        
        if shouldSkip {
          throw XCTSkip()
        } 
        super.setUp()
}

but i couldn't make the tests to be marked as skipped (only pass or fail)

Any ideas on how to skip (and mark as skipped) a bulk of tests (in the same file or not)?

I know about test plans and schemes but i need the tests to run and be skipped in oppose to not running the tests.

Aucun commentaire:

Enregistrer un commentaire