Skip to content

Instantly share code, notes, and snippets.

@ainoya
Created July 28, 2016 06:46
Show Gist options
  • Save ainoya/e3c61027d2f1f74e2a2387742304b195 to your computer and use it in GitHub Desktop.
Save ainoya/e3c61027d2f1f74e2a2387742304b195 to your computer and use it in GitHub Desktop.
start appium server in parallel
require 'selenium-webdriver'
require 'logger'
class AppiumServer
def initialize(opts = {})
@port = Selenium::WebDriver::PortProber.above(3000)
@log = ::Logger.new(STDOUT)
end
def start
@pid = fork do
exec "appium -p #{@port}"
end
@log.info("appium server is running! port: #{@port}")
end
def kill
Process.kill "TERM", @pid
end
end
a = AppiumServer.new
a.start
sleep 3
a.kill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment