简体   繁体   中英

XCUITests run shell scripts between tests

I do want to run shell script between two XCUITests. But since package is created and installed on the device or simulator, how this can be achieved? Is there a way to execute shell script on the host machine which has device connected(Either for Simulator or Real iPhone) between the tests?

You should probably set up Client-Server communication between device and host machine in order to do things like this.

This exact approach has been already implemented in

https://github.com/Subito-it/SBTUITestTunnelHost

Another option is to move shell code entirely to the test code. For example, if you use a shell script to communicate with a remote server, you should consider doing it on the device.

I think you can try inserting a script inside the test plan.

From Xcode:

  1. Go to tab product
  2. Press Test Plan
  3. Manage Test Plans

Then, from the right side, select Test, and insert your script inside the pre-actions and/or pos-actions.

PS: I'm not sure if you can do that for selected tests. Maybe the scripts will run before/after each test.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM