How to avoid committing my XCTestCase test credentials in public repo?

How would you design an XCTestCase that needed valid credentials to pass (+fail) authentication-related testing?

The key is doing so without committing credentials in a repo for the world to sniff out.

For now, I have the following:


let uid="me"
let pwd="my password"

final class test: XCTestCase { code-block  }

This works for me, for now ... how would you make the test less personal and more ready for public git repositories?

Answered by Developer Tools Engineer in 744910022

One option would be to include this password as a launch argument for your UI test target, and do not commit that launch argument in your repository.

You could separately configure a launch argument to be set in an Xcode Cloud run of your UI tests, and read it from your UI test suite.

Accepted Answer

One option would be to include this password as a launch argument for your UI test target, and do not commit that launch argument in your repository.

You could separately configure a launch argument to be set in an Xcode Cloud run of your UI tests, and read it from your UI test suite.

How to avoid committing my XCTestCase test credentials in public repo?
 
 
Q