microsoft / EasyRepro

Automated UI testing API for Dynamics 365
MIT License
520 stars 288 forks source link

Unable to execute test cases using Azure DevOps build pipeline #877

Open veerasekharbathala opened 4 years ago

veerasekharbathala commented 4 years ago

Bug Report

EasyRepro Version

UCI or Classic Web

Online or On Premise

Browser

Describe the bug
I tried with releases/v9.1 branch code. I am executing the easyrepro sample test case and i am able to debug and run test case from visual studio 2017. The test case ran successfully in visual studio 2017.

I am trying to execute sample test cases using Scenario 1: Executing tests inside an Azure DevOps build pipeline. I am using on-premise self hosted agent. However, the test cases are not able to execute and returned below error.

Special formatting / display

Code to reproduce


using System;
//For SecureString
using System.Security;
//For WebClient
using Microsoft.Dynamics365.UIAutomation.Api.UCI;
using Microsoft.Dynamics365.UIAutomation.Browser;
using Microsoft.VisualStudio.TestTools.UnitTesting;
//using Microsoft.Dynamics365.UIAutomation.Sample;
using *****.UIAutomation.UnitTest;
using OpenQA.Selenium;
using System.Collections.Generic;

namespace *****.UIAutomation.UnitTest
{
    [TestClass]
    public class CreateClient_AD
    {
        private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineAdminUsername"].ToSecureString();
        private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString();
        private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString());
        protected readonly SecureString _mfaSecrectKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecrectKey"]?.ToSecureString();

        [TestMethod]
        public void CreateClient()
        {
            var client = new WebClient(TestSettings.Options);
            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, null, ADFSLogin.ADFSLoginAction);
                xrmApp.Navigation.OpenSubArea("Customers", "Clients");
                xrmApp.Grid.Search("test1");
                xrmApp.CommandBar.ClickCommand("New");
                xrmApp.Entity.SetValue("firstname", "fn");
                xrmApp.Entity.SetValue("lastname", "ln");
                xrmApp.CommandBar.ClickCommand("Save & Close");
             }
        }
    }
}

-->

Expected behavior
The test case can be executed using Azure DevOps build pipeline.

Screenshots
image

image

badarmunir commented 4 years ago

@veerasekharbathala run this testcase using vstest command on local Step to follow vstudio > tools > Command Line > open-shell you want to open then move to project folder > bin> Debug and write this line vstest.console Project name/solution name.dll check that if it's working on local