0% found this document useful (0 votes)
42 views33 pages

Automate Web Training Day 4

Accelq Day 4

Uploaded by

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

Automate Web Training Day 4

Accelq Day 4

Uploaded by

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

Mastering Automation with ACCELQ

Instructor-led Automation Training

Unified Cloud Platform for Continuous Testing

W W W .AC C ELQ. COM


Day 4
Element Identification
Best Practices
Element ID Considerations
One of the most important aspects of automation development. Assign as much importance to reviewing element
definition, as you would do for logic development

1. Selecting right set of attributes is


1. Repeat Elements, when uniqueness
important
not to be expected
2. Use minimal attributes necessary for
uniqueness 2. Container or Anchor concept for
related elements
3. Regular expressions for dynamic and
3. Utilize neighborhood nodes when
variable attribute values
necessary
4. ‘Similar Element’ concept can save lot of
duplication 4. Derived properties for additional
uniqueness

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


Select right set of attributes for
maintainable element ID

• Multiple attribute combinations may yield uniqueness, but the key is to choose right set of attributes
• Keep only minimal set of attributes necessary for uniqueness
• Huge impact on long term maintenance and change management
• Use Regular expressions where it makes sense!

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


Select right attributes – random or numeric values

• Avoid attributes with random numeric or non-functional value text

• ID in the example, may change any time or may be different for various use cases on the application

• placeholder or class may be a better alternative

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


Select right attributes – class attribute
• class attribute refers to css classes the element is rendered with. You may have multiple classes for a given
element.

• When using this attribute, be sure to remove unnecessary classes.

• Make sure the selected classes have a functional connotation.

• Particularly, remove bootstrap column division or angular ng-* classes.

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


Using Regular Expressions for attribute values

• Powerful tool for dealing with dynamic portions of text

• Allows you to use attributes with dynamic value in element identification

• accelQ follows standard Java script patterns for regular expressions

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


Regular Expression examples
DESCRIPTION EXAMPLE REGEX PATTERN

text with leading and trailing spaces " Select Hotel " "Select Hotel" (remove spaces and mark as "regex")

Multiple consecutive spaces "Select Hotel" "Select[ ]+Hotel"

Text with unwanted/random numerics "Select Hotel 1873" "Select Hotel [0-9]+"

Text with unwanted alphanumeric text "Select Hotel a3X0kj8U" "Select Hotel.*"

Text with multiple variable components "18 of 32 flights from $320" "[0-9]+ of [0-9]+ flights from \$[0-9]+"

Generic Phone number "972-333-1322" "[0-9]{3}\-[0-9]{3}\-[0-9]{4}"

Generic email address "[email protected]" "[a-z]+@[a-z]+\.[a-z]+"

REFERENCE SITE
https://www.rexegg.com/regex-quickstart.html

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


Select right attributes – Putting it all together!
QUESTION
Design right set of attributes for the Home Sale category link below!

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


Select right attributes – Putting it all together!

1. Using text attribute as it is a proper name


for Home Sale category link, and remains
static (Home Sale)

2. href attribute used to make sure the Home


Sale link is functionally referring to a
Product Category. This avoids any other link
in the page with such a ”text” will not be
matched.

3. href value is converted to regex to remove


dynamic portions of the URL

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


Utilize neighborhood nodes for uniqueness

• Some times, an element itself


may not have any unique
attributes on its own.

• Notice the “Current Password”


field has no unique attributes
(3 matches with its attributes)

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


Utilize neighborhood nodes for uniqueness

• Utilize one or more


Ancestor or
Descendant nodes
attributes for additional
options.

• You “add” nodes to


Selector, which
typically only contains
the Element itself.

• In the example, we
added “A2” with “id” to
selector.
Proprietary & Confidential. Copyright 2023, ACCELQ Inc
Updating Element ID in action logic: Example with large set of
menu links or navigation links

CHALLENGE

• There are a total of 906


category links across all
Departments on this
page!
• Provide an optimized
approach to select
required category from
this list!

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


Similar-Element Pattern

SIMILAR ELEMENTS
• Functionally similar or equivalent, list type of elements.​

• Differ among each other, by one or two attribute values.​

• ‘text’ value is the only difference among all the Category links in the example.​

• Avoid duplication by defining a generic element among the group and updating
the required attribute in action logic.​

• Only 1 representative element for the entire group.​

• Logic becomes simple and easily manageable.

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


3 Steps to optimization
Step 1: Define one of the category links with a generic name, “Category
Link”.

Step 2: In the action logic, update the text attribute with the value for the
link you are interested. (Update Element Text Property)

Step 3: In the action logic, operate on the element now. For example a
click operation.

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


Repeat Elements – Uniqueness not to be expected!

• Multiple occurrences of exactly the same


element on a screen.

• Every element is functionally equivalent.

• Number of occurrences is not fixed and there is


no need to differentiate one from the other.
Uniqueness not required while setting up
element ID.

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


Repeat Elements – Uniqueness not to be expected!
• Make sure the match-count displayed on the
Element Explorer matches the number of
occurrences on the screen.

• Mark the check-box for “Repeat Element”

• Setup an index policy based on the need. This refers


to the instance of repeat element.
• First
• Last
• Nth from first
• Nth from last
• Random

NOTE
When you add an element which is Repetitive in nature … if accelQ
attempts to find uniqueness in the Element Explorer, be sure to
modify the Selector to get multi-match count.

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


Repeat Elements – Update Index in Action logic

When working with Repeat elements, typically you may


need to update the “instance” of repeat element.

