UITestHelper | UITest helper library | UI Testing library
kandi X-RAY | UITestHelper Summary
kandi X-RAY | UITestHelper Summary
UITest helper library for creating readable and maintainable tests
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of UITestHelper
UITestHelper Key Features
UITestHelper Examples and Code Snippets
enum AccessibilityIdentifier {
enum HomeScreen: String {
case theLabel
case theTextField
case theButton
case switch1
case switch2
case showButton
case hideButton
}
}
override func viewD
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
workspace 'UITestHelper'
target 'UITestHelperApp' do
platform :ios, '9.0'
pod 'UITestHelper/App'
end
target 'UITestHelperUITests' do
platform :ios, '9.0'
pod 'UITestHelper'
// Only execute the closure if the element is there.
HomeScreen.theButton.ifExists { $0.tap() } // The button exist, so we do tap it
HomeScreen.hideButton.ifExists(2) { $0.tap() }
// The button does not exist, so we don't tap it, we do somet
Community Discussions
Trending Discussions on UITestHelper
QUESTION
I'd like to override the init function for XCTestCase in UI testing for a few reasons:
- To launch the app, outside of setUp() so that the app doesn't need to relaunch for every test (this is tedious and slows down tests)
- To initialize other classes that provide general navigation through the app, which must me initialized with a test case (self).
What I have now looks like this:
...ANSWER
Answered 2018-Jun-08 at 15:50init
is not the designated initializer of XCTestCase
. The designated initializer is initWithInvocation:
. This takes an NSInvocation
, which is not available in Swift. The only way to do what you're describing is in ObjC.
This isn't documented because it's not supported. It may be possible to achieve what you're describing, but it is likely to break in subtle ways, and you should explore other solutions to your problem.
The crashing is a byproduct of ObjC initialization semantics. Every ObjC class must respond to init
(because it's inherited from NSObject
). However, there are quite a few ObjC objects that do not initialize properly when init
is called. (NSError
is somewhat famous for this problem.) The only way to know is by documentation. The much more complex Swift initialization system is an attempt to remedy the problems in the ObjC initialization system.
I would break up your deeper goals into separate questions and ask how to address them (you should also make it very clear that you're talking about UI tests; while your code indicates that, it's not clear from the text). Make sure what you're describing isn't going to break Xcode 10's new parallel testing features, and changes to ordering.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install UITestHelper
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page