All Projects → mbotos → Smartfactory For Force.com

mbotos / Smartfactory For Force.com

Licence: apache-2.0
Salesforce test data generator fills lookups, master-detail relationships, and required fields. Native Force.com Apex code using dynamic metadata.

Labels

Projects that are alternatives of or similar to Smartfactory For Force.com

Prettier Plugin Apex
Code formatter for the Apex Programming Language
Stars: ✭ 138 (-42.02%)
Mutual labels:  apex
Twilio Salesforce
A Salesforce/Force.com library for communicating with the Twilio REST API and generating TwiML. Need help? Post your questions to http://getsatisfaction.com/twilio or email us at [email protected]
Stars: ✭ 185 (-22.27%)
Mutual labels:  apex
Improved Body Parts
Simple Pose: Rethinking and Improving a Bottom-up Approach for Multi-Person Pose Estimation
Stars: ✭ 202 (-15.13%)
Mutual labels:  apex
Automation Components
Automation Components are a collection of reusable and production-ready extensions that include invocable actions, flow screen components and local actions.
Stars: ✭ 141 (-40.76%)
Mutual labels:  apex
Eda
Education Data Architecture
Stars: ✭ 175 (-26.47%)
Mutual labels:  apex
Haoide
Stop upgrade, most of features were delivered in https://github.com/xjsender/haoide-vscode
Stars: ✭ 194 (-18.49%)
Mutual labels:  apex
Attic Apex Malhar
Mirror of Apache Apex malhar
Stars: ✭ 131 (-44.96%)
Mutual labels:  apex
Person reid baseline pytorch
Pytorch ReID: A tiny, friendly, strong pytorch implement of object re-identification baseline. Tutorial 👉https://github.com/layumi/Person_reID_baseline_pytorch/tree/master/tutorial
Stars: ✭ 2,963 (+1144.96%)
Mutual labels:  apex
Salesforce Test Factory
SObject factory that can be used in unit tests to create test data.
Stars: ✭ 184 (-22.69%)
Mutual labels:  apex
Sfdx Mass Action Scheduler
🚀 Declaratively schedule Process Builder, Flows, Quick Actions, Email Alerts, Workflow Rules, or Apex to process records from Reports, List Views, SOQL, or Apex.
Stars: ✭ 200 (-15.97%)
Mutual labels:  apex
Custommetadataloader
Tool to help users bulk create and update custom metadata records in salesforce.com from a CSV file.
Stars: ✭ 142 (-40.34%)
Mutual labels:  apex
Force Di
Generic DI library with support for Apex, Triggers, Visualforce and Lightning
Stars: ✭ 165 (-30.67%)
Mutual labels:  apex
Milestones Pm
Lightweight Project and Task Management for Force.com #forcedotcom
Stars: ✭ 195 (-18.07%)
Mutual labels:  apex
Fast Reid
SOTA Re-identification Methods and Toolbox
Stars: ✭ 2,287 (+860.92%)
Mutual labels:  apex
Lightnetplusplus
LightNet++: Boosted Light-weighted Networks for Real-time Semantic Segmentation
Stars: ✭ 218 (-8.4%)
Mutual labels:  apex
Dreamhouse Lwc
Sample application for Lightning Web Components on Salesforce Platform. Part of the sample gallery. Real estate use case. Get inspired and learn best practices.
Stars: ✭ 136 (-42.86%)
Mutual labels:  apex
Apex Lambda
Functional programming for Salesforce Apex
Stars: ✭ 189 (-20.59%)
Mutual labels:  apex
University1652 Baseline
ACM Multimedia2020 University-1652: A Multi-view Multi-source Benchmark for Drone-based Geo-localization 🚁 annotates 1652 buildings in 72 universities around the world.
Stars: ✭ 232 (-2.52%)
Mutual labels:  apex
Soqlx
SoqlXplorer is an awesome tool for developers using the Salesforce.com platform.
Stars: ✭ 220 (-7.56%)
Mutual labels:  apex
Step
STEP: Spatio-Temporal Progressive Learning for Video Action Detection. CVPR'19 (Oral)
Stars: ✭ 196 (-17.65%)
Mutual labels:  apex

Salesforce Test Data Generator

Salesforce test data generator fills lookups, master-detail relationships, and required fields.

Native Force.com Apex code using dynamic metadata.

Quickly Generate Lookups, Master-Detail Relationships, and Required Fields

How often have you wasted hours reverse-engineering a new schema just to create data for a unit test?

Task__c testTask = new Task__c();
ERROR: Field Desciption__c required on Task__c

Task__c testTask = new Task__c(Description__c = 'Create unit test data');`
ERROR: Lookup relationship Project__c required on Task__c`

Project__c testProject = new Project__c();
Task__c testTask = new Task__c(Project__c = testProject, Description__c = 'Create unit test data');
ERROR: Field Status__c required on Project__c
...

Watch SmartFactory dynamically use the Describe metadata to populate all required fields with valid data and create any related objects:

Task__c testTask = (Task__c)SmartFactory.createSObject('Task__c');

Learn Salesforce Testing Best Practices

3 Principles of Salesforce Testing includes production code by Salesforce MVP Matthew Botos.

The Evolution of Test Data provides more background on the problem and SmartFactory's solution.

SmartFactory's first version won the Mavens Consulting 2011 Hackathon in less than a single day of coding.

Easy 1-Line Usage

Just use SmartFactory in your tests to create objects:

Account account = (Account)SmartFactory.createSObject('Account');

To cascade and create objects for lookup and master-detail relationships:

Contact contact = (Contact)SmartFactory.createSObject('Contact', true);

The same syntax is used for custom objects:

Custom_Object__c customObject = (Custom_Object__c)SmartFactory.createSObject('Custom_Object__c');

See SmartFactory_Test for additional examples.

Powerful Options

Include or Exclude Fields

To fill only required and included fields:

SmartFactory.FillAllFields = false;
SmartFactory.IncludedFields.put('Account', 'AccountNumber');

Account account = (Account)SmartFactory.createSObject('Account');

To fill all fields but those excluded:

SmartFactory.FillAllFields = true;
SmartFactory.ExcludedFields.put('Account', 'AccountNumber');

Account account = (Account)SmartFactory.createSObject('Account');

Validation Rules

To set specific values to pass your custom Validation Rules, wrap SmartFactory with your own class like this:

public class TestObjectFactory {
  public static Account createAccount() {
    Account account = (Account)SmartFactory.createSObject('Account');
    account.Customer_Terms__c = 'Net 30';
    return account;
  }
}

You can then call that reusable method from your tests. If you have validation rules on Account or Contact, you may also need to modify SmartFactory_Test.

Logging

To prevent the large number of system calls from filling your debug log, you can set logging filter overrides for the SmartFactory class: Setup - Develop - Apex Classes - SmartFactory - Log Filters - System = NONE.

Future Work

TODO comments note areas for additional development. Key areas include:

  1. Provide an field override map that allows callers to specify default values for specific objects and fields
  2. Provide a recursion limit for lookups to the same object type

Help and Discussion

For help and discussion, please use the project's Google Group.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].