My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
IOSMakeAnAppTestable  
How to configure your build to enable testing your app with iOS NativeDriver.
Featured
Updated Aug 8, 2011 by tka...@google.com

Making An iOS App Testable with NativeDriver

To drive your iOS application, you should link NativeDriver library into your application. NativeDriver will listen port 3001 in your application and respond to WebDriver requests.

You can make your application testable with following steps.

1. Import iPhoneNativeDriver project into your project

First of all, you should import NativeDriver project into your project so that you can set target dependency and linkage settings.

1.1. Open your project in Xcode. Select your project and click "Add Files to ..." in the context menu.

1.2. Select "NativeDriver.xcodeproj" and click "Add" button.

2. Add header search path

We will call NativeDriver from your main.m to start server. NDNativeDriver.h should be in header search paths.

2.1. Select target in your project. You can create new target to run NativeDriver automation.

2.2. Open "Build Settings" tab for the target.

2.3. Add path to nativedriver/iphone/Classes to "Header Search Paths".

3. Add linker flags

NativeDriver library uses Objective-C categories feature. To prevent linker to removing necessary object, you should add some linker flags.

3.1. Add "-ObjC" and "-all_load" to "Other Linker Flags".

4. Add target dependencies

Add target dependency so that NativeDriver will be built before building your app.

4.1. Open Build Phases tab.

4.2. Add "NativeDriver" to "Target Dependencies".

5. Add frameworks to link with

You should link NativeDriver and related frameworks into your project.

5.1. Add "libNativeDriver.a", "libCocoaHTTPServer.a", "CFNetwork.framework", and "libstdc++.dylib" to "Link Binary With Libraries".

6. Add codes to start NativeDriver

NativeDriver will start with [NativeDriver start] message. You can add this message in main.m. NativeDriver works only in testing purpose. You can define "Preprocessor Macros" in the build settings.

6.1. import "NDNativeDriver.h" and call [NDNativeDriver start]; in main.m.

Comment by c.martin...@gmail.com, Nov 23, 2011

In addition to these steps you also have to define the symbols "NATIVEDRIVER" and "DEBUG" in order to include the

import "NdNativeDriver?.h"
line and inside that .h file DEBUG has to be defined in order to get NDNativeDriver defined.

Comment by nanichan...@gmail.com, Feb 7, 2012

Hi Martin... I am new to native driver...Can you please explain in detail like how i can define "NATIVEDRIVER" and "DEBUG" and where to define.

Comment by c.martin...@gmail.com, Apr 19, 2012

Under "Preprocesor Macros" in the "Build Settings" for your "Automation" target find Debug and add: NATIVEDRIVER DEBUG


Sign in to add a comment
Powered by Google Project Hosting