SHARE

Know more about Automated Testing in Salesforce

5 min read
Rating:
0
(0)
0
(0)

Automated testing is the testing of the software through the specialized tools, which includes performing the following steps: start, initialization, execution, receiving and analysis of the test result.

Selenium is a tool specifically designed to conduct automated testing of web applications in various browsers and within various platforms. It should be noted that any routine actions performed in the browser can be automatically tested using Selenium, not only web applications.

Selenium supports functional and regressive testing.

The main types of locators in Selenium are: ID, ClassName, Name, TagName, LinkText, PartialLinkText, Xpath, CSS Selector, DOM.Xpath is a declarative query language for elements of an XML or XTHML document. It navigates the document based on its logical structure and hierarchy.

  • To automate tests on the SF platform, we use the Intelij Idea development environment
  • All the tests are related and we use Maven
  • pom.xsml is the configuration file of our project
  • To write auto tests, we have to use salesforce libraries. Maven automatically downloads them and adds them into our project
  • All libraries and their related elements should be enclosed into the Dependencies tag.
  • To write auto tests we need junit and selenium webdiver java
  • Next, we need to import our changes: click on the link in the lower right corner to Import Changes
  • Go to the src folder->test->java, press new package, and define the folder name of our project. We need to make sure that all projects have unique names

In our example, we use Xpath to search elements – we have used it for simplicity although it is not the most reliable way to find the elements. In most cases, it’s better to use unique names as locators.

How to get Xpath for particular element:

  • Open the inspector (F12) to find the desired element on the page, click on it;
  • After the element is selected in the inspector, right-click on the selected element in the inspector;
  • Copy the Xpath element,
  • Paste the Xpath into your source where you use driver.findElement (By.xpath (“”)) command.

testing 3

In our example below, we will log in to the community and create an Idea. For that, we create a Main class containing steps for creating an idea in the Community. We use the AC Enterprise Ideas  with Lightning Experience support component v1.28mar19 / 1.28.0

We use the following techniques to post an Idea:

  • To find appropriate fields to insert text we use driver.findElement(By.xpath(“”)).sendKeys(“”)
  • To find buttons or links to click we, use the driver.findElement(By.xpath(“”)).click()
  • To find a drop-down list and select a value from the list, we use
    driver.findElement(By.xpath (“”)).click()
    WebElement select = driver.findElement(By.xpath (“”));
    List<WebElement>sekect_li = select.findElements(By.tagName (“li”));
    sekect_li.get(0).click()
  • To set the delay in execution, we use the Thread.sleep()

See full source code below

carbon 2

Rate the article

0 / 5. 0

Table of contents

Discover more articles!

AC Partner Marketplace Product Sheet

Download the fact sheet now to explore:
  • How the app streamlines the entire channel sales process, from onboarding to selling.
  • How it enhances partner management with a self-service platform, real-time updates, and lead generation.
  • How it supports network expansion and automates business workflows.
 

Complete the form to get your free copy.

 

 
 

By submitting this form, you agree to occasionally receive guides, tips, and tricks from AC. You can unsubscribe at any time.  

 

AC Knowledge Management Enterprise Product Sheet

Download the fact sheet now to explore:
  • Key features – See how AC Knowledge Management Enterprise empowers your support team.
  • Benefits – Understand the value it brings to your customers.
  • Real results – See the impact AC Knowledge Management Enterprise can have on your organization.
 
 

Complete the form to get your free copy.

 

 
 

By submitting this form, you agree to occasionally receive guides, tips, and tricks from AC. You can unsubscribe at any time.  

 

AC Ideas Ultimate Product Sheet

Download the fact sheet now to explore how AC Ideas Ultimate helps you:
  • Capture – Easily collect ideas from customers, team members, and stakeholders.
  • Evaluate – Use built-in tools to score, prioritize, and review ideas based on custom criteria.
  • Implement – Track progress, convert cases into ideas, and turn the best ideas into actionable projects.
 
 

Complete the form to get your free copy.

 

 
 

By submitting this form, you agree to occasionally receive guides, tips, and tricks from AC. You can unsubscribe at any time.  

 

AC MemberSmart Product Sheet

Download the fact sheet now to explore:
  • Key features – See how AC MemberSmart empowers your team.
  • Benefits – Understand the value it brings to your members.
  • Real results – See the impact AC MemberSmart can have on your organization.
 
 

Complete the form to get your free copy.

 

 
 

By submitting this form, you agree to occasionally receive guides, tips, and tricks from AC. You can unsubscribe at any time.  

 

AC Events Enterprise Product Sheet

Download the fact sheet now to explore:
  • Key features – Learn how AC Events Enterprise automates registration, marketing, and analytics.
  • Benefits – Learn how it improves attendee satisfaction and helps your event shine.
  • Proven results – See how the app transforms your event outcomes.
 

Complete the form to get your free copy.

 

 
 

By submitting this form, you agree to occasionally receive guides, tips, and tricks from AC. You can unsubscribe at any time.  

 

Webinar

Simplifying Payments for Your Members with a Unified Checkout Experience on Salesforce

Join our webinar to discover how a seamless, one-cart checkout can simplify transactions, boost member satisfaction, and streamline operations for your association.

Nov 08, 2024 at 04:00 PM GMT