img

Introduction to Runner and Locators – Tesbo

As we have seen in the previous article, Tesbo has it’s own template for design the Test Script. If you’ve missed that one, you can visit it from here. Let’s look at the Tesbo Structure and files one by one.
  • TestRunner
TestRunner is the main Test Runner invocation class provide by Tesbo itself. You don’t need to work on this class, you need to create a Runner class and pass the default Tesbo code snippet to initialize the Tesbo run. You can add below code snippets only to defined your Tesbo runner class.

package Runner;
import Execution.Tesbo;

public class TestRunner {
    public static void main(String[] args) {
        Tesbo runner = new Tesbo();
        runner.run();
    }
}

This is it, this is all you need from the tesbo runner class. You can rename class name your choice, you just need is initialize Tesbo class and call run from it.
  • Locators
Locators are always important for the automation and it’s always needed you pass valid locators while working with automation. In Tesbo Locator package contains JSON files, These JSON files are used to define the locators for your project. You can pass as many as locators in a single file and also can create multiple locators file as per your modules. In Tesbo you don’t even need to tell Tesbo that which locators you’re using for the element, either it could be id or name or XPath whatever Tesbo is intelligent enough to find which locators you used. Let’s see how you can define the locators in locators .json files.
  • By ID

{"LocatorName" : "ID"}
i.e.
{"txtFName" : "firstName"}

  • By XPath

{"LocatorName" : "xpath"}
i.e.
{"txtFName" : "//input[@id='firstName']"}

  • By className

{"LocatorName" : "className"}
i.e.
{"txtFName" : "fName"}

  • By Name

{"LocatorName" : "Name"}
i.e.
{"txtFName" : "first name"}

  • By TagName

{"LocatorName" : "TagName"}
i.e.
{"txtFName" : "input"}

  • By LinkText

{"LocatorName" : "LinkText"}
i.e.
{"btnRegistration" : "registration"}

  • By PartialLinkText

{"LocatorName" : "PartialLinkText"}
i.e.
{"btnRegistration" : "registration"}

Above is the list of locators which are supported by the Tesbo. You can see we don’t need to tell in JSON that from which strategy it needs to identify the locator. Below is the real-time locator file example, that how it’ll look like.

{
"btnRegister": "//a[contains(text(),'REGISTER')]",
"txtFName": "firstName",
"txtLName": "lastName",
"txtPhone": "phone",
"txtUsername": "userName",
"txtAddress1": "address1",
"txtAddress2": "address2",
"txtCity": "city",
"txtState": "state",
"txtPostalCode": "postalCode",
"txtEmail": "email",
"txtPassword": "password",
"txtConfirmPassword": "confirmPassword",
"btnSubmit": "register",
"lblName": "//table//b[contains(text(),'Dear')]",
"drpdwnCountry": "country"
}

In the above file, we have defined locators as XPath, id, name, link text but we didn’t mention anywhere but Tesbo will identify it and will do action on the element. How cool is that!
This is all from Locators, let’s see in the next article how to create and define the Test scripts in Suite file.

#Step2QA #Tesbo #AutomationFramework

  • Facebook
  • Twitter
  • Google+
  • Linkedin
  • Pinterest

Leave a Comment

Your email address will not be published. Required fields are marked *

It is main inner container footer text
Accessibility