It would be awesome to be able to zip a Wiremock JAR with a script to run the JAR as a PreRun Executable that would run before each test. This way if we have 50 concurrent tests, we will also have 50 Wiremock Servers. I realize this is possible with Desktop VMs, so this request would be for this to work when testing with Emulators and Simulators.
Additionally, in this scenario usually the tests are run from a Jenkins Node, which means the tests are being run from the Jenkin's Location (correct me if I'm wrong), so all of those threads are being handled by the Jenkins Node. So, our thought is that we would also build our Appium Java Repo into a JAR and also run that using the prerun executable script. This would give us the possibility of having One Appium Jar, One Wiremock Jar, and One Emulator per test. (Or simulator)
This would recreate what is possible with Native Android Espresso Automation where the APK, the Test APK, and a programmatically spun up Wiremock Server are all on the same device.
We want to get close to this, but instead of on the Device, they would be spun up on the LocalHost and communicated to using the loopback address (10.0.2.2 for android), or just 127.0.0.1 for iOS.
We have a few options of where to spin up the Wiremock Server:
1) Programmatically start server from Appium Java suite -> Wiremock Server would be located on Jenkins Node which is not ideal for us because latency/distance/all of the servers spun up would be existing on the same Mac Pro Jenkins Node
2) Host Wiremock Server on Cloud Provider and interact with Appium Code -> This solution cannot handle a lot of concurrent tests and the json state can get messy with any posts/patches and many tests running against it. Also, the remote mock server can have latency issues or can just go down for random reasons.
3) Wiremock Java Repo can be built into a Jar, and sent up to SauceLabs VM then executed with a script and the Appium repo can interact with it via 10.0.2.2 on emulator or 127.0.0.1 on simulator. (Ideal solution)
Right now, our tests run from Appium, on Saucelabs, and interact with a Mock Server hosted in another cloud. We would like to run everything from SauceLabs with Pre - Run Executables to help create the state on the machine that we want.
I have experimented with this and it seems like nothing happens even with the Capability defined. Perhaps it just cannot execute JAR files.