Overview
The article discusses the implementation of UI automation testing for the LinkedIn Flagship app, focusing on the selection and optimization of the KIF framework. It highlights the challenges faced with test reliability and performance, and details the improvements made to enhance the testing process.
What You'll Learn
1
How to select a UI automation framework based on reliability and speed
2
Why minimizing hard-coded timings in UI tests improves reliability
3
How to implement notifications for asynchronous UI testing
Prerequisites & Requirements
- Understanding of UI automation concepts
- Experience with Objective-C or Swift
Key Questions Answered
What were the main challenges faced with the KIF framework?
The main challenges included non-deterministic behavior of tests, slow execution times, and flaky tests that would fail intermittently. These issues led to frustration among engineers as unrelated changes could cause test failures, undermining confidence in the CI process.
How did LinkedIn improve the KIF framework for better performance?
LinkedIn improved KIF by eliminating hard-coded timings and replacing them with notifications for UI state changes. This allowed tests to run faster and more reliably, reducing the execution time of their test suite significantly from 90 minutes to just 9 minutes for 300 tests.
What specific optimizations were made to enhance KIF's performance?
Optimizations included implementing a notification system for UI state changes, adding new APIs for asynchronous operations, and improving the lookup speed for views by accessibility identifiers. These changes collectively enhanced the reliability and speed of the testing process.
Key Statistics & Figures
Test execution time
9 minutes
This was the time taken to run 300 tests after optimizations, down from 90 minutes.
Test coverage
10%
This was the initial test coverage before improvements were made to the testing framework.
Technologies & Tools
Some links below are affiliate links. We may earn a commission if you make a purchase.
Testing Framework
Kif
Used for UI automation testing of the LinkedIn Flagship app.
Programming Language
Objective-c
Utilized for writing tests in KIF.
Programming Language
Swift
Utilized for writing tests in KIF.
Key Actionable Insights
1Implement a notification-based system for UI state changes to improve test reliability.This approach allows tests to respond dynamically to changes, reducing the need for arbitrary wait times and improving overall test performance.
2Regularly review and optimize your UI automation framework to address performance bottlenecks.As applications evolve, testing frameworks may require updates to maintain efficiency and reliability, ensuring that they meet the demands of continuous integration.
3Encourage engineers to write tests in the same language as the application code to reduce overhead.This practice simplifies the testing process and promotes a culture of testing within the development team.
Common Pitfalls
1
Relying on hard-coded timings can lead to flaky tests that fail intermittently.
This occurs because different environments may execute actions at varying speeds, causing tests to fail when they shouldn't. Avoiding hard-coded waits and using notifications instead can mitigate this issue.
Related Concepts
UI Automation
Continuous Integration
Testing Frameworks
Asynchronous Programming