tfsvisual-studio-app-centervisual-studio-app-center-test

TFS 2018 and AppCenter Test


I'm new to CI/CD and can't find any information on the internet on how to use AppCenter Test with TFS 2018. I have my Xamarin projects in TFS but I want to test them within the device cloud of AppCenter Test.

There are a couple documents on MS's docs that make it look like it's possible but for a newbie they give ZERO information on how to implement it. HERE is an example. If you look up top this document is relavant to TFS 2018.


Solution

  • Here is what I did to get it working. No idea if it's correct or not, but hey, it works!

    Xamarin.UITest

    If you don't do the following step you'll run your tests locally and nothing will happen, they'll just immediately exit.

    First go to Tools > Options > Test > General > Active Solution then uncheck For improved performance, only use test adapters in test assembly folder or as specified in runsettings file

    public class AppInitializer
        {
            public static IApp StartApp(Platform platform)
            {
                if (platform == Platform.Android)
                {
                    return ConfigureApp.Android
                        // You may need to adjust the following relative path based on where you created your UITest project
                        .ApkFile(@"..\..\..\<AppName>\<AppName>.Android\bin\Release\<App Package Name>.apk")
                        // Uncomment if you are running locally and you want VS to launch/install app
                        //.PreferIdeSettings()
                        .StartApp();
                }
                return ConfigureApp.iOS.StartApp();
            }
        }
    

    Do not add references to your Android and iOS projects like the MS docs say. This will lead you down the path of hours of useless troubleshooting

    Deploy your agent on a development windows box. Follow these instructions: https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops

    TFS 2018 Configuration

    1. In TFS click into the repository of your project
    2. Click "Build and Release"
    3. Up top right click "+New"
    4. Click "Continue"
    5. Scroll down and click "Xamarin.Android"
    6. on the next screen set the Agent queue to whatever you created ealier, probably Default

    List of my build tasks

    Here are my build steps in detail

    Nuget Tool Installer

    .NET Core

    Nuget

    Xamarin.Android

    MSBuild

    Android Signing

    Node Tool Installer

    Note: Prior to the next step create a new variable called XamarinUITestVer and set the value to whatever value you want to use for the Xamarin.UITest Nuget package you want to install. In my case the value I set was: 2.2.7

    Nuget

    App Center Test