-
Author fast and reliable tests for Xcode Cloud
Discover how you can create effective testing plans for Xcode Cloud, Apple's continuous integration and continuous delivery service. We'll show you how testing can be an essential tool to consistently verify your code works correctly. Learn how you can author fast, reliable, and efficient tests for Xcode Cloud, avoid irrelevant failures, and verify your code changes quickly.
Recursos
Vídeos relacionados
WWDC23
WWDC22
- Deep dive into Xcode Cloud for teams
- Get the most out of Xcode Cloud
- What's new in Xcode
- WWDC22 Day 4 recap
WWDC21
- Customize your advanced Xcode Cloud workflows
- Diagnose unreliable code with test repetitions
- Embrace Expected Failures in XCTest
- Meet Xcode Cloud
WWDC20
WWDC19
WWDC18
-
Buscar neste vídeo...
-
-
3:37 - setUp()
override func setUp() async throws { } -
3:46 - setUp() example
var truck: Truck! override func setUp() async throws { let directoryURL = FileManager.default.temporaryDirectory let fileName = UUID().uuidString let fileURL = directoryURL.appendingPathComponent(fileName, isDirectory: false) let data = await mockDonutMenuData() try data.write(to: fileURL) truck = Truck(menuURL: fileURL) } -
5:55 - Environment variable example
var truck: Truck! func testOrderDonut() throws { let host = ProcessInfo.processInfo.environment["BASE_URL"] let expectation = XCTestExpectation(description: "Order donut") truck.order(with: .sprinkles, host: host) { error, donut in XCTAssertTrue(donut.hasSprinkles) expectation.fulfill() } wait(for: [expectation], timeout: 5) } -
6:00 - XCTSkip example
var truck: Truck! func testOrderDonut() throws { let host = ProcessInfo.processInfo.environment["BASE_URL"] try XCTSkipIf(host == "prod.example.com") let expectation = XCTestExpectation(description: "Order donut") truck.order(with: .sprinkles, host: host) { error, donut in XCTAssertTrue(donut.hasSprinkles) expectation.fulfill() } wait(for: [expectation], timeout: 5) } -
8:18 - XCTSkip example
var truck: Truck! func testOrderDonut() throws { let host = ProcessInfo.processInfo.environment["BASE_URL"] try XCTSkipIf(host == "prod.example.com") let expectation = XCTestExpectation(description: "Order donut") truck.order(with: .sprinkles, host: host) { error, donut in XCTAssertTrue(donut.hasSprinkles) expectation.fulfill() } wait(for: [expectation], timeout: 5) } -
8:48 - XCTestExpectation example
var truck: Truck! func testOrderDonut() throws { let host = ProcessInfo.processInfo.environment["BASE_URL"] try XCTSkipIf(host == "prod.example.com") let expectation = XCTestExpectation(description: "Order donut") truck.order(with: .sprinkles, host: host) { error, donut in XCTAssertTrue(donut.hasSprinkles) expectation.fulfill() } wait(for: [expectation], timeout: 5) } -
8:59 - Increase XCTestExpectation example
var truck: Truck! func testOrderDonut() throws { let host = ProcessInfo.processInfo.environment["BASE_URL"] try XCTSkipIf(host == "prod.example.com") let expectation = XCTestExpectation(description: "Order donut") truck.order(with: .sprinkles, host: host) { error, donut in XCTAssertTrue(donut.hasSprinkles) expectation.fulfill() } wait(for: [expectation], timeout: 10) } -
9:16 - Async/await example
var truck: Truck! func testOrderDonut() async throws { let host = ProcessInfo.processInfo.environment["BASE_URL"] try XCTSkipIf(host == "prod.example.com") let donut = try await truck.orderDonut(with: .sprinkles, host: host) XCTAssertTrue(donut.hasSprinkles) } -
10:02 - XCTExpectFailure example
var truck: Truck! func testOrderDonut() async throws { let host = ProcessInfo.processInfo.environment["BASE_URL"] try XCTSkipIf(host == "prod.example.com") let donut = try await truck.orderDonut(with: .sprinkles, host: host) XCTAssertTrue(donut.hasSprinkles) } -
10:06 - XCTExpectFailure example
var truck: Truck! func testOrderDonut() async throws { let host = ProcessInfo.processInfo.environment["BASE_URL"] try XCTSkipIf(host == "prod.example.com") XCTExpectFailure("<https://dev.myco.com/bug/98> Donut ordering service is down") let donut = try await truck.orderDonut(with: .sprinkles, host: host) XCTAssertTrue(donut.hasSprinkles) }
-