testRigor & Salesforce
  • NO-CODE UI TESTING: Guide for testRigor & Salesforce
  • Getting Started
    • Get a Salesforce Hands-On Playground Org (free)
    • Get testRigor (free) and create a Test Suite
    • Create Test Case (T00001)
    • Navigation in Salesforce
    • Navigation in testRigor
  • BASIC TEST CASES
    • Record, edit and play a Test Case (T00002)
    • Create and convert a Lead (T00003)
    • Create more records (T00004)
    • Check Account Validation Rule (T00005)
  • ADVANCED TEST CASES
    • Account Action and List View Button (T00006)
    • Validate Field Value Using REST API (T00007)
    • E2E: Lead entry (Titan) ➔ Salesforce ➔ Email
  • OTHER TEST SCENARIOS
    • Submit a Test Lead
    • TH: Opportunity Won THEN Create Contract
    • Monitor data in your website
    • Monitoring in Production
  • FLOW TEST CASES
    • Screen Flow: Update Email Address
  • E-BIKES SAMPLE APP
    • E-Bikes sample app description
    • testRigor version of the UTAM TEST (EBIKES-00001)
    • Product Explorer - Electra X3 (EBIKES-00002)
    • Reseller Order - Create (EBIKES-00003)
    • Case - Create (EBIKES-00004)
  • LWC RECIPES SAMPLE APP
    • LWC Recipes sample app description
    • Test Case for LWC Recipes (LWC-00001)
  • CORAL CLOUDS SAMPLE APP
    • Coral Clouds sample app description
    • Experience - Generate Description using AI (CC-00001)
    • Experience - Generate Reviews Summary using AI (CC-00002)
  • MORE INFORMATION
    • About testing
    • About testing in Salesforce 🤔
    • About test automation
    • About Test-Driven Development (TDD)
    • About testRigor
    • About using testRigor
    • About other solutions
  • FEEDBACK
    • Questions? - Comments!
Powered by GitBook
On this page
  • A. Create and test a Validation Rule in Salesforce
  • Create the Validation Rule in Salesforce
  • Test the Validation Rule manually in Salesforce
  • B. Test the Validation Rule using testRigor
  • C. Additional twist for Salesforce Flow Builder experts:
  1. BASIC TEST CASES

Check Account Validation Rule (T00005)

In case you want to try ATDD / "test-first" then do steps in this order

RED: Create a failing test

1. Create the Test Case in testRigor

2. Run the Test Case in testRigor

3. Observe: Test Case fails (of course)

GREEN: Make the test pass

4. Develop = Make changes in the configuration

5 . Run the Test Case

6. If the Test Case fails then go to 4.

BLUE: REFACTOR

7. Clean

8 . Run the Test Case


A. Create and test a Validation Rule in Salesforce

Create the Validation Rule in Salesforce

  • Click: cog > "Setup"

  • Click: "Object Manager"

  • Click: "Account"

  • Click :"Validation Rules"

  • Click: "New"

  • Enter

    • Rule Name: "VR01_Billing_Country_Prohibited_RUSSIA"

    • Active: checked

    • Enter Error Condition Formula: "CONTAINS(UPPER(BillingCountry), "RUSSIA")"

    • Enter Error Message: "Due to the Russia's invasion in Ukraine, we don't do business with Accounts in Russia (UN Resolution ES 11/2). [VR01]"

    • Select Error Location: Field: Billing Country

  • Click: "Save"

  • Close this browser tab

Test the Validation Rule manually in Salesforce

  • Search: "Pyramid"

  • Click: Account "Pyramid Construction Inc."

  • Click: "Edit"

  • Enter Billing Country: "Russia"

  • Click: "Save"

  • Observe the error message

  • Click: "Cancel"


B. Test the Validation Rule using testRigor

  • Create a new Test Case in testRigor

  • Enter Description: "T0005 - Account Validation Rule"

  • Enter Custom steps: copy paste from below

  • Click: "Add and Run"

  • Observe progress and results of the Test Run

login
open URL from string with parameters "${URL_SALESFORCE_HOME}/lightning/o/Account/new"
generate from template "ACCOUNT ***** ***** ***** *****", then enter into "Account Name" and save as "AccountGenerated"
enter "Russian Federation" into "Billing Country"
click on "Save"
check that page contains "we don't do business with Accounts in Russia"

C. Additional twist for Salesforce Flow Builder experts:

  • ... you want to try a new feature in Flow:

    • Custom Error Message in Before Save Flow

      • with the same error message on the same field as in the Validation Rule

So:

  1. Dectivate the Validation Rule

  2. Manually test that Russia can be saved to Billing Country

  3. Create and activate the Flow

  4. Manually test that Russia cannot be saved to Billing Country

  5. Run the Test Case in testRigor

    1. Test Case passes as the feature is the same - only the implementation was changed

      1. no need to modify the Test Case!


PreviousCreate more records (T00004)NextAccount Action and List View Button (T00006)

Last updated 5 months ago

NO-CODE UI TESTING: Guide for testRigor & Salesforce
testRigor checked that the Validation Rule fired