HubSpot QA Automation

Run HubSpot test scenarios using the Crank BDD framework.

HubSpot 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/hubspot

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
apiKey *CRANK_AUTOMATONINC_HUBSPOT__APIKEYAPI Key

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

$ crank cog:auth automatoninc/hubspot

HubSpot Test Steps

Create or update a HubSpot contact Action

Use this step in a Scenario file like this:

- step: When I create or update a hubspot contact
  data:
    contact:
      field: value
Expected Step Input
IDTypeDescription
contact *Map/ObjectA map of field names to field values
Exposed Dynamic Tokens
TokenTypeDescription
{{hubspot.contact.hs_object_id}}NumberThe contact's ID
{{hubspot.contact.createdate}}ISO 8601 DatetimeThe Contact's Create Date
{{hubspot.contact.lastmodifieddate}}ISO 8601 DatetimeThe Contact's Last Modified Date
{{hubspot.contact.*}}*This step may expose additional dynamic tokens representing values on the contact, depending on how you've configured the underlying system.

Delete a HubSpot contact Action

Use this step in a Scenario file like this:

- step: Finally, delete the {{email}} hubspot contact
Expected Step Input
IDTypeDescription
email *Email AddressContact's email address
Exposed Dynamic Tokens
TokenTypeDescription
{{hubspot.contact.hs_object_id}}NumberThe contact's ID
{{hubspot.contact.createdate}}ISO 8601 DatetimeThe Contact's Create Date
{{hubspot.contact.lastmodifieddate}}ISO 8601 DatetimeThe Contact's Last Modified Date
{{hubspot.contact.*}}*This step may expose additional dynamic tokens representing values on the contact, depending on how you've configured the underlying system.

Enroll a HubSpot Contact into a Workflow Action

Use this step in a Scenario file like this:

- step: When I enroll the {{email}} hubspot contact into workflow {{workflow}}
Expected Step Input
IDTypeDescription
workflow *Any ScalarWorkflow's Name or ID
email *Email AddressContact's email address
Exposed Dynamic Tokens
TokenTypeDescription
{{hubspot.workflow.id}}NumberThe Workflow's ID
{{hubspot.workflow.name}}StringThe Workflow's Name
{{hubspot.workflow.type}}StringThe Workflow's Type
{{hubspot.workflow.description}}StringThe Workflow's Description
{{hubspot.contact.hs_object_id}}NumberThe contact's ID
{{hubspot.contact.createdate}}ISO 8601 DatetimeThe Contact's Create Date
{{hubspot.contact.lastmodifieddate}}ISO 8601 DatetimeThe Contact's Last Modified Date
{{hubspot.contact.*}}*This step may expose additional dynamic tokens representing values on the contact, depending on how you've configured the underlying system.

Check a field on a HubSpot Contact Assertion

Use this step in a Scenario file like this:

- step: Then the {{field}} field on hubspot contact {{email}} should {{operator}} {{expectation}}
Expected Step Input
IDTypeDescription
email *Email AddressContact'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
Exposed Dynamic Tokens
TokenTypeDescription
{{hubspot.contact.hs_object_id}}NumberThe Contact's ID
{{hubspot.contact.email}}Email AddressThe Contact's Email
{{hubspot.contact.createdate}}ISO 8601 DatetimeThe Contact's Create Date
{{hubspot.contact.lastmodifieddate}}ISO 8601 DatetimeThe Contact's Last Modified Date
{{hubspot.contact.*}}*This step may expose additional dynamic tokens representing values on the contact, depending on how you've configured the underlying system.

Check Current Workflow Enrollment of a HubSpot Contact Assertion

Use this step in a Scenario file like this:

- step: Then the {{email}} hubspot contact should currently be enrolled in workflow {{workflow}}
Expected Step Input
IDTypeDescription
workflow *Any ScalarWorkflow's Name or ID
email *Email AddressContact's email address
Exposed Dynamic Tokens
TokenTypeDescription
{{hubspot.contact.id}}NumberThe Contact's ID
{{hubspot.contact.email}}Email AddressThe Contact's Email
{{hubspot.contact.createdate}}ISO 8601 DatetimeThe Contact's Create Date
{{hubspot.contact.lastmodifieddate}}ISO 8601 DatetimeThe Contact's Last Modified Date
{{hubspot.workflow.name}}StringThe Workflow's Name
{{hubspot.workflow.id}}NumberThe Workflow's ID
{{hubspot.workflow.type}}StringThe Workflow's Type
{{hubspot.workflow.description}}StringThe Workflow's Description
{{hubspot.contact.*}}*This step may expose additional dynamic tokens representing values on the contact, 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