UnitTests demonstrates how to implement unit tests and UI tests. It is a workspace that contains two projects: Calc and Calc (macOS). Calc builds an iOS app and CalculatorKit. Calc (macOS) builds an macOS app and a macOS version of CalculatorKit. Both apps use CalculatorKit, which is a framework, to process user input and perform related arithmetic operations.
- Xcode 8.3 or later
- iOS 10.3 SDK or later
- macOS 10.11 SDK or later
- iOS 9.3 or later
- mac OS 10.11 or later
The Calc project defines two schemes: Calc Builds the Calc app and performs its UI tests.
CalculatorKit Builds the CalculatorKit framework. Performs unit tests on the Calculator class.
Calc (macOS) Builds the macOS Calc app and performs its UI tests.
CalculatorKit (macOS) Builds the macOS version of CalculatorKit. Performs unit tests on the Calculator class.
To run unit tests,
- From the Scheme pop-up menu in the toolbar, select CalculatorKit (iOS) > <device_simulator> or CalculatorKit (macOS) >
- Use either of the following approaches to proceed: a. Choose Product > Test to run all the test cases implemented in the Calculator.m file, then navigate to View > Navigators > Show Report Navigator to view the test results. See Xcode Help > Run and Debug > View and filter logs and reports for more information.
b. Choose View > Navigators > Show Test Navigator to navigate to the Test navigator. Hover the pointer over any test target or test class to display a run button, then click the button to run the tests. See Xcode Help > Run UI tests and unit tests for more information.
To run UI tests,
- From the Scheme pop-up menu in the toolbar, select Calc (iOS) > or Calc (macOS) > .
- Use either of the following approaches to proceed: a. Choose Product > Test to run all the test cases implemented in the Calculator.m file, then navigate to View > Navigators > Show Report Navigator to view the test results. See Xcode Help > Run and Debug > View and filter logs and reports for more information.
b. Choose View > Navigators > Show Test Navigator to navigate to the Test navigator. Hover the pointer over any test target or test class to display a run button, then click the button to run the tests. See Xcode Help > Run UI tests and unit tests for more information.
Copyright (C) 2012-2017 Apple Inc. All rights reserved.