LayoutTest-iOS alternatives and similar libraries
Based on the "UI Testing" category.
Alternatively, view LayoutTest-iOS alternatives based on common mentions on social networks and blogs.
-
Cucumber
A home for issues that are common to multiple cucumber repositories -
Bluepill
Bluepill is a reliable iOS testing tool that runs UI tests using multiple simulators on a single machine -
UI Testing Cheat Sheet
How do I test this with UI Testing? -
SwiftMonkey
A framework for doing randomised UI testing of iOS apps -
ViewInspector
Runtime introspection and unit testing of SwiftUI views -
TouchVisualizer
Lightweight touch visualization library in Swift. A single line of code and visualize your touches! -
robotframework-appiumlibrary
AppiumLibrary is an appium testing library for RobotFramework -
Subliminal
An understated approach to iOS integration testing. -
Remote
Control your iPhone from inside Xcode for end-to-end testing. -
ios-driver
Selenium server to test native, hybrid and web apps on IOS. Join us on IRC #ios-driver on freenode -
AutoMate
Swift framework containing a set of helpful XCTest extensions for writing UI automation tests -
Floater_
Add a floating fingertip to your app demo. www.buglife.com -
appium
Appium is an open source test automation framework for use with native and hybrid mobile apps. -
UITestHelper
UITest helper library for creating readable and maintainable tests -
UI tests without UI Testing experiment
Testing the UI without UI Testing, a Swift experiment. -
UIAutomation
JavaScript library to write test scripts that exercise your app’s user interface elements while the app runs on a connected device. -
Flawless App
tool for visual quality check of mobile app in a real-time. It compares initial design with the actual implementation right inside iOS simulator.
WorkOS - The modern identity platform for B2B SaaS
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of LayoutTest-iOS or a related project?
README
Overview
This library enables you to write unit tests which test the layout of a view in multiple configurations. It tests the view with different data combinations and different view sizes. The library works in both Objective-C and Swift.
To learn how to use this library, there is a LinkedIn Learning course you can access completely for free authored by Kyle Sherman. You can access it here. It will teach you how to use LayoutTest and all of its features by video tutorial.
Motivation
When creating views, apps often have conditional logic which depends on the data used to setup the view. LayoutTest provides an easy way to define a data spec (a dictionary) which is then used to generate many different combinations of data. The library then uses this data to layout your view multiple times. For example, this is a small portion of the tests ran in our sample app:
In just one test, your view will be laid out multiple times with different data. You can then run test assertions on these views to verify that the layout and view content is correct. Also, the library will run a few tests automatically such as checking for Autolayout errors, missing accessibility, and overlapping views. Finally, the library makes it easy to test each view with different sizes so you can verify the view will work on different devices.
Docs
To get started, you should take a look at the docs:
https://linkedin.github.io/LayoutTest-iOS
Installation
Add to your unit test target:
pod 'LayoutTest'
or
pod 'LayoutTest/Swift'
Example
A simple test would look something like this. Check the docs for more detailed information and examples.
Objective-C:
@interface SampleTableViewCellLayoutTests : LYTLayoutTestCase
@end
@implementation SampleTableViewCellLayoutTests
- (void)testSampleTableViewCellLayout {
[self runLayoutTestsWithViewProvider:[SampleTableViewCell class]
validation:^(UIView * view, NSDictionary * data, id context) {
// Add your custom tests here.
}];
}
@end
@implementation SampleTableViewCell (LayoutTesting)
+ (NSDictionary *)dataSpecForTest {
return @{
@"text": [[LYTStringValues alloc] init],
@"showButton": [[LYTBoolValues alloc] init]
}
}
+ (UIView *)viewForData:(NSDictionary *)data
reuseView:(nullable UIView *)reuseView
size:(nullable LYTViewSize *)size
context:(id _Nullable * _Nullable)context {
SampleTableViewCell *view = (SampleTableViewCell *)reuseView ?: [SampleTableViewCell viewFromNib];
[view setupWithJSON:data];
return view;
}
@end
Swift:
class SampleTableViewCellLayoutTests {
func testSampleTableViewCell() {
runLayoutTests() { (view: SampleTableViewCell, data: [NSObject: AnyObject], context: Any?) in
// Add your custom tests here.
}
}
}
extension SampleTableViewCell: LYTViewProvider {
class func dataSpecForTest() -> [NSObject: AnyObject] {
return [
"text": LYTStringValues(),
"showButton": LYTBoolValues()
]
}
class func viewForData(data: [NSObject: AnyObject],
reuseView: UIView?,
size: LYTViewSize?,
context: AutoreleasingUnsafeMutablePointer<AnyObject?>) -> UIView {
let cell = reuseView as? SampleTableViewCell ?? SampleTableViewCell.loadFromNib()
cell.setupWithDictionary(data)
return cell
}
}