Coder Social home page Coder Social logo

microsoft / appcenter-test-xcuitest-extensions Goto Github PK

View Code? Open in Web Editor NEW
13.0 10.0 20.0 7.87 MB

Extension library to run XCUITest on Visual Studio App Center

License: MIT License

Ruby 2.19% Makefile 0.54% Objective-C 35.98% Swift 18.32% Shell 42.98%

appcenter-test-xcuitest-extensions's Introduction

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 [email protected] 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

appcenter-test-xcuitest-extensions's People

Contributors

dalemyers avatar erychagov avatar jmoody avatar john7doe avatar krukow avatar microsoft-github-policy-service[bot] avatar polyakrecords avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

appcenter-test-xcuitest-extensions's Issues

Screenshot capability is not included in extensions framework

The App Center documentation states that the ability to take screenshots is provided by App Center's XCUITest extensions framework (here). The code examples linked to in the doc use a class called AppScreenshotter for this functionality (see here and here), but this class's implementation appears to be included in the test app rather than the framework (here). Attempting to reference ACTScreenshotter in an XCUITest that imports AppCenterXCUITestExtensions thus yields an "unresolved identifier" error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.