Testing Salesforce

Applies to TestComplete 15.45, last modified on December 01, 2022

Salesforce is a cloud-based customer relationship management (CRM) solution. It includes services for managing customers, cases, sales opportunities, and so on.

Web interface

Typically, to access the Salesforce services, its web interface is used.

In TestComplete, you can create automated tests that simulate user actions over the web interface. TestComplete recognizes individual web elements on web pages, and you can record (or create from scratch) and then run tests that interact with those elements. For example, the tests can simulate various user actions, like clicks, double-clicks, typing text, and so on. The tests can also verify the state of web elements, for example, check the text that an element shows or the state of a check box.

Requirements

  • An active license for the TestComplete Web module.

  • The Web Testing plugin must be enabled in TestComplete (it is installed and enabled by default).

  • One of the following browsers must be installed on your TestComplete workstation and be prepared for testing:

    • Microsoft Edge 83 - 103 (based on the Chromium engine, both 32-bit and 64-bit versions)

      Note: The non-Chromium version of Edge is not supported.

    • Microsoft Internet Explorer 11 (both 32-bit and 64-bit versions)

      Note: The Modern UI (Metro) version of Internet Explorer 11 is not currently supported.

    • Google Chrome 103 (both 32- and 64-bit versions)

      If you use a later version of Google Chrome, check whether a patch is available for it.

    • Mozilla Firefox 91 - 102.1 ESR, 94 - 102 (both 32-bit and 64-bit versions)

      If you use a later version of Firefox, check whether a patch is available for it.

    To learn how to prepare web browsers for testing, see Preparing Web Browsers.

  • If you are planning to run tests in remote environments, also see the requirements for cross-platform web tests.

Creating and recording tests for Salesforce web interface

To create a test, you can record user actions over the Salesforce web interface in one of the supported web browsers, or you can create a test from scratch. The easiest way to create a test is to record it:

  1. In TestComplete, start recording.

  2. Launch your web browser.

  3. Navigate to the Salesforce web pages, interact with them as an end user would: click the links, input data into forms, and so on.

  4. Stop the recording.

TestComplete will process the performed actions and generate the test. The images below show an example of a recorded test that simulates user actions over the Salesforce web interface:

A keyword test

Recorded keyword test that simulates user actions over the Salesforce web interface

Click the image to enlarge it.

A script test

Recorded script test that simulates user actions over the Salesforce web interface

Click the image to enlarge it.

The test consists of a sequence of operations that simulate user actions over the web interface.

Running tests

On local computers

You can run the recorded automated test on your local computer as is. The easiest way to run a test is to click Run:

Running a recorded keyword test on a local computer

TestComplete will run all recorded test operations. This way, it will repeat all user actions that were performed during the test recording.

In remote environments

In TestComplete, you can connect your project to remote environments and run tests there. This way, you can check how your tested web application or web page functions in various web browsers and on various operating systems, including those that TestComplete does not support directly, for example, non-Windows operating systems. Organize test runs in remote environments by using the Execution Plan editor of your project:

Running tests in remote environments

Click the image to enlarge it.

To learn more about this, see About Cross-Platform Web Tests.

Viewing test results

After the test run is over, you can view the results in TestComplete. The results include the overall test status (pass, fail, pass with warnings) and detailed data on each simulated user actions:

Test log

Click the image to enlarge it.

Identifying and storing objects of the Salesforce web interface

In TestComplete, before an automated test can simulate any user action over the Salesforce web interface (or any other tested application), it must find the target object over which the action is to be simulated.

By default, when you record a test, TestComplete automatically adds objects with which you are interacting in the Salesforce web interface to the Name Mapping repository of the TestComplete project. For each object it adds, it assigns an alias, a short name to use to refer the object from tests, and recognition criteria that will be used to locate the object during the test run.

Salesforce objects added to the Name Mapping repository

Click the image to enlarge it.

To learn more about working with the Name Mapping repository, see Name Mapping.

Known issues

Due to security reasons, Chrome and Edge Chromium do not allow cross-origin interactions. As a result, in the Salesforce web interface, TestComplete cannot access the contents of frame elements whose source differs from the parent web page’s source. To resolve the issue, launch the web browser with the following command-line arguments:

  • --disable-web-security

  • --user-data-dir=<ProfilePath>

  • --disable-site-isolation-trials

These command-line arguments impair the browser security. We do not recommend using them unless required by your testing needs.

See Accessing Object Frames in Chrome and Edge.

Salesforce API

When creating automated tests for Salesforce, you may need to access and simulate actions over Salesforce resources by using the Salesforce API rather than by doing it directly via the Salesforce web interface. Though TestComplete is a functional testing tool rather than an API testing tool, it is still possible to simulate basic API operations from TestComplete tests by using the Salesforce object.

The Salesforce object is a wrapper for the most commonly used Salesforce API operations. It allows creating, updating, and deleting records and sending SOQL queries.

Requirements

The Salesforce object comes with the Salesforce API script extension. The extension is not part of the TestComplete package. You can get it for free from our GitHub repository:

github.com/SmartBear/testcomplete-salesforce-extension

Download, build, and install the script extension

For complete information on building, installing, and using the extension, see its description in the GitHub repository:

github.com/SmartBear/testcomplete-salesforce-extension

Use the extension

The extension provides the Salesforce object you can use in your TestComplete tests to:

  • Log in to Salesforce to access its resources.

  • Create, update, and delete records for the Account, Contact, Lead, and Opportunity objects and other objects in Salesforce.

  • Send SOQL queries and get responses.

For complete information on the extension and the objects it provides together with code examples, see the extension description in the GitHub repository:

github.com/SmartBear/testcomplete-salesforce-extension/blob/main/README.md

Support

The Salesforce API script extension is open-source. It is not a part of the TestComplete package, and it is not supported by the SmartBear Support Team. You can ask questions and share your experience and suggestions in our Community:

community.smartbear.com/t5/TestComplete/ct-p/TestComplete_forum

If you want to improve or fix code, feel free to send pull requests to the script extension repository.

See Also

Testing Salesforce

Highlight search results