Skip to main content

Creating your first UI test with Automated Testing

A step by step guide to create your first automated UI test to save you time from manual testing

Gino Toro avatar
Written by Gino Toro
Updated this week

Testing if your Salesforce org is behaving as you expect it to is a traditionally manual task. You can automate UI tests with Gearset's automating testing!

Follow these steps, as a tutorial, to create your first Gearset UI test by recording a simple flow in Salesforce (like creating a new Account) and adding an assertion (the things we are testing for).

Create a new test

  1. In Gearset, open UI Testing from the main menu.

  2. Click New test.

Connect to your Salesforce org

Ensure that you have a Salesforce org in your settings page. As a pre-requisite, connect to an org without production data.

  1. Select the Salesforce org you want to test (for example, a Dev Sandbox).

  2. Click Connect.

You’ll see a pop-up about AI usage:

  1. Tick the checkbox to confirm the org contains no production data

  2. Click Confirm

You’ll be connected without entering a username or password.

Get familiar with the test builder

Once connected, there are two parts to the screen:

  • Right-hand side: a live browser view of your Salesforce org

  • Left-hand side: the test builder wizard (your recorded steps will appear here)

You can disconnect or reconnect at any time, or connect to a different org.

Choose your test user (optional)

If you have permission to switch users:

  1. Click Edit in the User section

  2. Pick a specific User or Profile

  3. Click Save

  4. Click Next

Otherwise, continue with the default connected user.

Record your first test

You can choose to record using the recorder by interacting with the live browser view, or using our Gearset Agent to instruct how to test. We recommend using a recorder.

  1. Choose Record screen

  2. Click Start

  3. Create the test of adding a new Account. In the live Salesforce browser:

    1. Click the App Launcher (top-left)

    2. Search for Accounts by typing it in

    3. Click Accounts in the dialog

    4. Click New

    5. Fill in the required fields to ensure no validation errors appear (example: Account Name = Test Account)

    6. Click Save

    7. Note that Gearset will automatically add each action as a step in your test.

  4. Click Stop (top-right) to stop recording

Add an assertion

An assertion is a way to tell your test: “This must be true; if not, fail the test.”

The assertion will check whether the system’s actual behaviour matches the expected result. In this case we want to verify that the Account was actually created.

  1. Click Add assertion underneath your recorded steps

  2. In the prompt box, enter something like "Assert that “Test Account” has been created"

  3. Click Run

Gearset will generate a new assertion step (for example, checking that the account name is visible on screen). If it succeeds, you’ll see a tick next to the step.

Run the test from start

Now that you created the test, you can rerun it to see if it works from beginning to end.

  1. Click Run from start to replay the full test end-to-end

You’ll see:

  • Tick if the step passed or assertion pass

  • Cross is the step failed or assertion failed

Save your test

Once it runs successfully:

  1. Click Save

That’s your first UI test!

What is next:

  • You can run the test in the Tests list

  • Coming Soon: you will be able to add to a test job, then see it in your pipeline.

Did this answer your question?