Giter Site home page Giter Site logo

jcharr1 / ios-smoke-test-app Goto Github PK

View Code? Open in Web Editor NEW

This project forked from calabash/ios-smoke-test-app

0.0 3.0 0.0 219.95 MB

A native iOS app configured with Calabash iOS

License: MIT License

Objective-C 60.39% C 6.09% GLSL 0.11% Ruby 22.35% Makefile 0.45% Shell 5.43% Gherkin 5.18%

ios-smoke-test-app's Introduction

master license
Build Status License

CalSmoke Test App

Smoke testing for Calabash iOS and Calabash iOS Server.

This repo is very large because the Calabash binaries are updated often during testing and debugging. There is really no way around this. You can improve your experience by making a shallow clone using the --depth flag. Maintainers may need to make a much deeper clone.

$ git clone --depth 10 [email protected]:calabash/ios-smoke-test-app.git
$ cd ios-smoke-test-app/CalSmokeApp

We use this app to document, demonstrate, and test Calabash iOS.

You can use this app to explore Calabash and as an example for how to configure your Xcode project and Calabash workflow.

If you have problems building or running, please see the xcpretty and Code Signing sections below for how debug.

Getting Started

Ruby on MacOS

If you have a managed Ruby installed (like rbenv or rvm), please skip this section and ignore the calabash-sandbox instructions in the examples.

If you are new to Ruby or Ruby on MacOS, we recommend that you install and use the Calabash Sandbox.

$ curl -sSL https://raw.githubusercontent.com/calabash/install/master/install-osx.sh | bash

Please do not install gems with sudo or run the install script above with sudo.

You can read more about Ruby on MacOS on the Calabash iOS Wiki.

The following examples assume you are running in a managed Ruby environment or you have installed the Calabash Sandbox and run this command:

$ calabash-sandbox
This terminal is now ready to use with Calabash.
To exit, type 'exit'.

Build a .app for the Simulator

You will need to touch the Xcode project file an adjust the code signing settings to match your environment.

$ git clone --depth 10 [email protected]:calabash/ios-smoke-test-app.git
$ cd ios-smoke-test-app/CalSmokeApp
$ bundle
$ make app-cal

Cucumber

Run your first cucumber test:

# A test that is run in Travis CI
$ bundle exec cucumber --tags @travis

Interactive console

Explore your app on from calabash console:

$ bundle exec calabash-ios console
> start_test_server_in_background
> query("UITextField")
> touch("UITextField")
> keyboard_enter_text("Hello!")

Running Physical Devices

You will need to touch the Xcode project file an adjust the code signing settings to match your environment.

$ cd ios-smoke-test-app/CalSmokeApp
$ bundle
$ make ipa-cal
$ CODE_SIGN_IDENTITY="iPhone Developer: Your Name (ABCDE12345)" \
  DEVICE_TARGET=< device name | udid > \
  DEVICE_ENDPOINT=http://<ip>:37265 \
  be cucumber -p device
  
Example:

$ CODE_SIGN_IDENTITY="iPhone Developer: Joshua Moody (8QEQJFT59F)" \
   DEVICE_TARGET=denis \
   DEVICE_ENDPOINT=http://denis.local:37265 \
   be cucumber -p device

Problems building?

xcpretty

https://github.com/supermarin/xcpretty

We use xcpretty to make builds faster and to reduce the amount of logging. Travis CI, for example, has a limit on the number of lines of logging that can be generated; xcodebuild breaks this limit.

The only problem with xcpretty is that it does not report build errors very well. If you encounter an issue with any of the make rules, run without xcpretty:

$ XCPRETTY=0 make ipa

Code Signing

If you have multiple code signing identities, you might need to set the CODE_SIGN_IDENTITY variable for the make scripts. If you are running with xcpretty, you might see output like this:

$ make ipa
** INSTALL FAILED **

The following build commands failed:
        PhaseScriptExecution Run\ Script\ Add\ Calabash\ dylibs\ to\ Bundle
<snip>/Debug-iphoneos/CalSmoke.build/Script-F51F2E8E1AB359A6002326D0.sh

Try again without xpretty to reveal the problem:

$ XCPRETTY=0 make ipa
iPhone Developer: ambiguous (matches "iPhone Developer: Some Developer
(89543FK9SZ)" and "iPhone Developer: Some Other Developer (7QJQJFT49Q)"
Command /bin/sh failed with exit code 1

** INSTALL FAILED **

Fix this problem by telling Xcode which identity to use:

$ export CODE_SIGN_IDENTITY="iPhone Developer: Joshua Moody (7QJQJFT49Q)"
$ make ipa

If you are building from Xcode and have code signing problems, you'll need to update the bin/xcode-build-phase/add-calabash-dylibs-to-bundle.sh with your identity details.

Information for Maintainers (or the Curious)

Make the -cal target

The -cal target links the calabash.framework.

This is the traditional way of getting the Calabash iOS Server into your app. It uses a separate application target as the test target; the -cal target. A separate -cal target means your production target will never be linked with the calabash.framework. This may be important to some developers or organizations.

This approach is suitable for the Xamarin Test Cloud.

$ bundle install
$ make app-cal
$ export APP="Products/app/CalSmoke-cal/CalSmoke-cal.app"
$ bundle exec cucumber

To make an ipa from the -cal target:

$ make ipa-cal

Embed dylibs in the CalSmoke Target

This method is provided to demonstrate an alternative Calabash setup.

The Debug configuration of the CalSmoke target (production) embeds the Calabash dylibs in the app bundle. These dylibs are loaded at runtime. This only happens when the Xcode Build Configuration is Debug.

The script that does the embedding is here:

bin/xcode-build-phase/add-calabash-dylibs-to-bundle.sh

and depending on your environment, it may need to be update for codesigning.

This is not dylib injection; the dylibs are embedded. See Makefile for rules to build an app suitable for testing dylib injection.

This approach is suitable for the Xamarin Test Cloud.

$ bundle install
$ make app-calabash-embedded
$ export APP="build/app/CalSmoke/embedded-calabash-dylib/CalSmokeApp.app"
$ bundle exec cucumber

To make an ipa with dylibs embedded in the production target:

$ make ipa-calabash-embedded

# Update the config/cucumber.yml
bundle_id:    BUNDLE_ID=sh.calaba.CalSmoke

ios-smoke-test-app's People

Contributors

idcuesta avatar jcharr1 avatar jescriba avatar jmoody avatar stoneman avatar svevang avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.