Skip to content

Business Keywords

2.12.1. Custom Keywords

Purpose: anytime Tool’s default available keywords do not satisfy your work, you can create your own code by creating a new java file in Custom keywords > src.

Note: After finish coding, register this keyword to decide whether it displays in the keyword list or not.*

2.12.1.1. Custom Keywords with register custom keywords

  • Step 1: Create new Java File in .java

image-20220606125641359

  • Step 2: Then start to write you custom code => Ctrl + S to save

You can click on [ ? ] icon to refer coding role in akaAT.

image-20220606125651531

  • Step 3: After Save, all methods will be displayed in the right side.

image-20220606125700807

  • Step 4: Click on [ + ] button of the method to register for that method.

  • Step 5: You will be navigated to Keywords Setting screen

​ - At this screen you can choose Catalog that you want to add these new keywords.

​ - You can change name of the parameters, add “Description” for new keyword.

image-20220606125723051

  • Step 6: Click on [Add] and [Save] button to finish registering keyword.

  • Step 7: After this keyword is registered to display in the keyword list of the test case, you can search for it as you did with other keywords.

image-20220606125734133

2.12.1.2. Custom Keywords with register inline functions

  • Step 1: Create new Java File in .java

image-20220606125641359

  • Step 2: Then start to write you custom code => Ctrl + S to save

You can click on [ ? ] icon to refer coding role in akaAT.

inlineFunction

  • Step 3: After Save, all methods will be displayed in the right side.

inlineFunction1

  • Step 4: Click on [ + ] button of the method to register for that method.

  • Step 5: You will be navigated to Keywords Setting screen

​ - At this screen you can Change name and Add Group

inlineFunction2

  • Step 6: Click on [Add] and [Save] button to finish registering keyword.

  • Step 7: After this keyword is registered, you can use an inline function like calling a normal variable, just pass the value into the parameter and it will return to you according to the function's value type.

inlineFunction3

2.12.2. Keyword Groups

Keyword Groups is a group of steps that would be reused over and over again in many test cases. You can export steps from the test case (by copy and paste step) to a keyword group and recall it to other test case(s).

2.12.2.1. Use simple Keyword Groups

In the image below, you can see those are steps of a keyword group that you can create like creating test case or copy these steps from an available test case

image-20220606125746916

Then recall these steps of this keyword to a test case. In the test case, those steps will be collapsed into a step with step name is Keyword Group’s name

image-20220606125756545

2.12.2.2. Use Keyword Groups with variable input

In the image below, you can those are steps of a keyword group with variable input

variableInput

Then recall these steps of this keyword to a test case. And input information into Input column

VariableInput1

2.12.3. Synchronizing Tests

Automation execution usually does not carry out exactly as scripted due to many factors involved during execution such as network stability, internet bandwidth, the performance of the AUT, and the performance of the executing computer. This article will guide users through leveraging delayed time to handle such situations.

2.12.3.1. “Wait” keyword purpose

Some examples of test failure due to insufficient waiting time:

  • Fail False: One of the most common failures is when a script fails due to waiting on the application. It is often caused by network latency, delayed database requests, or simply because the system needs more time to process and respond to the request.

  • Targeted element not present on the page: This kind of failure occurs when waiting for elements to be displayed or rendered in the browser. The application may be up and running but certain elements may not be loaded, thus causing test scripts to fail.

akaAT Studio provides keywords dedicated to delay explicitly. You can use the following options to address the situation:

“Wait” Keyword Description
Wait For Page Load Wait for a page to load within a time in the second unit.
Wait For Element Present Wait for the given element to present within the given time (in seconds).
Wait For Element Not Present Wait for the given element to NOT present (appear) within the given time (in seconds).
Wait For Element Visible Wait until the given web element is visible within time out.
Wait For Element Not Visible Wait until the given web element is NOT visible within a timeout.
Wait for Element Clickable Wait for the given element to be clickable within the given time in seconds.
Wait For Alert Wait for an alert to present.
Wait for Alert with timeout Wait for Alert with timeout(s)
Wait For Element Attribute Value Wait until the given web element has an attribute with specified name and value
Wait For Element Not Has Attribute Value Wait until the given web element NOT has an attribute with the specified name
Wait For Element Has Attribute Wait until the given web element has an attribute with the specified name.

For example: The script below shows the usage of a global variable and the usage of some keywords in keyword column in the above table to deliberately wait for a specific test element

Note: Because the website uses an iframe, we should to Switch to Frame before interacting with the element. Using delayed time is a common practice in test automation scripts to create a pause in-between automation steps as you wait for web elements to load or for the AUT to respond.