Following commands helpful to update Repeat element


index in action logic

• Update Repeat Element by Index

• Update Repeat Element by Text

• Update Repeat Element by Property

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


Container Element – Dealing with family of elements
Ability to work with a set of related elements (element
family) with a simplified element identification technique
and intuitive action logic.

Example:

Hotel name, Rating, Select Button are all part of a family


of elements (belonging to one given hotel)

Container is any element that encompasses all the


elements in the family we are interested in.

Hotel Details Box is the container in the example.

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


Container Element – Adding elements to
repository
Step1: Define container element and add it to the repository.
(Hotel Details Box)

Hover on the view and find a rectangle that encompasses all the
related elements that we want to work with.

Note: Container element may itself be a Repeat Element, as the


same containers may be repeating multiple times in the page.

Step 2: Hover on a child element and add to repository. (Select


Hotel Button)

Mark the Container element from step# 1 as the “reference” while


defining the child element.

Note: Unique identification of a child element is evaluated in the


limited “context” of the Container element.

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


Container Element – Working in Action Logic
Step 1: Set Container element to required instance
1. Locate Container by Text Content Example: Select hotel by name
2. Locate Container by Child Element Example: Selecting a hotel which has strike-through price displayed
3. Locate Container by Ordinal Index Example: Selecting nth hotel from the top
4. Locate Container by Random Ordinal Index Example: Selecting a random hotel

Step 2: Operate on the child/family element

Just perform normal operations such as enter-text, get-element-text, click etc.

Proprietary & Confidential. Copyright 2023, ACCELQ Inc


Cross Project
Asset Sharing
Cross-Project Asset Sharing

Cross-Project Asset Sharing Publish-Subscribe Model Change Management


in ACCELQ
• ACCELQ employs a • Subscriber can modify
• Cross-project asset sharing certain attributes (name,
Publisher-Subscriber (Pub-
streamlines Actions sharing Sub) design pattern for applicability, custom fields
between multiple projects. etc.)
cross-project sharing.
• Facilitates end-to-end • Publisher manages core
• A project can publish
system-level automation Actions, which become logic, and element changes
across multiple applications, and updates to published
accessible to other projects
while each Project only Actions.
when subscribed.
includes assets for one
• Alerts guide users in
application-under-test.
reconciling changes in the
subscribing project.
Cross-Project Asset Sharing – Try out

• In the Project Configuration, enable Publishing for your first Project


• Publish a couple of Actions that are already available on this Project.
• Switch to your second Project and subscribe to the first Project.
• Make sure the Published Actions are presented when building Scenarios.
User Extensions
User Extensions

• User Extensions extend ACCELQ's command library to meet specific needs in an environment.
• Each Library may include one or more Commands that are accessible in the Logic Editor, just like
the native commands.
• User Extension is a java-based code with some ACCELQ specific annotations.
• User Extensions are shared across all Projects in a given Tenant. Each Project can decide to
subscribe independently.
User Extensions - Annotations

@UserLibrary: @Command: @Parameter:


• Declares a Java • Marks a Java method as a • Declares method arguments
class as a 'User Command in the Action logic for the command.
Library'. editor.
• Common attributes:
• Arguments must be of type
• name() : Defines the
'String'.
command parameter name.
• Return type can be 'void',
• enumValues() : Provides
'String', or a Java primitive type.
fixed value options for the
• Common attributes: parameter.
• displayName(): Defines the • description() : Optional
Command's display name. parameter description.
• templateStr() : Specifies the
'Natural Language' statement to
display in the Logic Editor.
• developerNote() : Optional help
text.
• tags() : Optional attribute for
tagging the command.
Introduction to
Salesforce Live
Digital Assurance for Cloud and Enterprise
Apps
Proprietary & Confidential. Copyright 2023, ACCELQ Inc
SAL ESFORC E BEH AVI ORS L I VE AC TI ONS

Open App from App Launcher


Opens an app from the App Launcher.

Context-sensitive suite
You may use an index …

of Salesforce Behaviors Impersonate as a User


Impersonates as a given user, provided
the logged in user has…

Search item from Global Sear..


Searches an item from global search. You
may specify the rec..

Open a Salesforce Record


Given a unique attribute of a Record, this
Action opens the det..

Open Developer Console


Navigates to the Dev Console and
switches control to the new tab in..

Delete Salesforce Record


Deletes a Salesforce Record identified by
a unique attribute ..
Salesforce Live
Example: Create a Lead and verify
Example Scenario: Verify Funds transfer on QBank
In this Scenario, we will login to Salesforce, create a Lead and
verify its attributes. Subsequently, we will delete the newly
created Lead and logout of Salesforce

Test Steps

• Login to Salesforce
• Initiate Lead creation modal Let’s Record this Scenario!
• Provide information to create lead and parameterize. • Open the Recorder and navigate to
• Verify the lead exists Salesforce login page.
• Delete the lead
• Logout of salesforce. • As you record, you will notice how various
steps are prompted for you automatically on
the Recorder.

• You will use Smart Forms feature to quickly


populate the New Lead form.
Salesforce Live
Scenario with Live Steps!

• Notice the newly created Scenario business process is majorly


comprised of Live Actions.
• Zero Element handling!
• Significant acceleration in initial development.
• Zero maintenance resulting from Salesforce Release upgrades. Live
Assets are always in synch.
• Simultaneous support for multiple SF Releases with a combination of
Live and Project Branching
• End-to-end flow with multiple Cloud platforms such as Oracle Fusion,
Microsoft Dynamics, nCino etc.

You might also like