I want to do unit testing in iOS. By default test classes are created using XCTest framework classes in Xcode 5. I have used SenTestingKit in earlier versions of iOS. What are the differences between these two frameworks? What are the advantages of XCTest framework. I googled for related documentation but I did not find any. Only thing I found is the interface classes to use inside the kit. Can anyone point me to the related resources.
Use the XCTest framework to write unit tests for your Xcode projects that integrate seamlessly with Xcode's testing workflow. Tests assert that certain conditions are satisfied during code execution, and record test failures (with optional messages) if those conditions aren't satisfied.
475. A testing framework that allows to create and run unit tests, performance tests, and UI tests for your Xcode project. Tests assert that certain conditions are satisfied during code execution, and record test failures if those conditions are not satisfied.
XCTest was first announced at WWDC 2016, alongside the release of iOS 10. Before XCTest, automated testing on iOS was only possible using the UI Automation framework via instruments.
XCTest / XCUITest is pure iOS and cannot help the team that needs to test both iOS and Android devices. XCUITest was built for the iOS and Xcode Developer in mind and focuses less on the QA Automation Engineer. What is Espresso? Like XCTest, Espresso is a native framework for UI testing.
XCUITest is less stable and reliable when testing on real devices, making it not ideal for smoke and regression testing. XCUITest is limited in it’s support for a variety of languages.
XCUITest is a great “anti-flake” option when testing on emulators and/or running unit tests, but this benefit does start to dwindle when testing on real devices. XCUITest is less stable and reliable when testing on real devices, making it not ideal for smoke and regression testing.
XCUITest is a native framework for UI testing on iOS mobile devices. Since XCUITest is baked right into Xcode IDE, it provides the fastest possible testing for iOS devices. However, there are several limitations to be aware of in addition to the several major benefits.
Apple's documentation is notably lacking with regards to testing. It's a shame, because spending five minutes with XCTest made me fall for it. So, here are some docs that you may find useful.
First, stop and watch the WWDC video about testing: https://developer.apple.com/wwdc/videos/?include=409#409 (must be a registered developer)
Then, read about Bots. They're the real magic in XCTest. I'm currently setting up an environment of a Mac Mini running Mavericks Server connected to a small array of iPod Touches, iPhones and iPads that will simultaneously run my unit tests and report back. It's damn near magic.
https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/xcode_guide-continuous_integration/000-About_Continuous_Integration/about_continuous_integration.html#//apple_ref/doc/uid/TP40013292
All that said, I don't know SenTest well enough to compare the two. But I am learning XCTest, so here are a few thoughts on what I'm really digging about it so far.
And, a few cons for measure:
My two cents. Hope it helps. I'd really recommend watching that video I linked to - they do live test creation and make a really compelling case for unit testing in general, regardless of if you use XCTest.
XCTest are included by default with ios7 and integrate better with the new continuous integration functionality.
https://developer.apple.com/technologies/tools/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With