Thursday, March 8, 2012

Happy Women's Day!

Happy International Women's Day ladies!:) I came across a few good reads today and wanted to share them here on my blog..

How girl geeks can get the best tech jobs
http://edition.cnn.com/2012/03/07/business/women-in-technology/index.html?hpt=hp_c2
I currently work for a IT company founded by a woman (in fact I believe it is the only IT company in Sri Lanka run by a woman; Ms. Lakmini Wijesundera), and I'm proud of it. It's a known fact that the IT industry is male dominated. This post outlines what women need to do to get ahead in the tech industry.

Women embrace your inner geek 
http://edition.cnn.com/2012/03/07/business/weili-dai-women-geeks/index.html
Weli Dai co founder of Marvell Technology Group writes on how women should embrace their inner geek.

How to have more Sheryl Sandbergs
http://edition.cnn.com/2012/03/05/business/martin-sandberg-women-confidence/index.html


Tuesday, January 24, 2012

Creating multiple targets in an iOS project

There can be many reasons why you would want to create multiple targets for an iOS project.

- You may want a separate Release Target and a Debug target so you can restrict logging to the Release target
- You may want to build a separate target for testing the application
- You may want to build a slightly different version of the current application (eg: Free and Paid versions for the same app)

The advantage of maintaining one project with multiple targets for such cases is quite obvious, when there are code changes that should apply to both applications you don't need to repeat those changes changes in separate projects.

Given below are the steps you need to follow to make a new target for an iOS project in XCode (I am using Xcode 3.2 but the steps should be similar for Xcode4).

1. Create a new target

From xcode menu select Project -> New Target (the dialog below will open).


Select 'Cocoa Touch - Application' and then NextSet target name (eg: 'NewTarget')
Check that the project is defined correctly and then click Finish to add the new target.
Now the new target will be visible in the targets sections of Groups&Files pane (project file view).


2. Copy files from existing target

Since you are making a new target for the same application code you need to copy over the files in the existing target of the project. Select and drag over the files in the following folders to the 'NewTarget'.

Copy Bundle Resources
Compile Sources
Link Binary With Libraries

After copying make sure the folders Copy Bundle Resources, Compile Sources, Link Binary With Libraries in the 'NewTarget' don't have any duplicate files. Checking this will help you avoid compiler warnings.

3. Set build settings

Before you can build and run the new target you created, you need to set the following build settings correctly. To change build settings double click the 'NewTarget' icon (this will open the target's properties dialog - see image below) and select the Build tab.



- Check that Base SDK is set correctly
- 'Compile Sources As' should be set to Objective-C (if it is set to 'According to file type' this will likely cause compile errors)
- Check the 'Info.plist File' is set correctly. You can edit this file to change the 'NewTarget' settings such as icon, launch screen etc.

4. Run the NewTarget!

Now from the xcode menu select Project -> Set Active Target and select the 'NewTarget'.
Build and run:)

Creating new targets in this way will create a new .app file (new executable) which you can use for application testing or release.

Tuesday, December 27, 2011

UI Test Automation in iOS

A few months back I did a blogpost on Android UI Testing http://hariniachala.blogspot.com/2011/09/android-application-ui-testing-with.html. This post covers the inbuilt tools available in iOS for automated UI testing.

iOS SDK 4 included the 'Automation' tool for UI test automation. However the procedure is a bit cumbersome. There is no record and playback tool for test and all tests have to be scripted.

To run the Automation tool in Xcode 4 or higher open your iOS project and select Product -> Profile from menu. Next select the Automation icon from the wizard that opens.



When instruments opens with Automation tool selected you will see the following window..



In the Scripts section select Add and Create. This will create a new ui test automation script. These scripts are written in javascript. Below is an example script..

UIALogger.logStart("Logging…");
UIATarget.localTarget().logElementTree();
UIATarget.localTarget().frontMostApp().mainWindow().elements()[2].elements()[1].tap();
UIALogger.logPass();

This script starts by logging the message "Logging.." and then logging the element hierarchy of the currently selected window in the application. Logging the element hierarchy here helps us to understand how we should call a specific element in the window. You can also call elements by their label. See Apple's documentation (http://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/Built-InInstruments/Built-InInstruments.html#//apple_ref/doc/uid/TP40004652-CH6-SW76) for details. After determining the element heirarchy we use that information to call a tap() (identical to a physical tap) on that element. We close the logging with logPass().

Next you need to select the application target on which you want to run the test script. See the screenshot below for details on how to do this..



Now you can run your test by clicking on the record button. Watch and monitor the trace log as your test runs on the simulator.

In this manner even a complex UI test flow can be automated, especially if that test procedure needs to be repeated (eg: generating reports for different data). However as you can see the procedure of writing the automated test is quite time consuming.

Conclusion : Comparing the tools available for UI test automation currently android seems to be one step ahead in the game (it provides a test record and playback tool (see my previous blogpost on android ui testing ). Still both mobile platforms have a lot to be improved in their automation test tools..

References:

http://stackoverflow.com/questions/3801344/how-do-i-test-my-ios-apps
http://developer.apple.com/library/ios/#documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/Built-InInstruments/Built-InInstruments.html#//apple_ref/doc/uid/TP40004652-CH6

Thursday, September 22, 2011

Samsugn Lab.dev

Samsung's Lab.dev is another cloud based mobile application testing service. This article is a summary of my experience with it specific to Android. The site also supports Windows Mobile, Java and bada testing.

What's great about it:)

- It's free!

What's not so great about it:(

- Limited functionality (no automated testing)
- Limited devices (only Samsung devices)
- Each session on a device is valid for a max of 30min.


For those of you who would like to try it out here's how..

Go to https://innovator.samsungmobile.com/mbr/individual.mbr.add.do and register a new account. Sign in with the new account you created. Select Android page (see screen shot below..)



Now select Lab.dev from left of the screen (see pic below..)



Now click the Android button (see pic..)



A requirements test will follow. If all requirements are met you can proceed to the lab screen where you can select the device you want from what is available (see screen..). One you've decided on a device select 'Start' to download the java web start app(.jnlp file) that will show you the running device (grant required permissions for the application to run on your pc).




You can test your android apps on the device by downloading the .apk files onto it over the internet.

More screenshots...