0% found this document useful (0 votes)
16 views6 pages

GUI Automation KT

The document outlines the prerequisites and steps for GUI automation setup, including installing Java, an IDE, Git Bash, and Maven, as well as cloning necessary repositories. It details the process for creating JSON-based CRUD operations, specifying input and output requirements, and generating test classes with field validations. Additionally, it provides sample JSON structures and optional assignments for practice in Selenium and Java programming.

Uploaded by

amit bhalla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views6 pages

GUI Automation KT

The document outlines the prerequisites and steps for GUI automation setup, including installing Java, an IDE, Git Bash, and Maven, as well as cloning necessary repositories. It details the process for creating JSON-based CRUD operations, specifying input and output requirements, and generating test classes with field validations. Additionally, it provides sample JSON structures and optional assignments for practice in Selenium and Java programming.

Uploaded by

amit bhalla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Pre-requisites for GUI Automation:

1. Java 1.8 or above installed on Machine and path should be set at Environment Variables.
2. Check java version in command prompt with command: java –version

3. Install an IDE at your Machine i.e. Eclipse or Intellij etc.

4. Get Access to BITBUCKET repository. URL: https://alm.radisys.com/bitbucket/dashboard


5. Install GIT Bash on your machine.

6. Install Maven at your local machine and set path via Environment Variables.
7. Check maven version in command prompt with command: mvn -version

8. Create a Folder with name of your choice at your machine.


9. Clone this repo: https://[email protected]/bitbucket/scm/jmap/jms-
webautomation.git at Your Machine.
10. Clone this repo: https://[email protected]/bitbucket/scm/jmap/platform.git at your
Machine.
11. Clone this repo: https://[email protected]/bitbucket/scm/jmap/resources-json.git at
your machine. For e.g.

12. Copy all above repo’s folder to your created folder or else clone above repo in same created
folder.

13. Run Maven cycle i.e. clean, compile and Install at Platform build.
14. Run Maven cycle i.e. clean, compile and Install at Resource-Json build.
15. Run Maven cycle i.e. clean, compile and install at JMS-Web Automation build.
16. Make sure that all java, IDE and maven installation should success.

Steps to Create JSON Based Crud:


The purpose of this project is to generate Test Classes for Device profiles with basic CRUD
operations including field validations.

Input
1. Resource Json File
2. Test Input Json File

Output
Class with Test Cases generated under resource path

Steps to generate Test Classes


Step 1: Add an entry to ResourceMap in ResourcesToGenerate class for the new base test
class to be generated For e.g.

new ResourceMap("acl_profile", "com.jms.test.ACLProfile")

Step 2: Prepare Resource Json for Test

1. Edit the resource json file present in resources-json project under src/main/resources as
per the following steps.
2. To enable automation for the resource, add the following attributes to the root of resource
json file:
tab_name: Specifies the name of the tab in the UI screen
nav_item: Specifies the name of the navigation menu
automation_required: Flag to specify if Test Class generation is required for the
resource or not
automation_actions_supported: Specifies the supported automation actions for the
resource
ui_xpath_display_name: (OPTIONAL) Specify ONLY if the Resource Navigator Xpath
has different name than Display name
ui_message_display_name: (OPTIONAL) Specify ONLY if the Display Name is
different from the UI confirmation message text
parent_resource_navigator: (OPTIONAL) Specify ONLY if the current resource can be
reached only via another(parent) resource. For e.g. Subscriber Service can be reached
only via Subscriber(parent)
test_input_file: (OPTIONAL) If specified, it overrides the default input json file

Sample snapshot taken from acl_profile.json:

"cluster": "DB_PROFILE",
"display_name" : "Access Control List Profile",
"action" : ["create","delete","get","associate","dissociate"],
"parent_object" : "",
"application" : ["AMS"],
"tab_name": "Configuration",
"nav_item": "Profile",
"automation_required": true,
"automation_actions_supported" : ["create","delete","validateFields"],
"ui_xpath_display_name": "ACL Profile",
"ui_message_display_name": "ACL",

3. Add the below attributes to fields to include them in the automation


flow: ui_editable_action: Specifies the list of actions for which this field is editable
ui_input_type: Specifies the input type of the field
ui_xpath: Specifies the Xpath of the field
ui_order: Specifies the order in which this field's value will be entered by the automation
framework
ui_nested_json_name: (OPTIONAL) Use it to specify the json filename of the
nested/embedded resource
ui_function_to_call: (OPTIONAL) Specify ONLY if the value of this field will be
computed by a function
ui_tab_name: (OPTIONAL) Use it to handle resources where fields are spread across
multiple tabs
ui_tab_xpath: (OPTIONAL) Specifies the Xpath of tab declared by ui_tab_name
ui_nested_tab_name: (OPTIONAL) Use it to specify tabs nested within ui_tab_name
ui_nested_tab_xpath: (OPTIONAL) Specifies the Xpath of tab declared by
ui_nested_tab_name

