• This repository has been archived on 01/Feb/2018
  • Stars
    star
    443
  • Rank 98,504 (Top 2 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 12 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

iOS UIAutomation Test Runner

Bwoken build status

Runs your UIAutomation tests from the command line for both iPhone and iPad, in the simulator or on your device.

Supports coffeescript and javascript.

screenshot

On the Command Line

Running tests

Make sure bwoken is properly installed. Then, build your project and run all your tests via:

# will build and run all of your tests
$ bwoken test

# will run one file, relative to integration/coffeescript/{iphone,ipad}/
#  (note: no file extension)
$ bwoken test --focus some_test # runs this test on (iphone and ipad) OR (connected iDevice)
$ bwoken test --focus some_test --family iphone

structuring your test files

To add new coffeescript test, add those file to the /integration/coffeescript/iphone or /integration/coffeescript/ipad folder. To add new javascript test, if the iphone and ipad folder don't exist in the /integration/javascript forlder, create them. Then copy your test file inside those folder depending on your target. Your file hierarchy should look something like this


| integration
	| coffeescript
		| iphone
			| exemple.coffee
		| ipad
			| example.coffee
	| javascript
		| iphone
			| myTest.js
		| ipad
			| myiPadtest.js
	|tmp

Note that your test scripts inside the coffeescript and javascript folder will be copied to their equivalent folder in the /tmp folder(ie: /tmp/javascript/iphone/myTest.js), so all your import statement should be relative to that location (ie: #import "../filetoImport.js" for file in the javascript folder)

Simulator or Device?

To run bwoken tests on your device, just plug it in! And if you want to run tests in the simulator, just unplug it!

# without a device connected, will run on the simulator:
$ bwoken test

# with a device connected, will run on the device:
$ bwoken test

# with a device connected, will run on the simulator:
$ bwoken test --simulator

Your tests will look something like this:

$ bwoken test
Building.............................................................................
.....................................................................................
.....................................................................................
.....................................................................................
.....................................................................................
.....................................................................................
.....................................................................................
................................................................................
Build Successful!

iphone  favorites.js
Start:  Favoriting a repository
Debug:  tap tableViews["Repositories"].cells["CITravis by Travis-ci"]
Debug:  tap navigationBar.rightButton
Debug:  tap actionSheet.elements["Add"]
Debug:  tap navigationBar.leftButton
Debug:  tap navigationBar.elements["Favorites"]
Debug:  navigationBar.elements["Favorites"].scrollToVisible
Debug:  tap navigationBar.elements["All"]
Pass:   Favoriting a repository
Start:  Unfavoriting a repository
Debug:  tap navigationBar.elements["Favorites"]
Debug:  tap tableViews["Repositories"].cells["CITravis by Travis-ci"]
Debug:  tap navigationBar.rightButton
Debug:  tap actionSheet.elements["Remove"]
Debug:  tap navigationBar.leftButton
Debug:  should be true null
Debug:  tap navigationBar.elements["All"]
Pass:   Unfavoriting a repository

Complete
 Duration: 23.419741s

All the switches

Here's a list of all the switches that bwoken takes for the test command:


$ bwoken test -h
[...]
        --simulator             Use simulator, even when an iDevice is connected
        --device                Use given device (name or id)
        --family                Test only one device type, either ipad or iphone. Default is to test on both
        --scheme                Specify a custom scheme
        --product-name          Specify a custom product name (e.g. --product-name="My Product"). Default is the name of of the xcodeproj file
        --integration-path      Specify a custom directory to store your test scripts in (e.g. --integration-path=uiautomation/path/dir). Note that this folder still expects the same directory structure as the one create by `bwoken init`.
        --formatter             Specify a custom formatter (e.g., --formatter=passthru)
        --focus                 Specify particular tests to run
        --clobber               Remove any generated file
        --skip-build            Do not build the iOS binary
        --configuration         The build configruation to use (e.g., --configuration=Release)
        --sdk-version           The SDK version to use (e.g., --sdk-version=6.1)
        --verbose               Be verbose
    -h, --help                  Display this help message.

In Your Code

Like Javascript?

Sometimes we'd like to have some javascript help us out. For example, what if you'd like Underscore.js in your test suite? Simple! Just put it in integration/javascript and import it in your test:

#import "../underscore.js"

Bring in Libraries!

Wanna bring in tuneup.js, mechanic, or underscore without manually downloading them first? Just use #github instead of #import:

#github "jashkenas/underscore/underscore.js"
#github "alexvollmer/tuneup_js/tuneup.js"
#github "jaykz52/mechanic/src/mechanic-core.js"

Installation

Create an iOS project

If you don't have an iOS project already, go ahead and create it. If you already have a project, no worries: you can install bwoken at any point.

Ensure your project is in a workspace rather than simply a project:

  • In Xcode, select File -> Save as workspace...
  • Save the workspace in the same directory as your .xcodeproj file

Note: This is done automatically if you use CocoaPods. I highly suggest you do!

Prerequisites

Ensure Xcode is up-to-date.

Install rvm via the instructions. Ensure your after_cd_bundler rvm hook is enabled:

$ chmod u+x ~/.rvm/hooks/after_cd_bundler

Install

NOTE: Do NOT use sudo to install or run bwoken. It will almost definitely fail you.

In the terminal, inside the directory of your project (e.g., you should see a ProjectName.xcodeproj file), create .ruby-version and .ruby-gemset files and trigger their use:

$ echo '2.1.0' > .ruby-version
$ echo 'my_project' > .ruby-gemset
$ cd .

Install bundler (a ruby library dependency manager) and init:

$ gem install bundler # idempotent; might already be installed and that's ok
$ bundle init

This will create a Gemfile. Add bwoken to it and bundle:

$ echo "gem 'bwoken', '2.0.0'" >> Gemfile
$ bundle

The last installation step is to initialize the bwoken file structure:

$ bwoken init

Now, you can start using it!

The Dirty Little Installation Method

Technically, you can skip this entire Installation section and just run sudo gem install bwoken && bwoken init. This is listed here for completeness, but you really shouldn't install gems this way. This installation method will almost certainly not work with versions of OS X prior to Mavericks.

Contributors

Special thank you goes out to everyone who's helped with bwoken. Here's a (probably incomplete) list of those folks:

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

More Repositories

1

lean-map

Lean Hash Array Mapped Trie implementation in ClojureScript
Clojure
145
star
2

api-server

A JSON API server written in Haskell
Haskell
66
star
3

TravisCI.app

Objective-C
52
star
4

caravan

Example app using Interpol
Ruby
42
star
5

conwip-modules

Conwip Modules helps automate dynamically loading ClojureScript modules
Clojure
19
star
6

ionic-rails-app

An example Ionic app to communicate with Rails.
HTML
19
star
7

cap-ml

Text Detection Capacitor Plugin
Swift
15
star
8

theme-default-haml

Spree with theme-default hamlized and sassed, with additional hooks defined
JavaScript
14
star
9

payroll

Track & analyze payroll in order to make informed decisions.
Ruby
13
star
10

featured_model

Cucumber step definitions to create model instances with dynamic attributes and associations.
Ruby
7
star
11

buffet

A sampling of the tastiest dotfiles, configurations, and aliases from across the internet
Shell
7
star
12

liveview-rich-text-editor-collab

A Phoenix LiveView backed rich text editor with collaboration feature
Elixir
7
star
13

elm-action-cable

Client-side Elm library for ActionCable, part of the Ruby on Rails suite
Elm
6
star
14

bent_template

rails templates bent to your will
Ruby
4
star
15

contracts

A collection of open-sourced contracts
4
star
16

concert-cam

Ruby
4
star
17

idkfa

Simple credentials loading
Ruby
4
star
18

spree-wholesale

Extension to Spree allowing for wholesale pricing on products
Ruby
3
star
19

docker-rails-app

A simple Rails app running on Docker
Ruby
3
star
20

latest.rb

Adds "latest" function to Rails templates
Ruby
2
star
21

fam-fam-icons-on-rails

Ruby
2
star
22

restaurant_week

An interactive map for Restaurant Week in Madison, WI
JavaScript
2
star
23

bendyworks.github.com

JavaScript
2
star
24

pig

A rack endpoint to view the latest commits in an environment.
Ruby
2
star
25

tic-tac-toe-webpack

A webpack demo that implements a game of tic-tac-toe
JavaScript
2
star
26

awesome_digest

Hacker News digest email sender thingamabob
Ruby
2
star
27

angular-donuts

Ruby
2
star
28

dotfiles

The Bendyworks dotfiles, managed by chezmoi
Shell
1
star
29

spree-theme-default-hamlized

Deprecated, use bendyworks/theme-default-haml
1
star
30

bendy-github-jam

Launchpad for a https://github.com/github/game-off-2016 game
JavaScript
1
star
31

tailwind-twin-demo

Demo `create-react-app` using tailwindcss and twin.macro
JavaScript
1
star
32

pairing_jams

sweet jams to jam out by whilst pair programming
1
star
33

space-mining

Lightning Talk for Scottish Ruby Conference 2012
1
star
34

make_music_madison

JavaScript
1
star
35

botfiles

bendyworks' bootstrap dotfiles
Ruby
1
star
36

clojure-brave-and-true

Solutions for Clojure for the Brave and True exercises
Clojure
1
star
37

thinkery

General repository for breakable (and hopefully useful)
Ruby
1
star
38

attribution

Spreading the bendyword, one project at a time.
JavaScript
1
star