I've just started writing unit tests and I've encountered an issue. So far I've dug through different blogs on google and stackoverflow but I haven't been able to resolve this.
Every time I write a function to be tested the run button (shaped like a diamond) does not appear. The only run buttons that do show up are the default functions created by Xcode when you create a new unit test target.
Here's an example of the issues.
Xcode screenshot
Could it be a bug or am I missing something?
To add a unit test target to an existing Xcode project, choose File > New > Target. Select your app platform (iOS, macOS, watchOS, tvOS) from the top of the New Target Assistant. Select the Unit Testing Bundle target from the list of targets.
To measure and visualize code coverage for a project, follow these steps: Enable code coverage date gathering. To do this, go to Product › Scheme › Edit Scheme... , and select Test from the left hand side menu. Under the Info section, check the Gather coverage data box.
Key Concepts of XCUITest XCTest: XCTest is a testing framework that allows you to create and run UI tests, unit tests, and performance tests for your Xcode projects in Swift and Objective-C languages. It is pre-built with Xcode.
test needs to be on the front of the function signature. ie: test"functionName"()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With