What Are Test Automations?
Test automations provide a safe, sandboxed environment for function authors to:- Test how a function’s business logic interacts with Speckle project data.
- Validate that the function produces the desired results.
- Are not triggered by project data changes.
- Cannot be manually triggered via the UI.
- Do not execute published functions directly, but allow you to run your function locally while connecting to Speckle data.
How to Create a Test Automation
Test automations are created from the project’s Settings → Automations page, like any other automation.1
Open project Automations
Open the project, then Settings → Automations. You should see New Automation above the
automations table.
2
Switch to a test automation
Select New Automation, then Create test automation. The dialog title changes to Create
test automation and the function fields disappear.
3
Choose the model and name
Select the model your function should run against in Trigger model, and enter an
Automation name.
4
Create the test automation
Select Create. The test automation’s page opens with a Test badge, its Connected
model, and a Configuration section.
How to Use Test Automations
Both the C# SDK and Python SDK include utilities for interacting with test automations. Example functions are available in both:Required Environment Variables
To run your tests, configure the following in your environment: Environment Variables:SPECKLE_TOKEN: Create a Personal Access Token.SPECKLE_SERVER_URL: URL of your Speckle Server, e.g.,https://app.speckle.systems/.SPECKLE_PROJECT_ID: The ID of your Speckle project with the test automation.SPECKLE_AUTOMATION_ID: The ID of your test automation.
/projects/[project-id]/settings/automations/[automation-id].
Token scopes
For local testing with the Python template, a token with five scopes is enough when your function only reads the model and reports results. Add up to four more if it writes anything back. A read-only function (receives the model, attaches results, marks success or failure) needs:
If your function writes back, also add:
A read-only function that attaches a report file still needs
workspace.blob.write.Running Test Cases
- Set up your local environment with the required values.
- Run the test command (
pytest,dotnet test, etc.) from your development setup. - The SDK utilities will:
- Connect to the test automation via the API.
- Run your function locally, generating results.
- Submit the results to the test automation for validation.
Limitations
To set up a test automation, you need permission to manage the project’s automations; project owners have it. A test automation is not tied to a function, so your function does not need a release yet.Key Notes on Test Automations
- Test automations do not ask for function inputs during creation; inputs should be set up in your development environment.
- Test automations are sandboxed environments designed to aid in integration testing. They do not execute functions directly within the Automate runtime.
- Test runs allow you to debug locally while validating outcomes against Speckle project data.