Xcode 7 UI Test Order

I have several user interface tests that can be successfully run individually or grouped. I ended up breaking tests into specific classes and running them that way. The problem I ran into is that Xcode is performing user interface tests in alphabetical order, not in the order they are written / displayed. Any idea on how to get around this?

thanks

+5
source share
2 answers

A good set of tests should not depend on execution in a specific order. If you do, you may have some kind of test contamination. I would add the general initialization logic (for example, entering the userโ€™s log) the setUp () method of the corresponding tests. Or create a helper method and split it between classes. This, combined with restarting the application for each test, should make the order of your tests inconsequential.

+8
source

XC testing is incredibly difficult. Sometimes it seems that the direction of the wind or the speed of the Earthโ€™s rotation will determine whether you get a random glitch or not. One fix I found to mitigate these annoying problems somewhat if you call it your tearDown () function:

XCUIApplication().terminate() 

Where XCUIApplication () is the application you are working in.

+5
source

Source: https://habr.com/ru/post/1235906/


All Articles