Swiftpack.co - q231950/rorschach as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
q231950/rorschach
Write Xcode UI Tests BDD style 🤷🏻‍♂️
.package(url: "https://github.com/q231950/rorschach.git", from: "v1.1.0")
The Rorschach Logo

This package allows you to write tests in a BDD style.

It's Swift's result builders that allow for a lightweight DSL that makes your tests way more readable.

Take a look at the following example:

func test_simple_example() {

    let context = UniverseContext()

    expect {
        Given("I have a universe without any stars") {
            context.numberOfStars = 0
        }
        When("I add a couple of stars") {
            context.numberOfStars = 23
        }
        Then("I can see the stars I have added ✨") {
            XCTAssertEqual(context.numberOfStars, 23)
        }
    }
}

Please note that the contents of each step like context.numberOfStars = 23 for example, are arbitrary Swift code - you are free to add your abstractions on a Page Object Model or the like as you need them.

The test run leads to this result in Xcode's Report Navigator. An easy to read output that can easily be understood in case of a failure.

Corresponding test result in Xcode's Report Navigator Corresponding test result with failure in Xcode's Report Navigator

Contributions are much appreciated. Any kind of feedback about whether or not this is helpful for you or if you want to share ways to improve Rorschach are highly welcome. Reach out on Twitter to q231950 or create a new issue.

GitHub

link
Stars: 35
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

Crouching Cloud
18 weeks ago

Subclassing of Steps and Assertions is no longer necessary and the obligatory Context has been removed.

Find some examples of the usage in pr https://github.com/q231950/rorschach/pull/3.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics