1
0
Форкнуть 0
Extension library to run XCUITest on Visual Studio App Center
Перейти к файлу
microsoft-github-policy-service[bot] 411d3c0951
Auto merge mandatory file pr
This pr is auto merged as it contains a mandatory file and is opened for more than 10 days.
2022-11-28 19:11:32 +00:00
AppCenterXCUITestExtensions.xcodeproj Test: add screenshot-with-XCTContext examples 2018-07-10 08:57:51 +02:00
AppCenterXCUITestExtensions.xcworkspace Xcode: 9.4 touched the project files and schemes 2018-05-09 09:23:40 +02:00
BeetIt Xcode: 9.4 touched the project files and schemes 2018-05-09 09:23:40 +02:00
Dido Xcode: 9.4 touched the project files and schemes 2018-05-09 09:23:40 +02:00
Sources Expose the Bridging Header for use in Swift projects 2018-05-04 14:37:06 +01:00
StickShift Xcode: 9.4 touched the project files and schemes 2018-05-09 09:23:40 +02:00
TestApp Test: add screenshot-with-XCTContext examples 2018-07-10 08:57:51 +02:00
bin Bin: update test scripts for new XCTContext tests 2018-07-11 07:24:16 +02:00
.gitignore Remove Test Cloud docs and xtc related scripts 2018-04-19 14:08:58 +02:00
.swift-version Xcode: migrate to Swift 4.0 2017-11-09 16:11:20 +01:00
AppCenterXCUITestExtensions.podspec Pods: adjust spec summary to pass the linter 2017-11-15 10:11:48 +01:00
LICENSE Updated Readme with App Center doc links 2017-11-11 12:54:10 +01:00
Makefile Framework: rename with ACT 3-letter prefix 2017-11-09 16:11:20 +01:00
README.md Docs: this framework is not compatible with Xcode >= 10.2 2019-07-23 13:34:31 +02:00
SECURITY.md Microsoft mandatory file 2022-08-12 19:19:14 +00:00
version.txt Xcode: add Dido app to test Carthage integration 2017-12-13 23:04:05 +01:00

README.md

Visual Studio App Center XCUITest Extensions

Carthage compatible

AppCenterXCUITestExtensions is an iOS Framework for taking screenshots and labeling test steps when running XCUITest test in Visual Studio App Center or Xamarin Test Cloud. At the conclusion of each test method, a label and screenshot are automatically generated for the test report. You can create additional labels and screenshots to track your app's progress during a test method.

Update

This framework has been deprecated.

This framework is not compatibible with Xcode >= 10.2.

This framework is no longer required for running XCUITests in Visual Studio App Center.

Users need to migrate their tests to use Apple's XCTContext runActivityNamed:block API.

- (void)testFavoriteSongs {
  [XCTContext runActivityNamed:@"Then I touch the Library tab" block:^(id<XCTActivity>
                                                                      _Nonnull activity) {
    // Gestures always generate a screenshot which will appear in your test report.
    [self.app.buttons[@"Library"] tap];
  }];

  [XCTContext runActivityNamed:@"Then I see a list of my favorite songs" block:^(id<XCTActivity>
                                                                                 _Nonnull activity) {
    // Queries do not generate screenshots.
    // Take a screenshot before assertions to make your test report more readable.
    XCUIScreenshot *screenshot = [[XCUIScreen mainScreen] screenshot];
    XCTAttachment *attachment = [XCTAttachment attachmentWithScreenshot:screenshot];
    [attachment setLifetime:XCTAttachmentLifetimeKeepAlways];
    [activity addAttachment:attachment];
    XCTAssertNotNil(self.app.tables[@"favorite Songs"]);
  }];
}

To make test source code readable, we recommend this method to take screenshots:

- (void) addScreenshot:(id<XCTActivity>  _Nonnull ) activity {
  XCUIScreenshot *screenshot = [[XCUIScreen mainScreen] screenshot];
  XCTAttachment *attachment;
  attachment = [XCTAttachment attachmentWithScreenshot:screenshot];
  [attachment setLifetime:XCTAttachmentLifetimeKeepAlways];
  [activity addAttachment:attachment];
}

We recommend inserting screenshots during your tests to make the test report easier to interrept.

Documentation

Please refer to the official App Center documentation site for installation and usage for both Visual Studio App Center and Xamarin Test Cloud.

This repository contains four demonstration apps:

  • Flowers: demonstrates the API.
  • Dido: demonstrates how to the link the framework using Carthage.
  • BeetIt: demonstrates how to link the framework using CocoaPods.
  • StickShift: demonstrates how to manually link the framework.

For a concrete example of submitting an app to App Center see bin/make/appcenter.sh

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Known Issues

Swift + bitcode

If you are building Swift XCUITests, you may encounter a build error related to bitcode. As a workaround, you can disable bitcode in your XCUITest target. To do this, go to Build Settings, search for ENABLE_BITCODE and set the value to NO for the test target. You should not need to change the setting for the App target.

screen shot 2017-04-06 at 12 43 24 pm