Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alexmx/Combinations

A blazingly fast runtime test generator suited for boundary testing.
https://github.com/alexmx/Combinations

brute-force ios testing ui-testing unit-testing xctest

Last synced: about 2 months ago
JSON representation

A blazingly fast runtime test generator suited for boundary testing.

Awesome Lists containing this project

README

        

# Combinations

[![Twitter: @amaimescu](https://img.shields.io/badge/contact-%40amaimescu-blue.svg)](https://twitter.com/amaimescu)
[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/alexmx/ios-ui-automation-overview/blob/master/LICENSE)

**Combinations** is an iOS testing utility framework suited for fast **boundary testing**.

> **Boundary testing** or **boundary value analysis**, is where test cases are generated using the extremes of the input domain, e.g. maximum, minimum, just inside/outside boundaries, typical values, and error values. It is similar to Equivalence Partitioning but focuses on "corner cases".

The framework does just two simple things:

1. Generate a set of combinations from test data input set;
2. Generate a run-time unit or UI test for each of the combinations;

Check out the [API reference](http://alexmx.github.io/Combinations/) for more information.

#### Simple example:
We have an input form with four fields: `First Name`, `Email`, `Password` and `Gender`.

We also have our testing boundary values defined for each field:
* First Name: `John Smith`, `empty string`
* Email: `[email protected]`, `john.smith@`, `empty string`
* Password: `12345`, `~@#123ABC`, `empty string`
* Gender: `Male`, `Female`

**Combinations** gets a set of input test data values and transforms it in **run-time tests for each generated combination of values**.

So for our example the combinations will be:
* [`John Smith`, `[email protected]`, `12345`, `Male`]
* [`John Smith`, `[email protected]`, `12345`, `Female`]
* [`John Smith`, `[email protected]`, `~@#123ABC`, `Male`]
* [`John Smith`, `[email protected]`, `~@#123ABC`, `Female`]
* etc.

For each of this combinations will be generated a test (`XCTestCase`)

A running example of the UI Tests generated by Combinations:

![Combinations](/assets/ui-tests-example.gif)

## Installation

#### Carthage

If you are using **Carthage**, you can always use it to build the library within your workspace by adding the line below to your `Cartfile`.

```
github "alexmx/Combinations"
```

#### CocoaPods

If you are using **CocoaPods**, you can as well use it to integrate the library by adding the following lines to your `Podfile`.

```ruby
platform :ios, '8.0'
use_frameworks!

target 'YourAppTarget' do
pod "Combinations"
end

```

#### Manual installation

In order to include the **Combinations** library into your project, you need to build a dynamic framework from provided source code and include it into your project, or inlcude the entire **Combinations** library as sub-project by copying it to your project directory or include as Git submodule.

## Usage

The library requires just two methods to be overriden: `valuesForCombinations` and `assertCombination:`

```swift
import XCTest
import Combinations

class MyTests: CombinationsSpec {

override func setUp() {
super.setUp()
}

// Provide input values for Combinations
override class func valuesForCombinations() -> [[Any]]? {
return [
[1, 2, 3, 4],
["John Smith", "John", ""]
]
}

// This method will be called for each generated combination:
// [1, "John Smith"], [1, "John"], [1, ""], [2, "John Smith"], etc.
override func assertCombination(_ combination: [Any]) {

// Perform required asserts on combination
}
}
```

## License
This project is licensed under the terms of the MIT license. See the LICENSE file.