Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run only one ui-test from fastlane?

how can I run only one ui-test by XCTest from fastlane?

I know about parameters for fastlane: only_testing but not understood how to use this. Can you give an example

I run my all ui-tests as:

fastlane ios RunningUITests but want fastlane ios RunningUITests only_testing:GTUITests/GT00FirstClass/testFunc this not work for me

Can you give an exactly example for this?

like image 292
Ivan Sorokoletov Avatar asked Jul 29 '19 15:07

Ivan Sorokoletov


People also ask

How do you run a UI test?

Go to File > New > Target. Then, search for UI Testing Bundle. Select Unit Testing Bundle and then click Next. As UI tests take time, it is usually best to stop immediately when a failure occurs.

How do I add a UI test to Xcode project?

The easiest way to add a unit test target to your project is to select the Include Tests checkbox when you create the project. Selecting the checkbox creates targets for unit tests and UI tests. To add a unit test target to an existing Xcode project, choose File > New > Target.

What does Xcode build for testing do?

Description. The Step runs Xcode's xcodebuild command with the build-for-testing option. This builds your app and associated tests so that you can, for example, upload it to a third-party testing service to run your tests on a real device.


1 Answers

You have to use the scan (also known as run_tests) "action". Read this documentation for information.

There, you can see the instructions for calling it directly on the command line. In your example it would be:

fastlane scan --workspace "<YourRunningUITests>.xcworkspace" --scheme "<YourRunningUITestsScheme>" --only-testing "GTUITests/GT00FirstClass/testFunc"

Replace the values inside of the angled brackets (< >) with the values appropriate to your code.

However, rather than running that multi-parameter call from the command line, I recommend using a Fastfile to consolidate your logic and allow you to perform more sophisticated logic (such as these Fastfiles).

If you were to follow the logic suggested here, you could then simply call fastlane tests from the command line. Much simpler.

like image 200
Lyndsey Ferguson Avatar answered Nov 09 '22 12:11

Lyndsey Ferguson