Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A lightweight library for dynamically generating Sobject records & setting any required fields, based on the field's metadata

License

NotificationsYou must be signed in to change notification settings

jongpie/SmartTestDataFactory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation


An Apex library for dynamically setting any required fields on an Sobject record, based on the field's metadata

Deploy to Salesforce

Overview

This library simplifies the process of creating of test records in Salesforce. It can be leveraged in Apex unit tests to automatically set field values for any required field. This is useful when you need to insert records but the exact field values are not relevant to your tests.

Note: Lookup & master-detail fields arenot set by this library - you must set these fields yourself before you insert your record.

Usage

  1. Create your Sobject You can provide an empty record (new Account()), or you can set your own values for any field values that are important to your tests (new Account(Type='Prospect')).
  2. Create a new instance of TestDataFactory by passing your record in the constructor When you're ready, call populateRequiredFields() to set values for any null required fields.
Account testAccount = new Account();new TestDataFactory(testAccount).populateRequiredFields();System.assertNotEquals(null, testAccount.Name);insert testAccount;

About

A lightweight library for dynamically generating Sobject records & setting any required fields, based on the field's metadata

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp