iamMobile
iamMobile

Reputation: 969

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?

Upvotes: 0

Views: 1289

Answers (2)

Manoel da Fonte
Manoel da Fonte

Reputation: 1

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.

Upvotes: 0

Roman Zakharov
Roman Zakharov

Reputation: 2273

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.

Upvotes: 1

Related Questions