2 minutes

Sample env.rb File for Setting up Android Testing Using Appium and Ruby

By Editorial @stacktips, On Sep 17, 2023 Android 2.29K Views

This env.rb file provides setup and common functionality across all features. It’s included first before every test run, and the methods provided here can be used in any of the step definitions used in a test.

This is a great place to put shared data like the location of your app, the capabilities you want to test with, and the setup of selenium.

require 'appium_lib'
require 'cucumber'
require 'require_all'

require_all 'lib'
class AppiumWorld

caps = {
  caps: {
    'platformName' => ENV['PLATFORM'],
    'platformVersion' => ENV['VERSION'],
    'deviceName' => ENV['DEVICE'],
    'app' => ENV['APP_PATH'],
    'newCommandTimeout' => '200'
Appium.promote_appium_methods AppiumWorld

World { }

def app
  @app =$driver)

Before { $driver.start_driver }
After { $driver.driver_quit }
stacktips avtar


StackTips provides programming tutorials, how-to guides and code snippets on different programming languages.