     }
 
     func testCancellingTransaction() throws {
-        let client = try makeClient()
-        let exp = self.expectation(description: "testCancellingTransaction")
-
-        try client.executeAsTransaction() { (tx) in
-            tx.markAsFailed()
-            exp.fulfill()
-        }
-
-        self.waitForExpectations(timeout: TheoTimeoutInterval, handler: { error in
-            XCTAssertNil(error)
-        })
-
+        measure {
+            do {
+                let client = try self.makeClient()
+                let exp = self.expectation(description: "testCancellingTransaction")
+                
+                try client.executeAsTransaction() { (tx) in
+                    tx.markAsFailed()
+                    exp.fulfill()
+                }
+                
+                self.waitForExpectations(timeout: TheoTimeoutInterval, handler: { error in
+                    XCTAssertNil(error)
+                })
+            } catch { XCTFail() }
+        }
     }
 
     func testTransactionResultsInBookmark() throws {

        Theo_000_BoltClientTests.runCount = Theo_000_BoltClientTests.runCount + 1
    }

    private func performConnectSync(client: BoltClient, completionBlock: (() -> ())? = nil) {

        let result = client.connectSync()
        switch result {
        case let .failure(error):
            XCTFail("Failed connecting with error: \(error)")
        case let .success(isSuccess):
            XCTAssertTrue(isSuccess)
        }
        completionBlock?()
    }



        if Theo_000_BoltClientTests.runCount % 2 == 0 {
            let group = DispatchGroup()
            group.enter()
            performConnect(client: client) { connectionSuccessful in
                XCTAssertTrue(connectionSuccessful)
                group.leave()
            }
            group.wait()
        } else {
            performConnectSync(client: client) { connectionSuccessful in
                XCTAssertTrue(connectionSuccessful)
            }
        }

        return client
