How to use spec method of QuickDescribeTests class

Best Quick code snippet using QuickDescribeTests.spec

Run Quick automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

DescribeTests.swift

Source: DescribeTests.swift Github

copy
1import XCTest
2import Nimble
3import Quick
4
5#if _runtime(_ObjC) && !SWIFT_PACKAGE
6
7final class DescribeTests: XCTestCase, XCTestCaseProvider {
8    static var allTests: [(String, (DescribeTests) -> () throws -> Void)] {
9        return [
10            ("testDescribeThrowsIfUsedOutsideOfQuickSpec", testDescribeThrowsIfUsedOutsideOfQuickSpec)
11        ]
12    }
13
14    func testDescribeThrowsIfUsedOutsideOfQuickSpec() {
15        expect { describe("this should throw an exception", {}) }.to(raiseException())
16    }
17}
18
19class QuickDescribeTests: QuickSpec {
20    override func spec() {
21        describe("Describe") {
22            it("should throw an exception if used in an it block") {
23                expect {
24                    describe("A nested describe that should throw") { }
25                }.to(raiseException { (exception: NSException) in
26                    expect(exception.name).to(equal(NSExceptionName.internalInconsistencyException))
27                    expect(exception.reason).to(equal("'describe' cannot be used inside 'it', 'describe' may only be used inside 'context' or 'describe'. "))
28                })
29            }
30        }
31    }
32}
33
34#endif
35
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Most used method in QuickDescribeTests

Trigger spec code on LambdaTest Cloud Grid

Execute automation tests with spec on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)