這取決於你所使用的測試。如果你使用的黃瓜,因爲我,你的文件夾結構應該是這個樣子:
|features
|>step_definitions
|>support
|>env.rb
|appium.txt
的env.rb文件看起來像:
class AppiumWorld; end
appium_txt = File.join(Dir.pwd, 'appium.txt')
caps = Appium.load_appium_txt file: appium_txt
Appium::Driver.new(caps)
Appium.promote_appium_methods [AppiumWorld]
Appium.promote_singleton_appium_methods [Base]
World do
AppiumWorld.new
end
Before do |scenario|
$driver.start_driver
end
After do |scenario|
$driver.driver_quit
end
的appium.txt文件看起來像
[caps]
appiumVersion = "1.3.4"
deviceName = "iPhone Simulator"
device-orientation = "portrait"
platformVersion = "8.1"
platformName = "iOS"
browserName = ""
app = "Absolute path to your app which you can point at any version"
name = "Test again"
[appium_lib]
sauce_username = ""
sauce_access_key = ""
所述的Gemfile包括:
gem 'sauce-cucumber', require: false
gem 'selenium-webdriver'
gem 'cucumber', '~> 1.3.19'
gem 'appium_console', '~> 1.0.3'
gem 'appium_lib', '~> 6.0.0'
我會看看醬黃瓜的教程,這是一個不可或缺的資源。此外,這是一個紅寶石解決方案,但您可以根據需要翻譯它。
我對Android應用測試有類似的問題:是否有可能使用Appium測試應用更新? – Andrius 2015-02-12 07:13:21
我沒有設法通過使用Appium來實現此目的,所以我通過使用adb命令+ mocha,grunt等的組合來實現。 – Andrius 2015-02-19 12:34:14