We have two different kind of picker controls — UIPickerView and UIDatePicker. UIPickerView is used for any non date related fields and UIDatePicker is strictly used when we are dealing with date/time.

Photo by Djim Loic on Unsplash

How to select value from UIPickerView?

I want to select “Santa Clara”.

If you want to automate your Web Application in Mobile Safari Browser or Native Application screen with having Web Page, then generally you use Appium. Using Appium, you write a normal WebDriver test with a special set of desired capabilities and you can automate your Web Application.

Appium internally using ios-webkit-debug-proxy as a Remote Debugger to automate or communicate with Mobile Safari Browser.

Photo by Brett Jordan on Unsplash

For the last few years, Mobile Web Automation means Appium WebDriver. Well, I have found alternative solution to Automate Web Application or Single Web Page of your native application using XCUITests, YES, it can be achievable. …

Wait is an important command used in XCUITests Automation for handling dynamic loading of UI Controls on a mobile application. Wait command in XCUITest helps to ensure that our mobile application is less flaky and is more reliable.

Flaky tests

Unreliable tests, also known as a ‘flaky tests’ are typically characterised by a test that can both pass and fail on subsequent executions without any changes to code. Such tests can introduce wastage in the software delivery life-cycle when verifying false positives, maintenance, and re-execution becomes required.


Perhaps one of the most notable drawbacks of creating an automated end-to-end testing solution is…

Photo by Gustas Brazaitis on Unsplash

This post covers how to handle Assertion Failure in XCUITests. Test scripts can be very robust and large. Assertions are the best method to perform any kind of validations in the tests. When an assertion fails the test script stops execution unless handled in some form.

There are two types of assertions:

  1. Hard Assertions
  2. Soft Assertions
open var continueAfterFailure: Bool

@property continueAfterFailure
- Determines whether the test method continues execution after an XCTAssert fails.
- By default, this property is YES, meaning the test method will complete regardless of how many
- XCTAssert failures occur. Setting this to NO causes the test method…

Xcode Test Plans

Running your tests with different environments, localizations and sanitizers is a good way to catch more bugs. You can use schemes to create the different configurations but that quickly becomes unmanageable.

Apple added test plans to Xcode 11 to make it easier to rerun tests with varying test configurations. Here’s my notes on how to get started with test plans.

Photo by Felipe Furtado on Unsplash

What is a Test Plan?

An Xcode test plan provides a way to run a selections of tests with various test configurations. The test plan is a JSON file with the .xctestplanextension that you add to your Xcode project and reference from a scheme. …

Swift - the language to write XCUITests script in now days.

Swift is a general-purpose programming language built using a modern approach to safety, performance, and software design patterns.

Type-Safe: The most obvious way to write code should also behave safely. Undefined behavior is the enemy of safety, and developer mistakes should be caught before the software is in production. Opting for safety sometimes means Swift will feel strict, but we believe that clarity saves time in the long run.

However, there are many other checklists like max characters in the line, line of code for function and file, etc…

What is Test Listener in XCUITests?

The listener is defined as an interface that modifies the default Test’s behavior. As the name suggests Listeners “listen” to the event defined and behave accordingly.

In XCUITests, the terminology of listeners is quite different compare to the TestNG testing framework.

In XCUITests, listeners are known as Observers. In Java, we have an interface to implement methods, however, in Swift, we have a protocol to conform methods.

Essentially Swift protocols are very similar to Java interfaces except for
It can be used by conforming to the XCTestObservation protocol.

Now, What is XCTestObservers?

The XCTestObservation protocol defines methods that are called in response to significant…

Photo by Tyler Lastovich on Unsplash

Launch arguments are probably most commonly used as input to command-line tools. XCUITests has available framework APIs to pass the launch arguments and launch environment variables.

Any argument passed on launch will override the current value in NSUserDefaults for the duration of execution. While this can be used for domain-specific testing and debugging.

While writing XCUITest tests, it’s essential to configure our app in the state where we can do the tests reliably.

launchArguments: The arguments that will be passed to the application on launch. If not modified, these are the arguments that Xcode will pass on launch. …

In this post, Automation Engineer can learn a better way of organizing locators for XCUITests using Swift enumerations.

Using the automation of any application makes sure that the application is working as expected. Since Apple introduced UI testing support at WWDC 2015, this framework has been popular among iOS developers and later on adopted by Automation Engineers, as they can now write UI tests in Swift. In this post, we will see how to organize the locators, on the screens using Swift enumerations in a better way.

Photo by David Pupaza on Unsplash

Best Way To Store Locators

While using Selenium, Appium or any other automation framework, the most common pattern…

Photo by Marten Newhall on Unsplash

Apple has introduced XCUITests framework to automate iOS applications. It’s highly recommended to explore XCUIElementQuery API in detail to find an element.

· XCUIElementQuery — This class is responsible for finding elements in the view using different types of queries. The query should return a unique UI element.

Find UI Element

While writing XCUITest tests for iOS apps, it’s important to find an element in the view. We have to use XCUIElementQuery to find the unique element on the page. There are different techniques to reach a unique element. The most common one is Subscripting.

If we want to find all the buttons…

Nishit Shah

Automation Architect

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store