HubSpot QA Automation
Run HubSpot test scenarios using the Crank BDD framework.

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.
Field | Install-Time Environment Variable | Description |
---|---|---|
apiKey * | CRANK_AUTOMATONINC_HUBSPOT__APIKEY | API 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
ID | Type | Description |
---|---|---|
contact * | Map/Object | A map of field names to field values |
Token | Type | Description |
---|---|---|
{{hubspot.contact.hs_object_id}} | Number | The contact's ID |
{{hubspot.contact.createdate}} | ISO 8601 Datetime | The Contact's Create Date |
{{hubspot.contact.lastmodifieddate}} | ISO 8601 Datetime | The 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
ID | Type | Description |
---|---|---|
email * | Email Address | Contact's email address |
Token | Type | Description |
---|---|---|
{{hubspot.contact.hs_object_id}} | Number | The contact's ID |
{{hubspot.contact.createdate}} | ISO 8601 Datetime | The Contact's Create Date |
{{hubspot.contact.lastmodifieddate}} | ISO 8601 Datetime | The 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}}
ID | Type | Description |
---|---|---|
workflow * | Any Scalar | Workflow's Name or ID |
email * | Email Address | Contact's email address |
Token | Type | Description |
---|---|---|
{{hubspot.workflow.id}} | Number | The Workflow's ID |
{{hubspot.workflow.name}} | String | The Workflow's Name |
{{hubspot.workflow.type}} | String | The Workflow's Type |
{{hubspot.workflow.description}} | String | The Workflow's Description |
{{hubspot.contact.hs_object_id}} | Number | The contact's ID |
{{hubspot.contact.createdate}} | ISO 8601 Datetime | The Contact's Create Date |
{{hubspot.contact.lastmodifieddate}} | ISO 8601 Datetime | The 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}}
ID | Type | Description |
---|---|---|
email * | Email Address | Contact's email address |
field * | String | Field name to check |
operator | String | Check 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 Scalar | Expected field value |
Token | Type | Description |
---|---|---|
{{hubspot.contact.hs_object_id}} | Number | The Contact's ID |
{{hubspot.contact.email}} | Email Address | The Contact's Email |
{{hubspot.contact.createdate}} | ISO 8601 Datetime | The Contact's Create Date |
{{hubspot.contact.lastmodifieddate}} | ISO 8601 Datetime | The 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}}
ID | Type | Description |
---|---|---|
workflow * | Any Scalar | Workflow's Name or ID |
email * | Email Address | Contact's email address |
Token | Type | Description |
---|---|---|
{{hubspot.contact.id}} | Number | The Contact's ID |
{{hubspot.contact.email}} | Email Address | The Contact's Email |
{{hubspot.contact.createdate}} | ISO 8601 Datetime | The Contact's Create Date |
{{hubspot.contact.lastmodifieddate}} | ISO 8601 Datetime | The Contact's Last Modified Date |
{{hubspot.workflow.name}} | String | The Workflow's Name |
{{hubspot.workflow.id}} | Number | The Workflow's ID |
{{hubspot.workflow.type}} | String | The Workflow's Type |
{{hubspot.workflow.description}} | String | The 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