3

I'm creating ui tests in xcode using XCTest(Swift) How can I run, for example, 2-3 tests from one class without launching the rest of the test from this class? Is it possible to add some tests to suite or run and run from command line just necessary suite/run?

According to the XCTestSuite documentation there is an option to create a custom test suite, but I haven't found any examples of it.

vvvvside
  • 31
  • 1
  • 3

2 Answers2

3

You can adjust which tests you want to run in the scheme, under the Test menu. There will be a list of your test classes and tests in a disclosure triangle hierarchy in the Edit Scheme > Test window, where you can select or deselect tests. When you run the tests with that scheme selected, only the tests you selected will run.

Oletha
  • 7,324
  • 1
  • 26
  • 46
  • yes, I can see it. but I need to have several test runs with different tests from command line. and changing scheme is not an option. – vvvvside Jan 24 '17 at 10:25
  • Look at using scan, which allows you to specify scheme from the command line, so you would be able to configure multiple schemes with different tests: https://github.com/fastlane/fastlane/blob/master/scan/README.md – Oletha Jan 24 '17 at 10:27
  • but what if I want to run one test in different runs? it's not good to add the same test to different schemes... – vvvvside Jan 24 '17 at 14:28
2

You can use multiple -test-only params in your run xcodebuild test [...] -only-testing:"superApp/SuperTestClass/test2" -only-testing:"superApp/SuperTestClass/test5"

Che
  • 501
  • 2
  • 10