-
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 package
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.CustomDateOnly Field)
- Set Data Type to "Date" -> Next
- Set Field Label to "CustomDateOnly" -> 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 & New (Create Account.RichText field)
- Set Data Type to "Text Area (Rich)" -> Next
- Set Field Label to "RichText"
- 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 [-d] [-t <test class name>] <test org URL> <system admin username> <standard user username> <encrypted password>
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 -d
to attach a remote debugger to the test run. The JVM running the tests is listening on port 5005.
$ mvn -Dtest.endpoint=<server URL> -Dtest.user.default=<admin login name> -Dtest.user.restricted=<non-admin login name> -Dtest.password=<encrypted password> clean verify
The tests clean up before and after runs but if the database is suspect, perform a mass delete on Accounts and Contacts, and TestField
New tests will be added to the unit and integration test suites by default. If a test is an integration test (requires a server connection), exclude it from unit tests list by adding it to excluded tests in the unit tests section of pom.xml by looking for the line "".
To exclude an integration test from integration tests suite, look for the following text in pom.xml and add the test to exclude:
<!-- Specify the list of integration tests to exclude -->