Skylark 0.0.4

Skylark 0.0.4

Maintained by Ross Butler.



Skylark 0.0.4

  • By
  • Ross Butler

Skylark

CI Status Version Carthage compatible License Platform

Features

  • Execute feature files containing scenarios written using Gherkin
  • Scenario outlines with examples
  • Tag expressions
  • Retry failed scenarios

Advantages

  • Easy set up - just add Skylark.framework to your UI testing target in Xcode.
  • No context switching between different languages - write all your test code in Swift.
  • The --retry flag allows tests to be retried a number of times so that a flaky test will not cause the build to be marked as a failure in your CI process (so long as it succeeds the majority of the time) however the test will be marked as flaky.
  • Many common steps in your scenarios will work out of the box such as checking a particular screen or element has been displayed.

Usage

To get started import the Skylark and XCTest frameworks into your UI testing target, create an XCTestCase subclass as usual and instantiate an instance of the test runner. Ensure that your feature file has been added to your UI test bundle with the file extension .feature then invoke test(featureFile:) to run your scenarios.

import Foundation
import Skylark
import XCTest

class MyUITests: XCTestCase {
    // Obtain test runner instance
    lazy var testRunner = Skylark.testRunner(testCase: self)
    
    // Run scenarios from feature file
    func testFromFeatureFile() {
        testRunner.test(featureFile: "Main")
    }
   
}

Skylark endeavors to limit the amount of additional Swift code you need to write on top of your feature files to get your tests to run. To this end, most existence checks (checking whether an element is displayed onscreen) and interaction checks e.g. tapping buttons will work out of the box. To take advantage of this functionality, simply create a JSON file with the file extension .screen describing the elements on a screen e.g.

{
    "name": "Main",
    "buttons": {
        "Test": "test-button"
    }
}

In the above the keys are the names of the elements as you would refer to them in your feature files and the values are the accessibility identifiers assigned to your UIKit elements (label text may be used where no accessibility identifier has been assigned).

For steps that require a little more work to set up the test runner provides a number of methods for registering steps to be executed. Using these you can provide the Swift code to be executed when a given step is encountered.

Installation

Cocoapods

CocoaPods is a dependency manager which integrates dependencies into your Xcode workspace. To install it using RubyGems run:

gem install cocoapods

To install Skylark using Cocoapods, simply add the following line to your Podfile:

pod "Skylark"

Then run the command:

pod install

For more information see here.

Carthage

Carthage is a dependency manager which produces a binary for manual integration into your project. It can be installed via Homebrew using the commands:

brew update
brew install carthage

In order to integrate Skylark into your project via Carthage, add the following line to your project's Cartfile:

github "rwbutler/Skylark"

From the macOS Terminal run carthage update --platform iOS to build the framework then drag Skylark.framework into your Xcode project.

For more information see here.

Author

Ross Butler

License

Skylark is available under the MIT license. See the LICENSE file for more info.

Additional Software

Frameworks

  • Connectivity - Improves on Reachability for determining Internet connectivity in your iOS application.
  • Skylark - Fully Swift BDD testing framework for writing Cucumber scenarios using Gherkin syntax.
  • TailorSwift - A collection of useful Swift Core Library / Foundation framework extensions.
  • TypographyKit - Consistent & accessible visual styling on iOS with Dynamic Type support.

Tools

Connectivity Skylark TypographyKit Palette
Connectivity Skylark TypographyKit Palette