Sample snapshot taken from acl_profile.json to demonstrate the use of ui_nested_json_name:

"ace_list":
{
"length": 128,
"type":"Array",
"description": "Specifies the acl profile ace list",
"valueType" : "application.resource.Ace",
"ui_editable_action": ["create"],
"ui_input_type": "AddDetailsButton",
"ui_nested_json_name": "ace",
"ui_xpath": "//button[normalize-space()='Add Ace']",
"ui_order": 3
}
Sample snapshot taken from olt.json to demonstrate the use of ui_function_to_call:

"mac":
{
"length": 128,
"type": "String",
"description": "Specifies the mac address of me",
"config": true,
"ui_editable_action": ["create","edit"],
"ui_input_type": "TextBox",
"ui_xpath": "//input[@autocomplete='mac']",
"ui_function_to_call": "Utils.randomMACAddress()",
"ui_order": 7
}

Sample snapshot taken from controller.json to demonstrate the use


of ui_tab_name, ui_tab_xpath, ui_nested_tab_name and ui_nested_tab_xpath:

"log_server":
{
"length": 128,
"type":"String",
"config": true,
"api_encrypt": true,
"description": "Specifies the IP Address of Log server",
"ui_tab_name": "settings",
"ui_tab_xpath":
"//form[contains(@class,'material_form')]//a[contains(text(),'Settings')]",
"ui_nested_tab_name": "sdponSettings",
"ui_nested_tab_xpath":
"//form[contains(@class,'material_form')]//a[contains(text(),'SDPON Settings')]",
"ui_editable_action": ["create","edit"],
"ui_input_type": "TextBox",
"ui_xpath": "//input[@formcontrolname='log_server']",
"ui_order": 8
}

Step 3: Create Test Input Json

1. Create input json file with sample input for all the supported actions at the below path:
src/main/java/com/jms/defined/testinput/
Input Json will consist of test input data with field name and value pair for all the fields
which will be entered as part of automation.
In addition to the field name and value pair, below attributes are added to support
automation:
expected_message: Specifies the expected UI confirmation/error message text
searchString: Used in clone action. Specifies the resource name as search string to be
cloned. for clone operation
navigationSearchString: Used for navigating to the resource if the current resource can
be reached only via another resource
expected_message_xpath: Used in validateFields action. Specifies the Xpath of
expected UI confirmation/error message text
field_name_to_validate: Used in validateFields action. Specifies the Field Name under
validation. Used in validateFields action
Sample test input data for create action taken from log_profile_input.json:
"TC_001": {
"name":"LogProfile-local-1",
"log_server": "10.10.77.76",
"log_level": "INFO",
"expected_message": "Log Profile LogProfile-local-1 created
successfully!."
}
Sample test input data for create action taken from acl_profile_input.json. Please note
that, in order to avoid conflict in field names, each of the fields of the child/nested page
must be prefixed with nested_
"TC_001":
{
"name":"ACLTest-local-1",
"type": "IPv4",
"nested_name":"AceTest-local-1",
"nested_type": "IPv4",
"nested_priority": "2",
"nested_result": "ALLOW"
}
Sample test input data for validateFields action taken from log_profile_input.json to
demonstrate the use
of expected_message_xpath, expected_message and field_name_to_validate:
"TC_001": {
"name":"",
"expected_message_xpath":"//span[contains(text(),'Name is required.')]",
"expected_message": "Name is required.",
"field_name_to_validate": "name"
}
Sample test input data for delete action taken from subscriber_service.json to
demonstrate the use of navigationSearchString:
"TC_001":
{
"navigationSearchString": "Subscriber-Test-010",
"name":"Test-Service-Config-1"
"expected_message": "Subscriber Service Test-Service-Config-1 deleted
successfully!."
}
2. Multiple test inputs can be added for each of the actions in the input json.
3. By default, for each resource it's corresponding input json file will be picked as long as
the below naming convention for the Test input file is respected:
<resource_name>_input.json
For e.g. Test input json file name for acl_profile.json must be acl_profile_input.json
4. Above default setting can be overridden by specifying the test input file name in the
resource json using the below attribute: This can be useful in scenarios where a generic
input json is to be used for different resources.
"test_input_file": "master_test_input.json"

Step 4: Run Generate Resource to generate the Base Test Class for the new resource
added.

NOTE: Whenever change in Resource-json file occur, user need to clean and install
resource-json project and jms-web automation project.

Assignments: (Optional)

1. Write a program to launch chrome browser via selenium for http://


newtours.demoaut.com and do login success. (can use locators and selenium methods)

2. Write a Program to reverse your Name is Java. (Can use String methods, loops)

THANK YOU

You might also like