Skip to content

Testing Dataloader

ashitsalesforce edited this page Sep 4, 2021 · 25 revisions

You've made edits and want to test them out to see how they work.

1. Run the core unit tests

These tests do not require connectivity and are reasonably performant.

$ mvn clean test

Note: New tests will be added to this list by default. Please edit pom.xml to exclude the test if it requires connectivity. Look for the below text in the pom.xml and add an exclude pattern if appropriate.

<!-- CORE UNIT TESTS: revise to keep this list fast and connectivity free -->

2. Setup an org for integration tests

Integration tests require an active org with pre-configured environment values

Create an Org

Use an API enabled org. This includes developer orgs with the limitations listed at https://developer.salesforce.com/page/Developer_Edition

Customize the Account entity

  1. Navigate to Setup -> Customize -> Accounts -> Fields
  2. Account Custom Fields -> New (Create Account.AccountNumber Field)
  3. Set Data Type to "Text" -> Next
  4. Set Field Label to "AccountNumber"
  5. Set Length to "100" -> Next
  6. Next
  7. Save & New (Create Account.Oracle_Id Field)
  8. Set Data Type to "Text" -> Next
  9. Set Field Label to "Oracle_Id"
  10. Set External ID to true -> Next
  11. Set Length to "100" -> Next
  12. Next
  13. Save & New (Create Account.CustomDateTime Field)
  14. Set Data Type to "Date/Time" -> Next
  15. Set Field Label to "CustomDateTime" -> Next
  16. Next
  17. Save & New (Create Account.Integration_Status field)
  18. Set Data Type to "Text" -> Next
  19. Set Field Label to "Integration_Status"
  20. Set Length to "20" -> Next
  21. Next
  22. Save

Create a TestField custom entity

  1. Navigate to Create -> Objects
  2. New Custom Object (Create TestField Custom Entity)
  3. Set Label to "TestField"
  4. Set Plural Label to "TestFields"
  5. Save
  6. Custom Fields -> New (Create TestField.TestField Field)
  7. Set Data Type to "Text" -> Next
  8. Set Field Label to "TestField"
  9. Set External ID to true -> Next
  10. Set Length to "100" -> Next
  11. Next
  12. Save

Customize the Contact entity

  1. Navigate to Contacts -> Fields
  2. Contact Custom Fields -> New (Create Contact.NumberId Field)
  3. Set Data Type to "Number" -> Next
  4. Set Field Label to "NumberId"
  5. Set External ID to true -> Next
  6. Next
  7. Save & New (Create Contact.TestField Field)
  8. Set Data Type to "Lookup Relationship" -> Next
  9. Set Related to "TestField" -> Next
  10. Next
  11. Next
  12. Save

Create Hard Delete System Admin

  1. Manage Users -> Profiles
  2. Select "System Administrator" (It may be on the second page of profiles)
  3. Clone
  4. Enter the profile name "Data Loader Administrator"
  5. Save
  6. Edit
  7. Set "Bulk API Hard Delete" to true
  8. Save
  9. Manage Users -> Users
  10. New User
  11. Create new user with Profile "Data Loader Administrator"
  12. Make note of the user name
  13. Save

Create Non-Privledged Account

  1. Manage Users -> Users
  2. Create new user with Profile "Standard User" (On developer accounts, you may run out of licenses. If you do, try user license "Salesforce Platform" and profile "Standard Platform User".
  3. Make note of the user name
  4. Save

Setup passwords

  1. Activate both accounts with the same password
  2. Encrypt the password with Data Loader. This [jar] is the ./target/dataloader-*-uber.jar file

java -cp [jar] com.salesforce.dataloader.security.EncryptionUtil -e [PASSWORD]

Modify POM.XML

Pass the below arguments to maven or modify the pom.xml (just don't check the modified pom.xml in!)

<test.endpoint>SERVER URL</test.endpoint>

<test.user.default>ADMIN LOGIN NAME</test.user.default>

<test.user.restricted>NONADMIN LOGIN NAME</test.user.restricted>

<test.password>ENCRYPTED PASSWORD</test.password>

Run the integration tests

These tests encompass the core unit tests and all integration tests

$ mvn clean test -Pintegration-test -DtargetOS=<macos_x86_64 | windows_x86_64 | macos_arm_64 | linux_x86_64>

Note: -DtargetOS specifies the OS platform on which code is compiled and tests are run.

Note: New tests will be added to this list by default. Please edit pom.xml to exclude work's in progress. Look for the exclude list in the integration-test profile or the below text:

<!-- INTEGRATION UNIT TESTS: revise to remove works in progress -->

Subsequent runs

The tests clean up before and after runs but if the database is suspect, perform a mass delete on Accounts and Contacts, and TestField

Clone this wiki locally