This repository was archived by the owner on Jun 20, 2023. It is now read-only.
This repository was archived by the owner on Jun 20, 2023. It is now read-only.
[Debugging Trick] Use Build Scheme ENAScreenshots with specific Launch Arguments to test the user interface on the simulator #3804
Open
Description
- None of the other issue templates apply to this issue.
Problem:
With the simulator you are able to test and debug a lot of the cwa code.
However, a lot of code pathes are not easy to cover.
Examples are: What happens after a green or a red warning? After a red antigen test result? After a red PCR test result?
If you are mainly interested in testing and debugging of the user interface, the following trick may help you.
Let's start with an example: You are interested to test the user interface after a green warning.
Recipe for this specific use case:
- in Xcode, select scheme ENAScreenshots (instead of ENACommunity), and Build for Testing
- open file ENAUITests/Home/ENAUITests_01a_Home
- search function test_homescreen_riskCardLow_riskMultipleDays
The implementation sets several launch arguments, followed by the lineapp.launch()
- set a breakpoint after this line
app.launch()
- click the small triangle at the function definition to start the test, and wait till the breakpoint hits and the simulator device has launched
- you see the green risk card, showing exposures with low risk on 4 days (according to the launch arguments).
But the amazing part is: you can now take over, and manually test what you want (e.g. have a look at the explanations for the risk card, at the contact journal, etc)
Note: the supported launch arguments are defined in ENAUITests/LaunchArguments.swift
Do not forget:
The Scheme ENAScreenshots are configured with a focus to test the user interface.
Most of the processing "below the surface" is mocked, so you will not be able to debug the true code here.