Swift UI Test appropriate case

84 Views Asked by At

I'm a beginner in UI testing. I have some questions.

I want to try two UI tests.

-Scenario-

When the app is launched and not logged in, the login screen appears. If I log in from the login screen, it closes, and nothing happens. If I close it without logging in, the 'A' screen appears.

func test_try_login() {
    Enter the ID
    Enter the password
    Attempt to log in (tap the login button)
}

func test_login_close() {
    Tap the close button on the login screen
    (The 'A' screen appears)
    Perform a certain action on the 'A' screen
}

The problem is, when I write and run the test code for scenario 1, the app gets logged in, and then I can't test scenarios 1 and 2 again because I'm already logged in. To check the login status, I need to look for the 'account' file in the library path. However, the actual app has a different target, so I can't access the library path.

Here are my questions:

  1. Are the two scenarios I want to test appropriate for UI testing?

  2. If they are appropriate for UI testing, how can I check for the existence of the 'account' file in the library path and delete it? Can I use an App group?

  3. If they are not appropriate for UI testing, should I skip testing these two scenarios, or should I test them using unit tests?

0

There are 0 best solutions below