Marketo QA Automation

Run Marketo test scenarios using the Crank BDD framework.

Marketo Logo

Installing and Authenticating this Cog

Once you've successfully installed Crank you can install this Cog by running the following:

$ crank cog:install automatoninc/marketo

You will be asked for the following authentication details on installation. To avoid prompts in a CI/CD context, you can provide the same details as environment variables.

Expected Authentication Details
FieldInstall-Time Environment VariableDescription
endpoint *CRANK_AUTOMATONINC_MARKETO__ENDPOINTREST API endpoint (without /rest), e.g. https://123-abc-456.mktorest.com
clientId *CRANK_AUTOMATONINC_MARKETO__CLIENTIDClient ID
clientSecret *CRANK_AUTOMATONINC_MARKETO__CLIENTSECRETClient Secret

You can always re-authenticate by running the following command.

$ crank cog:auth automatoninc/marketo
Further Auth Details Here

Marketo Test Steps

Add Marketo Lead to Smart Campaign Action

Use this step in a Scenario file like this:

- step: When I add the {{email}} marketo lead to smart campaign {{campaign}}
Expected Step Input
IDTypeDescription
email *Email AddressLead's email address
campaign *Any ScalarSmart campaign name or numeric id
partitionId NumberID of partition lead belongs to
Exposed Dynamic Tokens
TokenTypeDescription
{{marketo.lead.id}}NumberLead's Marketo ID
{{marketo.lead.email}}Email AddressLead's Email
{{marketo.lead.createdAt}}ISO 8601 DatetimeLead's Create Date
{{marketo.lead.updatedAt}}ISO 8601 DatetimeLead's Update Date
{{marketo.lead.firstName}}StringLead's First Name
{{marketo.lead.lastName}}StringLead's Last Name
{{marketo.campaign.id}}NumberCampaign's Marketo ID
{{marketo.campaign.name}}StringCampaign's Email
{{marketo.campaign.description}}StringCampaign's Description
{{marketo.campaign.type}}StringCampaign's Type
{{marketo.campaign.updatedAt}}ISO 8601 DatetimeCampaign's Update Date
{{marketo.campaign.createdAt}}ISO 8601 DatetimeCampaign's Update Date
{{marketo.lead.*}}*This step may expose additional dynamic tokens representing values on the lead, depending on how you've configured the underlying system.
{{marketo.campaign.*}}*This step may expose additional dynamic tokens representing values on the campaign, depending on how you've configured the underlying system.

Create or Update a Marketo Custom Object Action

Use this step in a Scenario file like this:

- step: When I create or update an {{name}} marketo custom object linked to lead {{linkValue}}
  data:
    customObject:
      field: value
Expected Step Input
IDTypeDescription
name *StringCustom Object's API name
linkValue *Email AddressLinked Lead's email address
customObject *Map/ObjectMap of custom object data whose keys are field names.
partitionId NumberID of partition lead belongs to
Exposed Dynamic Tokens
TokenTypeDescription
{{marketo.customObject.marketoGUID}}StringCustom Object's Marketo GUID

Create or update a Marketo Lead Action

Use this step in a Scenario file like this:

- step: When I create or update a marketo lead
  data:
    lead:
      field: value
Expected Step Input
IDTypeDescription
lead *Map/ObjectA map of field names to field values
Exposed Dynamic Tokens
TokenTypeDescription
{{marketo.lead.id}}NumberLead's Marketo ID

Delete a Marketo Custom Object Action

Use this step in a Scenario file like this:

- step: Finally, delete the {{name}} marketo custom object linked to lead {{linkValue}}
Expected Step Input
IDTypeDescription
name *StringCustom Object's API name
linkValue *Email AddressLinked Lead's email address
dedupeFields Map/ObjectMap of custom dedupeFields data whose keys are field names.
partitionId NumberID of partition lead belongs to
Exposed Dynamic Tokens
TokenTypeDescription
{{marketo.customObject.marketoGUID}}StringCustom Object's Marketo GUID

