             switch stateChangeCounter {
             case 0:
                 // Step 0 open page
-                XCTAssertTrue(change.newValue == .inProgress(index: 0), "state should be in progress(0), was \(change.newValue)")
+                assertState(change.newValue, StepRunnerState.inProgress(index: 0))
             case 1:
                 // Step 1 jump step
-                XCTAssertTrue(change.newValue == .inProgress(index: 1), "state should be in progress(1), was \(change.newValue)")
+                assertState(change.newValue, StepRunnerState.inProgress(index: 1))
             case 2:
                 // Step 3
-                XCTAssertTrue(change.newValue == .inProgress(index: 3), "state should be in progress(3), was \(change.newValue)")
-                XCTAssertTrue(change.oldValue == .inProgress(index: 1), "should have come from step 1")
+                assertState(change.newValue, StepRunnerState.inProgress(index: 3))
+                assertState(change.oldValue, StepRunnerState.inProgress(index: 1))
             case 3:
-                XCTAssertTrue(change.newValue == .success, "state should be success, was \(change.newValue)")
+                assertState(change.newValue, StepRunnerState.success)
                 XCTAssertTrue(wasCalled)
                 XCTAssertEqual(stepRunner.model["step1"] as? Int, 123)
                 XCTAssertEqual(stepRunner.model["step3"] as? Int, 345)

        stepRunner.state.afterChange.add { change in
            switch stateChangeCounter {
            case 0:
                XCTAssertTrue(change.newValue == .inProgress(index: 0), "state should be in progress")
            case 1:
                XCTAssertTrue(change.newValue == .success, "state should be success, was \(change.newValue)")
                exp.fulfill()
            default:
                break
            }
            stateChangeCounter += 1
        }
        stepRunner.run()

        waitForExpectations()
    }


        var stateChangeCounter = 0
        stepRunner.state.afterChange.add { change in
            switch stateChangeCounter {
            case 0...1:
                assertState(change.newValue, StepRunnerState.inProgress(index: stateChangeCounter))
            case 2:
                assertState(change.newValue, StepRunnerState.success)
                exp.fulfill()
            default:
                break
