Testing Multiple Buttons [Technical Questions] #18
-
In what area do you have a technical challenge?Xcode, Simulator & Previews DescriptionHello! I was wondering what the proper way is to test two buttons. I have a button leading to an Instagram link and another button leading to a Spotify link. I created a second function to test the Spotify button (because I wasn't sure how to include it in the first), and I was wondering it that is acceptable? My tests pass, but I have to run the two functions separately. I'm also not seeing the simulator when I press run, and I'm not sure if that's a problem as well. I've included a picture of what I did as well! ReproductionN/A Expected behaviorN/A Additional contextNo response Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Thank you for asking your question here. Sorry about the late response. First: Your two tests look great! It is actually a good idea to separate different functional tests into different tests. This makes it easier to spot any regressions. E.g., you will know exactly which button no longer works based on which test fails. Suppose you would nevertheless want to return back into your application after you, e.g., press a button to open another app. In that case, you can use this line to return back to your application (in the view where you have pressed the button) and continue any other next checks: // Test the first button and check if safari is opened after you pressend the button ...
// Return to your app:
app.activate()
// Test the second button and check if safari is opened after you pressend the button ... But as said above, I really like the idea of splitting this into separate tests; I think this is a great solution and separates the individual tests. |
Beta Was this translation helpful? Give feedback.
Hi @ananya-vasireddy,
Thank you for asking your question here. Sorry about the late response.
First: Your two tests look great! It is actually a good idea to separate different functional tests into different tests. This makes it easier to spot any regressions. E.g., you will know exactly which button no longer works based on which test fails.
Suppose you would nevertheless want to return back into your application after you, e.g., press a button to open another app. In that case, you can use this line to return back to your application (in the view where you have pressed the button) and continue any other next checks:
// Test the first button and check if safari is opened after you press…