GUI Automation KT
GUI Automation KT
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
6. Install Maven at your local machine and set path via Environment Variables.
7. Check maven version in command prompt with command: mvn -version
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.
Input
1. Resource Json File
2. Test Input Json File
Output
Class with Test Cases generated under resource path
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
"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",
"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
}
"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
}
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)
2. Write a Program to reverse your Name is Java. (Can use String methods, loops)
THANK YOU