Index

  1. Introduction

  2. Guidelines

  3. Environment Setup

  4. Script Development

Introduction

This document is intended to be used by QE (quality engineers) in order to get directions about script creation.

The QE should follow all the steps for successful script creation and consequence for a successful automated run.

1. Environment setup

  • In this step, you will configure your environment with all you need.

  • If you need assistance you can contact the coordinator anytime by opening a ticket.

2. Script development

  • Write the requested scripts using our guidelines

3. Script validation in QE local machine

  • Validate first your script in your local machine

4. Sandbox Package Run

  • You can use our sandbox to validate the scripts, by creating a run and waiting for the results. Depending on the results you can see if the script needs any fixes or it's ready

  • If no error is verified in the prior step, please send the test package to the coordinator

  • If you need assistance you can contact the coordinator anytime by opening a ticket

5. Script validation TestLIO

  • In this step, the coordinator will execute it in PRD

6. Script acceptance

  • If no error is detected your script development has been accepted!

If you have any suggestions, related to this document please feel free to give the suggestions to the coordinator anytime.

Have good work!

Need Help

If you need any help or need to contact the coordinator for any reason, please use this Google Form.

Guidelines

Please read and understand this provided user guide step by step. Also, notify your coordinator through Google Form if additional libraries other than listed are required. For any blockers please submit a ticket through Google Form.

  • Provide below ‘Comment section at the very top of the code with details:

/** 
* QE Name:
* QE Email:
* Script Creation Date:
* Additional Libraries Used and Version:
* Test Case Name: * Test Case Description:
*/
  • Add proper comments for a better understanding of logic/implementations in code.

  • Avoid hardcoded data in the script. Declare all variables and respective values at the beginning of your script.

  • Do not hardcode access credentials in the test code.

In C# use .runsettings file. For example, you can create file .runsettings with the following content:

<!-- BrowserStack parameters -->
<Parameter name="browserstack-uri" value="https://hub.browserstack.com/wd/hub/" />
<Parameter name="browserstack-browser-name" value="Chrome" />
<Parameter name="browserstack-browser-version" value="103.0" />
<Parameter name="browserstack-os-name" value="Windows" />
<Parameter name="browserstack-os-version" value="11" />
<Parameter name="browserstack-username" value="username" />
<Parameter name="browserstack-access-key" value="password" />
<Parameter name="browserstack-build-name" value="browserstack-build-1" />

And then access them in code like that:

public BrowserStackDriver() {

Dictionary<string, object> capabilities = new() {
{ "browserName", TestContext.Parameters[RunParameters.BROWSERSTACK_BROWSER_NAME] },
{ "browserVersion", TestContext.Parameters[RunParameters.BROWSERSTACK_BROWSER_VERSION] },
{ "os", TestContext.Parameters[RunParameters.BROWSERSTACK_OS_NAME] },
{ "osVersion", TestContext.Parameters[RunParameters.BROWSERSTACK_OS_VERSION] },
{ "userName", TestContext.Parameters[RunParameters.BROWSERSTACK_USERNAME] },
{ "accessKey", TestContext.Parameters[RunParameters.BROWSERSTACK_ACCESS_KEY] },
{ "buildName", TestContext.Parameters[RunParameters.BROWSERSTACK_BUILD_NAME] }
};

  • Use ‘Suite.xls ’ file to add the project , test cases , test data details explained in user guide.

  • Use ‘AppRepository.xls ’ file to add object properties details explained in user guide.

Environment Setup

Desktop Web testing - C# Selenium Nunit

Prerequisites

To develop desktop web application tests in Selenium using the Nunit framework you need to configure the environment locally as described in the instruction below.

  1. Install the below C# IDE:

    1. Visual Studio 2022 - Download Visual Studio Community Edition from Microsoft official website.

  2. Install one or both of the supported by Testlio platform web browsers:

    1. Google Chrome: Google Chrome - Download the Fast, Secure Browser from Google

    2. Mozilla Firefox: Internet for people, not profit

Create a project

To create a test script compatible with Testlio platform you have to use our framework, containing all the supported libraries by our engine as well as some tools and helper functions which you’re welcome to use during your tests development process. You can find a JAR library with the Testlio framework in the parent directory.

Also, to help you with the process of creating a test automation project, we prepared a template project. Here are the steps, how to use this template project as a starting point:

1. Pull template projects from GitHub: GitHub - Testlio/selenium-c#-framework

2. Open selenium-c#-framework project in your IDE

3. Check that Testlio Sample-Wikipedia-Test works fine in your environment by running the tests suite:

dotnet test CSharp-Automation-Framework.csproj -s .runsettings

4. If tests are executed successfully, it means that your environment is ready to implement Selenium tests for your desktop web application

Script Development

Test script creation is basically a 2-step process where:

1. Objects and methods used in scripts are defined in their corresponding page classes

2. Page class methods are called in the script classes.

Creating and extending a page class:

  1. Navigate to the Pages/<client> folder and add a new page class extending the Factory.SeleniumWrapper (for Web) or Factory.AndroidWrapper / Factory.IosWrapper (for Mobile). *

    * Create the client folder if it does not already exist.

  2. In this new page class, add an empty constructor extending the base constructor (with the same parameters) of the class being extended (SeleniumWrapper or MobileWrapper). **

  3. Define the object references of all objects on this page. **

  4. Create the methods to perform actions using the objects defined above. **

    ** See the Pages/Sample/WikiBasePage for reference.

Creating test cases using page classes:

  1. Navigate to the Tests/<client> folder and add a new test class extending the Runners.TestRunner class. +

    + Create the client folder if it does not already exist.

  2. Declare the BrowserDriver or MobileDriver (depending on the type of test) and the pages used in the test as class variables. ++

  3. Initialise the driver and pages used in the test using the InitializeTest method tagged with the [SetUp] NUnit attribute. ++

  4. Create an ExecuteTest method tagged with the [TestCase] NUnit attribute and [SkipIfDisabled] attribute (from Utils) to create a new test case. Proceed to add all test steps using the page instances in this method. ++

  5. Perform test clean-up (including terminating the driver) in the TerminateTest method tagged with the [TearDown] NUnit attribute. ++

  6. Reference the test in the Suite.xls and proceed to run it by marking it as “RUN” and running the following command:

     dotnet test CSharp-Automation-Framework.csproj -s .runsettings.

    ++ See the Tests/Sample/Test1 for reference.

Did this answer your question?