-
Notifications
You must be signed in to change notification settings - Fork 295
Testing Dataloader
You've made edits and want to test them out to see how they work.
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 -->
Integration tests require an active org with pre-configured environment values
Use an API enabled org. This includes developer orgs with the limitations listed at https://developer.salesforce.com/page/Developer_Edition
- Navigate to Setup -> Customize -> Accounts -> Fields
- Account Custom Fields -> New (Create Account.AccountNumber Field)
- Set Data Type to "Text" -> Next
- Set Field Label to "AccountNumber"
- Set Length to "100" -> Next
- Next
- Save & New (Create Account.Oracle_Id Field)
- Set Data Type to "Text" -> Next
- Set Field Label to "Oracle_Id"
- Set External ID to true -> Next
- Set Length to "100" -> Next
- Next
- Save & New (Create Account.CustomDateTime Field)
- Set Data Type to "Date/Time" -> Next
- Set Field Label to "CustomDateTime" -> Next
- Next
- Save & New (Create Account.Integration_Status field)
- Set Data Type to "Text" -> Next
- Set Field Label to "Integration_Status"
- Set Length to "20" -> Next
- Next
- Save
- Navigate to Create -> Objects
- New Custom Object (Create TestField Custom Entity)
- Set Label to "TestField"
- Set Plural Label to "TestFields"
- Save
- Custom Fields -> New (Create TestField.TestField Field)
- Set Data Type to "Text" -> Next
- Set Field Label to "TestField"
- Set External ID to true -> Next
- Set Length to "100" -> Next
- Next
- Save
- Navigate to Contacts -> Fields
- Contact Custom Fields -> New (Create Contact.NumberId Field)
- Set Data Type to "Number" -> Next
- Set Field Label to "NumberId"
- Set External ID to true -> Next
- Next
- Save & New (Create Contact.TestField Field)
- Set Data Type to "Lookup Relationship" -> Next
- Set Related to "TestField" -> Next
- Next
- Next
- Save
- Manage Users -> Profiles
- Select "System Administrator" (It may be on the second page of profiles)
- Clone
- Enter the profile name "Data Loader Administrator"
- Save
- Edit
- Set "Bulk API Hard Delete" to true
- Save
- Manage Users -> Users
- New User
- Create new user with Profile "Data Loader Administrator"
- Make note of the user name
- Save
- Manage Users -> Users
- 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".
- Make note of the user name
- Save
- Activate both accounts with the same password
- 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]
$ cd <root of data loader clone directory>
$ ./runtests.sh [-v <version number such as 52.0.0>] [-d] [-t <test class name>] <targetOS> <test org URL> <system admin username> <standard user username> <encrypted password>
NOTE: targetOS
has to be one of macos_x86_64, windows_x86_64, macos_arm_64, linux_x86_64
NOTE: skip the prefix "com.salesforce.dataloader" when specifying test class name
in the optional parameter -t. For example, specify -t dyna.DateConverterTest
if you want to only do a test run of DateConverterTest.
NOTE: Specify -v <version>
for example -v 52.0.0
, if you want to test with an older version of WSC.
NOTE: Specify -d
to attach a remote debugger to the test run. The JVM running the tests is listening on port 5005.
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>
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 -->
The tests clean up before and after runs but if the database is suspect, perform a mass delete on Accounts and Contacts, and TestField