Git Product home page Git Product logo

jenkins-automation's Introduction

jenkins-automation

=== ###Jenkins Testing Integration

jenkins-automation is a toolbox for automated test coverage of iOS apps using the continuous integration server Jenkins.

#####Coverage

  • Logic Testing via SenTestingKit (OCUnit)
  • Application Testing via SenTestingKit (OCUnit)
  • Integration (User Interface) Testing via UIAutomation

Prerequisites

How To Get Started

First of all install the prerequisites listed above!

=== #####Jenkins Build Script

######build.sh

Automatically calls unit_testing.sh and integration_testing.sh You may modify some constants in this script:

  • PROJECT_PREFIX
  • APPNAME
  • PLISTPATH
  • XCODEPROJECTPATH
  • INHOUSE_SCHEME
  • ADHOC_SCHEME
  • INHOUSE_IPA_NAME
  • ADHOC_IPA_NAME
  • UNITTESTNAME
  • UIAUTOMATIONPREFIX
  • UIAUTOMATIONTESTPATH
  • SIMULATORSDK

=== #####Unit Testing Execution Script

######unit_testing.sh

Parameter:

  • SDK name
  • unit test target name

Example:

/bin/sh unit_testing.sh iphonesimulator MyAppTests

HTML result example:

ScreenShot

Note: Jenkins is already pre-configured to support test results. But this support only covers JUnit test results (xml). After installing OCUnit2JUnit the build script will automatically convert OCUnit test results to JUnit test results and Jenkins will support some really nice charts!

=== #####Integration Testing Execution Script

######integration_testing.sh

Parameter:

  • SDK name
  • app name
  • UIAutomation prefix
  • UIAutomation test path

Example:

/bin/sh integration_testing.sh iphonesimulator MyApp foo bar

=== #####Integration Testing Transformer Stylesheet

######integration_test_result_transform.xsl

Parameter:

  • Title
  • ScreenshotPathPrefix
  • SmileyPathPrefix

Example:

xsltproc --stringparam Title "FooBar" --stringparam ScreenshotPathPrefix "test/" --stringparam SmileyPathPrefix "foo/" -output out.html transform.xsl Automation\ Results.plist

===

Requirements (Xcode)

To be able to use all these scripts, you have to make some modifications in your Xcode project to support testing with OCUnit.

Build Configurations

At first duplicate the Debug Build Configuration and call it "UnitTest".

ScreenShot

It's important to enable i386 as valid architecture for these new Build Settings.

ScreenShot

Search for "Test After Build" and set the value to "YES".

Last but not least set "Generate Test Coverage Files" and "Instrument Program Flow" to "YES".

ScreenShot

Schemes

You have to create a scheme called "UnitTest". This could be a duplicate of the Debug-Scheme.

ScreenShot

Make sure to have enabled the test bundle to run in "Build" category (list on the left) and use your Build Configuration "UnitTest" in "Test" category.

ScreenShot

Targets (Only important to enable Application Tests)

NOTE: if you just like to run Logic Tests, you can skip reading this chapter.

Modify Xcode

Disclaimer: changig your Xcode configuration file may prevent you using Xcode! Be careful while make the following changes!

Open this file in some text editor with root previleges: /Developer/Platforms/iPhoneSimulator.platform/Developer/Tools/RunPlatformUnitTests

Go to line 95 and search for:

Warning ${LINENO} "Skipping tests; the iPhoneSimulator platform does not currently support application-hosted tests (TEST_HOST set)."

Put some "#" in front of these lines to disable execution. Now you don't get a warning if you try to run Application Tests from command line.

Build Phases (Run Script)

Click on your project file in Xcode and choose the Application Test Target in list to edit the Build Phases.

Expand "Run Script" and put in the following code snipplet:

echo "<<UNIT_TEST_MARKER>>"
test_bundle_path="$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.$WRAPPER_EXTENSION"
environment_args="--setenv DYLD_INSERT_LIBRARIES=/../../Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection --setenv XCInjectBundle=$test_bundle_path --setenv XCInjectBundleInto=$TEST_HOST"
ios-sim launch $(dirname $TEST_HOST) $environment_args --args -SenTest All $test_bundle_path
echo "Finished running tests with ios-sim"
echo "<<UNIT_TEST_MARKER>>"

This allows you to run Application Test with xcodebuild.

===

Contact

Creators

Sven Jansen
Till Toenshoff

jenkins-automation's People

Stargazers

 avatar

Watchers

 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.