Skip to content
This repository has been archived by the owner on Mar 25, 2019. It is now read-only.

Latest commit

 

History

History
59 lines (36 loc) · 2.75 KB

running_tests.md

File metadata and controls

59 lines (36 loc) · 2.75 KB

Please make sure you have gone through installation and setup.

Running the tests

Use either rake android_bdd or rake ios_bdd.

With this command we run all of the tests for a particular platform (Android or iOS) that are not tagged as @manual-only, since that's what is defined as the default Cucumber profile in cucumber.yml. You can read more about why we write scenarios that we know we won't be able to automate in the codebase comments.

We consider everything to be working as expected when a run excluding all the manual tests passes. Test are run sequentially and the results displayed at the end:

A successful run

Running specific tests using profiles or tags

Tests can be filtered out by using Cucumber tags and profiles:

  • rake android_bdd <-- runs everything but manual tests
  • rake android_bdd[wip] <-- only runs tests tagged @wip (only because that's how it's been defined in the cucumber.yml profile, not because of name match!)

You can see all tasks available by running rake -T.

Read on about the main concepts if you want to have an overview of what is going on.

Writing new tests

It can be difficult to write a new test just by running the scenario over and over - we typically go through "interactive" sessions.

During early stages of the development it's likely that we have an idea of what we want to test, but we're not sure how. Maybe we have doubts about the mock server, maybe about some interface elements of the app, maybe about the Appium APIs involved.

An interactive session facilitates this "discovery" by preparing the whole system for a session in which we can poke around with the data coming from the mock server or the elements of the application. For example run:

rake ios_interactive

This in turn:

  • Prepares and compiles the app pointing it to the local mock server.
  • Boots up the mock server, if required.
  • Boots up a local Appium server, if required.

Once all is up and running you can open up a new terminal, start IRB or PRY, and try something like this:

require 'appium_lib'
caps = Appium.load_appium_txt file: 'appium.txt', verbose: true
driver = Appium::Driver.new({caps: caps})
driver.start_driver

[Note that for Android this requires the device connected or the emulator running already.]

Appium will install and start the app and when done you can begin the interactive session by getting a dump of what is on screen:

driver.page

Once you are finished, close the driver (driver.driver_quit) and CTRL+C on the main tab to finish off the interactive session.