Skip to main content

Development

IOS UI automation testing with XCode Server&CI

About

During IOS project developing, old features are always broken after new code merged in. As tester, we will run tests to verify the old features work well or not. XCTest is one kind of testing framework supplied for our use, starting with XCode 5. XCTest framework could create and run unit tests, performance tests, and UI tests for IOS project. Use the XCTest framework to write UI/Unit tests for IOS projects that integrate seamlessly with XCode’s testing workflow. It could be integrated to CI and perform all the testing across all the IOS devices and recording tests is easy for new tester to start. XCTest could connect to real devices or simulator to perform tests. Tests can also measure the performance of blocks of code by XCTest to check for performance regressions, and can interact with an application’s UI to validate user interaction flows.

Create UI automation scripts using XCTest framework

When we are creating one new project, we will check the checkbox named ‘Include UI Tests’ so that this project will automatically create some blank UI Tests file.If we forget checking UI tests in upper steps, we can make it by clicking File->New->Target button.
It will pop up a new window. Under ‘Test’ tab, check ‘iOS UI Testing Bundle’ and click ‘Next’.
Input the first UI test script name in ‘Product Name’ text and choose the related target name, then click ‘Finish’ button.
Then we could record the UI automation script.

After the UI Test script is recorded, we could replay it by clicking the icon beside script name. It will trigger default simulator and start testing.

Run Integrations and Analyze test Results

Once the XCode bot(CI tool in XCode framework) is configured, it will automatically start integration testing. The typical integration will check out the source code and perform all the actions defined in the build configurations. At the end of the integration, we will see a summary test result report.Selecting the bot will show a summary of the bot integrations in the editor area of XCode. Clicking on the entry in the navigator pane for a specific integration run will show detailed results:

Summary: It includes the summary of the status of devices, tests, errors, warnings and issues in current build.Tests: It shows test scripts status including success and fail. It will has a duration of each script executed. We also could find the fail step and link to that script to analyze root caus.

Coverage: We can see the code coverage of the test case (only once the integration test is completed before we can see the code coverage, If the test is cancelled in the middle of the implementation, there is no results in Coverage tab)Commits: We can view the code submission record.

Conclusion

As an iOS developer or tester, XCode server can make automation testing easier, simpler, more automated build, package upload, regression testing, and quick detection of projects in the presence of the error to solve the problem. XCode service detects commits to the shared repository, and automatically builds, and runs tests, and generate one summary test result report on the new code changes to immediately surface any functional or integration errors.

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow Us
TwitterLinkedinFacebookYoutubeInstagram