Skip to content

v4.0.1: data generate attempts Salesforce record insertion even when outputFormat is only json #27

Description

@gurumoorthymani

Does Smock-It v4.0.1 support generating JSON/CSV test data without inserting records into Salesforce? If yes, what flag or configuration should be used?

Bug Report

I am using Smock-it v4.0.1 and selected only json as the output format. I did not select DI / Direct Insert.

However, when I run the data generation command, Smock-it still appears to attempt inserting records into Salesforce.

Expected Behavior

When the template has:

"outputFormat": ["json"]
Smock-it should only generate JSON files.
It should not attempt to insert records into Salesforce unless DI is explicitly selected in outputFormat or unless an upload/direct insert command is used.
Actual Behavior
Even though my template uses only:
"outputFormat": ["json"]
the data generation process attempts to insert records into Salesforce.
This is blocking our testing automation integration because our requirement is file-only test data generation. We need Smock-it to generate JSON files that our automation tool can consume, without creating Salesforce records.
Template Used
{
  "namespaceToExclude": [],
  "outputFormat": [
    "json"
  ],
  "count": 10,
  "sObjects": [
    {
      "account": {
        "count": 1,
        "fieldsToConsider": {
          "name": [],
          "phone": [],
          "website": []
        },
        "pickLeftFields": true,
        "relatedSObjects": [
          {
            "Contact": {
              "count": 1,
              "fieldsToConsider": {
                "lastname": [],
                "mobilephone": []
              },
              "pickLeftFields": true
            }
          },
          {
            "Opportunity": {
              "count": 1,
              "fieldsToConsider": {
                "name": [],
                "stagename": []
              },
              "pickLeftFields": true,
              "relatedSObjects": [
                {
                  "SBQQ__Quote__c": {
                    "count": 1,
                    "pickLeftFields": true,
                    "relatedSObjects": [
                      {
                        "SBQQ__QuoteLine__c": {
                          "count": 10,
                          "pickLeftFields": true
                        }
                      }
                    ]
                  }
                },
                {
                  "Order": {
                    "count": 1,
                    "pickLeftFields": true
                  }
                }
              ]
            }
          }
        ]
      }
    },
    {
      "contact": {}
    },
    {
      "opportunity": {}
    }
  ]
}
Command Used
sf smockit data generate -t <template-file-name>.json -a <org-alias>
Clarification / Fix Requested
Could you please confirm whether this is expected behavior in v4.0.1?
If outputFormat is only json, Smock-it should ideally skip any Salesforce insert operation and only write generated JSON files.
If there is another flag or configuration required for file-only generation, please document it clearly.
For example, is there a flag like:
--no-insert
or should excluding DI from outputFormat be enough?
Environment
Smock-it version: v4.0.1
Salesforce CLI version: <paste output of sf --version>
Node.js version: <paste output of node --version>
OS: <Windows/macOS/Linux>
Command run: sf smockit data generate -t <template-file-name>.json -a <org-alias>
Impact
This affects test automation integration. We need Smock-it only for test data file generation. The generated JSON will be consumed by our automation tool, and records should not be inserted directly into Salesforce.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions