Sauce Labs Customer Idea Portal

Submit an idea and make Sauce Labs even better!

Enable Prerun Executables for Simulator/Emulators

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 ( for android), or just 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 on emulator or 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.

  • Mark Han
  • Nov 5 2019
  • Attach files
  • Mark Han commented
    25 Nov, 2019 06:22pm

    It seems the only way to access local host of the Jenkins Node would be using SauceConnect Proxy. This would allow us to spin up a Mock Server on the Jenkins Node, but it would not be a "server per test" so would have concurrency issues as all 50 VMs would still have to interact with this one server. And it would also still have latency issues . Furthermore, in our specific use-case we cannot use SauceConnect Proxy.