XCUITest integration with TestRail

Currently working on integrating my UITest-run results into TestRail, so after every test run it marks my tests as Pass\Fail in testrail.

The idea I have is:

  1. In CI create a "pre-build" script that will create a test run in testrail.
  2. During execution of automation, in test tearDown() get the result of a test(if a test failed or not), save it all into json file. - here is the first question, how can I get if a test failed?
  3. Once all tests are done, run a "post-build" script to get updated json file and send request to test rail(which will mark pass\fail tests)

Anyone who already worked on this, does it sound right for you?

Are there any build-in methods that could help me to achive the goal?

Replies

I’m not an XCTest expert, but I see that

XCTestCase
has a
-recordFailureWithDescription:inFile:atLine:expected:
method that looks like it was specifically designed for this job.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

This is how you can get result and all info of each test https://stackoverflow.com/questions/47882807/get-result-of-each-test-case-executed-in-xcode-ui-tests

Hi,

I am trying to understand XCTest as I have not used it extensively. Can you please provide some sample code on the integration of TestRail.

Can you please provide some sample code on the integration of TestRail.

Sorry, but no. If you ask XCTest questions I’ll try to answer them, but I can’t help you with third-party services.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"