ioscontinuous-integrationxamarin-test-cloudxamarin.uitestbitrise

BitRise: How to Deploy UITests to Xamarin Test Cloud for iOS App Made in Xcode and UI Tests Written in C# (Xamarin.UITest)


I have an iOS app built in ObjectiveC using Xcode and a UITest written in C# using Xamarin.UITest, and I'm trying to create a Continuous Integration workflow in BitRise.

How do I create a BitRise workflow that will build the iOS app, build the UITest then submit the outputs to Xamarin Test Cloud?


Solution

  • BitRise doesn't yet have an officially supported step that does this.

    But the good news is that BitRise allows you to create your own step using scripts!

    Here's how we can create our own steps to build to accomplish this!

    Stack

    Use the Xamarin Stable Stack BitRise Stack Selection

    Workflow

    Add these steps to add to your workflow BitRise Workflow

    Scripts

    Build UITest

    #!/bin/bash
    # fail if any commands fails
    set -e
    # debug log
    set -x
    
    # write your script here
    SOLUTION_FILE=`find . -name YOUR_UITEST_SOLUTION_FILENAME.sln`
    
    "/Applications/Xamarin Studio.app/Contents/MacOS/mdtool" "build" $SOLUTION_FILE "-c:Debug" "-p:YOUR_UITEST_PROJECT_NAME"
    
    envman add --key ASSEMBLY_DIR --value "/Users/vagrant/git/FOLDER_PATH_TO_YOUR_UITEST_PROJECT/bin/Debug"
    

    Submit to XTC

    #!/bin/bash
    # fail if any commands fails
    set -e
    # debug log
    set -x
    
    # write your script here
    MONO="/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono" 
    TEST_CLOUD=`find . -name test-cloud.exe`
    UITestDll=`find . -name Xamarin.UITest.dll`
    
    cp -f $UITestDll $ASSEMBLY_DIR
    
    $MONO $TEST_CLOUD submit $BITRISE_IPA_PATH $TestCloudAPIKey --series "master" --locale "en_US" --user $TestCloudUserName --assembly-dir $ASSEMBLY_DIR --devices $TestCloudDeviceKey --async-json
    

    I've opened a feature request with the BitRise team: https://github.com/bitrise-io/bitrise.io/issues/95