Post

Replies

Boosts

Views

Activity

Switching WiFi's in On-Device-Integration-Tests
Hello Developer community,In our company we are developing a communication framework to talk to devices whether they are locally available or remotely (via a proprietary cloud).To test this functionality we currently have to run a lot of tests manually because they require joining different WiFi networks.We really need to automate these tests because it takes a lot of manual effort to run them, but:Running Unit Tests (even on a Phone by using a fake host app) i can't change the current WiFi. NEHotspotHelper requires special permission from apple (via a request form)NEHotspotConfigurationManager requires user interaction every single time that you try to switch the networkStarting in XCode 9 it is possible to open the Settings App and switch the connected WiFi programmatically, BUT... this is only possible when running UI tests.we develop a library, not an app If i try to hide my tests inside a UI testing framework then i can't access the API of the library...the library we develop is quite extensive so developing a UI element for every single API method is not feasible.Is there really nothing that would allow switching WiFis in the context of a test?I could even live with private APIs considering that their usage is part of the tests, NOT part of the framework that we want to ship.
2
0
1.5k
Mar ’18
NWMulticastGroup crash when socket address already in use
iOS 14 introduces multicast support in the Network framework in the form of NWMulticastGroup. Following Apple's guide ( https://developer.apple.com/news/?id=0oi77447 ) I am trying to join the multicast group for SSDP using the following code: let host = NWEndpoint.Host(ipFamily.ssdpGroupName) let multicastGroup = try NWMulticastGroup(for: [.hostPort(host: host, port: .ssdp)]) let ssdpGroup = NWConnectionGroup(with: multicastGroup, using: .udp) ssdpGroup.stateUpdateHandler = { newState in Logger.info("Reached new state: \(newState)") } ssdpGroup.setReceiveHandler(maximumMessageSize: 16384, rejectOversizedMessages: false, handler: {[weak self] (message, content, isComplete) in Logger.info("SSDP message received, do something here...") }) ssdpGroup.start(queue: delegateQueue) However, it seems that the port is already in use by another application. Now I have the following issues: It reaches the .ready state and then crashes, instead of reaching the error state... Is there a way to configure the socket to allow socket reuse? This is important to prevent clashes with e.g. the Spotify app. Is it possible to send a message to the multicast group from a different port? (destination port and source port are different)
3
0
2.3k
Jun ’20
UI Tests on real device broken on iOS 15.4
UI Tests seem to be broken when run on an iPhone running iOS 15.4. Steps to reproduce: Create a fresh app project in Xcode 13.3 including UI tests Select an attached iPhone running iOS 15.4 Run the UI test testExample which only starts the app, nothing more. Restart the attached phone Try to run testExample again. Expectation: Test succeeds again Actual: When launching the app, XCTest is internally first trying to terminate the app and gets stuck. After 60s the tests fail. Logging (app id and home folder are removed for privacy reasons): TESTUITests-Runner[341:7025] Running tests... Test Suite 'Selected tests' started at 2022-03-17 14:53:36.855 Test Suite 'TESTUITests.xctest' started at 2022-03-17 14:53:36.855 Test Suite 'TESTUITests' started at 2022-03-17 14:53:36.856 Test Case '-[TESTUITests.TESTUITests testExample]' started. t = 0.00s Start Test at 2022-03-17 14:53:36.856 t = 0.07s Set Up t = 0.07s Open <app_id>.TEST t = 0.11s Launch <app_id>.TEST t = 0.11s Terminate <app_id>.TEST:269 <UserHome>/Workspace/TEST/TESTUITests/TESTUITests.swift:28: error: -[TESTUITests.TESTUITests testExample] : Failed to terminate <app_id>.TEST:269: Failed to terminate <app_id>.TEST:0 t = 60.29s Tear Down Test Case '-[TESTUITests.TESTUITests testExample]' failed (60.294 seconds). Test Suite 'TESTUITests' failed at 2022-03-17 14:54:37.150. Executed 1 test, with 1 failure (0 unexpected) in 60.294 (60.294) seconds Test Suite 'TESTUITests.xctest' failed at 2022-03-17 14:54:37.150. Executed 1 test, with 1 failure (0 unexpected) in 60.294 (60.295) seconds Test Suite 'Selected tests' failed at 2022-03-17 14:54:37.151. Executed 1 test, with 1 failure (0 unexpected) in 60.294 (60.296) seconds If I manually start the app once, then the UI tests will run again afterwards for a while (including restarting the app). At some point they get stuck again and we are not sure why, yet. This makes it really hard to run tests in our CI because we can't keep sending someone into the server room to manually start the app... Has anybody else encountered this and found a solution? It works fine on iOS 15.1.1.
6
2
3.6k
Mar ’22
Bluetooth state restoration and app updates
The following tech note describes under which situations bluetooth state restoration can occur: https://developer.apple.com/documentation/technotes/tn3115-bluetooth-state-restoration-app-relaunch-rules But does it also occur when the app is updated, as in the following scenario? Try to connect to a peripheral app got terminated by the OS to free up memory app is updated from the app store peripheral starts advertising
0
0
625
Aug ’22