Skip to content

glorylo/Joyride

develop
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Motivation

You have the same mobile application across ios and android. You want to write automated acceptance tests and ensure feature parity between the two. With Joyride you can write near identical specs for both apps sharing much of the underlying code.

You can also leverage shared code between the two test suites. The typical use cases include sharing business models, user profiles, and so on thereby simplifying much of the duplicated work had you worked with two separate projects.

Joyride attempts to supply much of the boilerplate code with "good defaults" to get you quickly started.

Get excited and jump start you automation efforts!

Overview

Joyride follows the same tried-and-true "pageobjects" pattern adopted for mobile. It supplies basic touch gestures in interacting with native and hybrid mobile applications. This is built on top of Appium.

Combined with Joyride.Specflow, the Behaviour Driven Development (BDD) binding layer, your human readable specs fully come to life with the use of gherkin syntax. Joyride.Specflow also supplies a stock of useful steps for common actions and gestures (swipe, scroll, tap, etc).

You can then overlay any screen with application specific features via interfaces. For example, you have an android and ios app, and you have a login screen. You create a shared interface called ILogin like so:

    public interface ILogin
    {
        Screen LoginAs(string name, string password);
    }

You then create a LoginScreen for both android and ios implementing the ILogin interface. Create a binding custom step to use the method to this interface like:

   [Given(@"I login as user ""([^""]*)"" with password ""([^""]*)""")]
   [When(@"I login as user ""([^""]*)"" with password ""([^""]*)""")]
   public void GivenILogin(string username, string password)
   {
       Context.MobileApp.Do<ILogin>(i => i.LoginAs(username, password));
   }

Your specs for Android look like:

Scenario: Should Login in successfully 
Given I launch the "My Cool Android App" mobile application
And I login as user "tommy" with password "secret"
...
  

Your specs for iOS look like:

Scenario: Should Login in successfully 
Given I launch the "My Cool iOS App" mobile application
And I login as user "tommy" with password "secret"
...
  

In fact, Joyride achieves much of the cross platform compatibility in the same manner. Here's the actual code for "tap" and "swipe".

   [Given(@"I tap the ""([^""]*)"" (?:button|field|label|element|link)")]
   [When(@"I tap the ""([^""]*)"" (?:button|field|label|element|link)")]
   public void WhenITapTheButton(string elementName)
   {
      Context.MobileApp.Do<IGesture>(i => i.Tap(elementName));
   }
   [Given(@"I swipe the screen (left|right|up|down)")]
   [When(@"I swipe the screen (left|right|up|down)")]
   public void GivenISwipeScreenInDirection(string direction)
   {
       var dir = (Direction) Enum.Parse(typeof(Direction), direction, true);
       Context.MobileApp.Do<IGesture>(i => i.Swipe(dir));
   }

Your specs using "tap" and "swipe" steps:

Given I tap the "Inbox" button
And I swipe the screen right

Features

Here are some of the features included with Joyride

  • Built-in starter configuration to quickly get you up and running.
  • Support for mostly native actions for ios and android. Currently hybrid apps have limited support.
  • Handling of collection of elements
  • Smart element and collection mappings
  • Predefined steps for interacting with different widgets such as checkboxes, entering text, etc.
  • Handling of modal dialogs
  • Detection of modal dialogs and screens
  • Predefined debugging steps
  • Predefined gestures steps
  • Screen captures on error
  • ios and android specific steps. For example, android has a "back" button
  • And more...

Examples

Add the appropriate tag to add platform specific steps

# Comment out and add the appropriate tag for your platform
# @android or @ios
Feature: My First Feature
	In order to do usercase on my app
	As a user
	I want to be do X

Here are some examples of the specifications you can write, all using Joyride's predefined steps:

Scenario: Should see the following elements
Given I tap the "App" button
Then I should see the following elements
| Element      |
| Activity     |
| Fragment     |
| Notification |
Scenario: Should be able to tap the item by index in a collection
Given I tap the "App" button
And I tap the "Fragment" button
And I tap the "Context Menu" button
And I tap the "Long Press" button and hold for "4" seconds
When I tap the "2nd" item in the "Menu" collection
Then I should be on the "Context Menu" screen
Scenario Outline: Respond to with the long message modal dialog 
Given I tap the "App" button
And I tap the "Alert Dialogs" button
And I tap the "Ok Cancel Dialog With Long Message" button
When I respond to the "Long Message" modal dialog with "<response>"
Then I should be on the "Alert Dialogs" screen

Examples: 
| response  |
| Something |
| Ok        |
| Cancel    |
Scenario: Should be able to double tap 
Given I tap the "Animation" button
And I tap the "Default Layout Animations" button
When I double tap the "Add Button" button
Then I should see "2" items in "Buttons" collection

See a listing of the Predefined Steps, Ios Steps, Android Steps, and Webview Steps

Installation

You can install the core packages via nuget's Package Manager Console

PM> Install-Package Joyride
PM> Install-Package Joyride.Specflow

For new projects, you can install the starter package utilizing the latest stable version:

PM> Install-Package Joyride.Starter

You can also install helpful tools for executing your tests:

PM> Install-Package Joyride.Tools

Current Versions

Joyride: #
Joyride.Specflow: #
Joyride.Starter: #
Joyride.Tools: #

Dependencies

  • Humanizer
  • PredicateParser
  • HandyConfig
  • Appium.WebDriver
  • Selenium.WebDriver
  • Selenium.Support
  • Newtonsoft.Json
  • NUnit
  • SpecFlow
  • SpecFlow.NUnit

Resources

License

Joyride uses the BSD License.

Have fun!

Glory

About

A cross platform mobile framework for automating acceptance tests using appium

Resources

License

Stars

Watchers

Forks

Packages

No packages published