Skip to content Skip to sidebar Skip to footer

Provide a Valid Path to Vstest console exe and Try Again

Home / Automating Selenium Tests in Azure Pipelines

Overview

Selenium is a portable open source software-testing framework for web applications. Information technology has the adequacy to operate on almost every operating organization. Information technology supports all modern browsers and multiple languages including .NET (C#), Coffee.

In this lab, you will acquire how to execute selenium exam cases on a C# spider web awarding, as part of the Azure DevOps Release pipeline.

Earlier you begin

  1. Refer to the Getting Started before y'all follow the below exercises.

  2. Click on the deploy to Azure button beneath, to provision a Windows Server 2016 virtual auto forth with SQL Express 2017 and browsers - Chrome and FireFox.

    Deploy to Azure

    It should take approximately 20-25 minutes to provision the resources. In one case the deployment is successful, you will see the resources as shown.

    azure_resources

  3. Utilize the Azure DevOps Demo Generator to provision the project on your Azure DevOps Organization. This URL volition automatically select Selenium template in the demo generator. If you want to try other projects, use this URL instead - https://azuredevopsdemogenerator.azurewebsites.cyberspace/

Follow the simple walkthrough to know how to employ the Azure DevOps Demo Generator.

Exercise 1: Configure agent on the VM

Allow usa configure a private self-hosted agent on this VM. Selenium requires the amanuensis to be run in interactive fashion to execute the UI tests.

  1. Login to the VM using RDP with the following credentials

    • Username: vmadmin
    • Countersign: P2ssw0rd@123
  2. In the VM open spider web browser, sign in to your Azure DevOps organization and navigate to the Agent pools tab:

    • Choose Azure DevOps, Organization settings.

    • Choose Amanuensis pools.

    • Select the Default puddle, select the Agents tab and choose New agent.

    • On Become the agent dialog box, choose Windows and Download amanuensis.

  3. Make a directory in C Bulldoze with the name AzAgent and extract the downloaded agent zip file to this directory.

  4. Open Powershell in administrator mode. Change the path to C:\AzAgent and type Config.cmd and hit Enter.

  5. Provide the post-obit details:

    • Enter server URL: Your Azure DevOps System URL
    • Authentication type: Press the enter cardinal for PAT as the hallmark type and paste the PAT in the side by side prompt.
    • Permit united states of america utilise the default options for the rest of the configuration. Printing Enter for all prompts until the command execution completes.
    • Once the amanuensis is registered, type run.cmd and hit Enter to start the agent.

    Click here for more data on how to configure the agent.

    configure_windowsagent

  6. Download and install Microsoft SQL Server Data-Tier Application Framework. This would exist required to deploy DACPAC using SqlPackage.exe in the release pipeline, which volition be explained in the next do.

Exercise 2: Configure Release Pipeline

The target machine is having agent configured to deploy the applications and run selenium testcases. The release definition uses Phases to deploy to target servers.

  1. Go to Releases nether Pipelines tab. Select Selenium release definition and click on Edit.

    setuprelease

  2. Open Dev environment to see the 3 deployment phases.

    setuprelease2

    releasephases

    • IIS Deployment phase: In this phase, we deploy awarding to the VM using the following tasks-

      • IIS Spider web App Manage: This task runs on the target car where we registered agent. Information technology creates a website and an Application Pool locally with the name PartsUnlimited running under the port 82 , http://localhost:82

      • IIS Web App Deploy: This task deploys the application to the IIS server using Web Deploy.

    • Database deploy phase: In this stage, we use SQL Server Database Deploy task to deploy dacpac file to the DB server.

    • Selenium tests execution: Executing UI testing equally office of the release process is a slap-up way of detecting unexpected changes, and need not exist difficult. Setting upwardly automated browser based testing drives quality in your application, without having to practise it manually. In this stage, we will execute Selenium tests on the deployed web application. The beneath tasks describes using Selenium to test the websites in the release pipeline.

      • Visual Studio Examination Platform Installer: The Visual Studio Examination Platform Installer task will learn the Microsoft test platform from nuget.org or a specified feed, and add it to the tools cache. It satisfies the 'vstest' demand and a subsequent Visual Studio Test task in a build or release pipeline can run without needing a full Visual Studio install on the agent machine.
      • Run Selenium UI tests: This job uses vstest.panel.exe to execute the selenium testcases on the amanuensis machines.
  3. Click on IIS Deployment stage and select the Default Amanuensis pool where we registered the amanuensis in Exercise ane. In example if you take registered the agent to unlike amanuensis puddle, you need to select that.

    setuprelease_IIS

  4. Repeat the to a higher place step for SQL Deployment phase

    setuprelease_db

  5. Click on Selenium tests execution phase and set Agent pool to Default then Save the changes.

    setuprelease_selenium

Exercise three: Trigger Build and Release

In this exercise, nosotros will trigger the Build to compile Selenium C# scripts along with the Web application. The resulting binaries are copied to Azure VM and finally the selenium scripts are executed equally part of the automated Release.

  1. Navigate to Pipelines nether Pipelines. Select Selenium build pipeline and click Run pipeline.

    buildqueue

    buildqueue

  2. This build will publish the exam artifacts to Azure DevOps, which volition be used in release.

  3. Once the build is successful, release will be triggered. Navigate to Releases tab to see the deployment in-progress.

    releasequeue

  4. When Selenium examination execution phase starts, connect dorsum to the VM provisioned earlier to encounter UI tests execution.

    Releaseprogress

  5. In this lab, we are executing four UI test scenarios configured to run on Chrome and Firefox browsers.

Tests running in Chrome

seleniumtest

Tests running in Firefox

seleniumtestfirefox

Once the release succeeds, click on the Tests tab to analyze the test results. Select the required filters from the dropdown in Result section to view the tests and their status.

analyzetests

Summary

In this lab, you have learnt how to automate and execute Selenium UI test cases on unlike browsers on an Azure VM with Azure Pipelines.

gillumgodis1985.blogspot.com

Source: https://www.azuredevopslabs.com/labs/vstsextend/selenium/

Post a Comment for "Provide a Valid Path to Vstest console exe and Try Again"