Delete a Marketo Lead Action

Use this step in a Scenario file like this:

- step: Finally, delete the {{email}} marketo lead
Expected Step Input
IDTypeDescription
email *Email AddressLead's email address
partitionId NumberID of partition lead belongs to
Exposed Dynamic Tokens
TokenTypeDescription
{{marketo.lead.id}}NumberLead's Marketo ID

Check a field on a Marketo Custom Object Assertion

Use this step in a Scenario file like this:

- step: Then the {{field}} field on the {{name}} marketo custom object linked to lead {{linkValue}} should {{operator}} {{expectedValue}}
Expected Step Input
IDTypeDescription
name *StringCustom Object's API name
linkValue *Email AddressLinked Lead's email address
field *StringField name to check
operator *StringCheck Logic (be, not be, contain, not contain, be greater than, be less than, be set, not be set, be one of, or not be one of)
expectedValue Any ScalarThe expected value of the field
dedupeFields Map/ObjectMap of custom dedupeFields data whose keys are field names.
partitionId NumberID of partition lead belongs to
Exposed Dynamic Tokens
TokenTypeDescription
{{marketo.customObject.marketoGUID}}StringCustom Object's Marketo GUID
{{marketo.customObject.createdAt}}ISO 8601 DatetimeCustom Object's create date
{{marketo.customObject.updatedAt}}ISO 8601 DatetimeCustom Object's last update date
{{marketo.customObject.*}}*This step may expose additional dynamic tokens representing values on the customObject, depending on how you've configured the underlying system.

Check a field on a Marketo Lead Assertion

Use this step in a Scenario file like this:

- step: Then the {{field}} field on marketo lead {{email}} should {{operator}} {{expectation}}
Expected Step Input
IDTypeDescription
email *Email AddressLead's email address
field *StringField name to check
operator StringCheck Logic (be, not be, contain, not contain, be greater than, be less than, be set, not be set, be one of, or not be one of)
expectation Any ScalarExpected field value
partitionId NumberID of partition lead belongs to
Exposed Dynamic Tokens
TokenTypeDescription
{{marketo.lead.id}}NumberLead's Marketo ID
{{marketo.lead.email}}Email AddressLead's Email
{{marketo.lead.createdAt}}ISO 8601 DatetimeLead's Create Date
{{marketo.lead.updatedAt}}ISO 8601 DatetimeLead's Update Date
{{marketo.lead.firstName}}StringLead's First Name
{{marketo.lead.lastName}}StringLead's Last Name
{{marketo.lead.*}}*This step may expose additional dynamic tokens representing values on the lead, depending on how you've configured the underlying system.

Check a Marketo Lead's Activity Assertion

Use this step in a Scenario file like this:

- step: Then there should be an {{activityTypeIdOrName}} activity for marketo lead {{email}} in the last {{minutes}} minutes
Expected Step Input
IDTypeDescription
email *Email AddressThe email address of the Marketo Lead
activityTypeIdOrName *Any ScalarThe activity type ID (number) or name
minutes *NumberThe number of minutes prior to now to use when filtering the activity feed
withAttributes Map/ObjectRepresents additional parameters that should be used to validate an activity. The key in the object represents an attribute name and the value represents the expected value
partitionId NumberID of partition lead belongs to
Exposed Dynamic Tokens
TokenTypeDescription
{{marketo.activity.id}}NumberActivity's Marketo ID
{{marketo.activity.leadId}}NumberLead's Marketo ID
{{marketo.activity.activityDate}}ISO 8601 DatetimeActivity's Date
{{marketo.activity.activityTypeId}}NumberActivity Type's ID
{{marketo.activity.*}}*This step may expose additional dynamic tokens representing values on the activity, depending on how you've configured the underlying system.

Missing a Step You Need?

This Cog is open source! Your contributions are welcome and encouraged.

Contribute on GitHubJoin the Crank Spectrum Community