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
-
Navigate to the Automations tab on your project page.
-
Click the New Automation button.
-
Select Create Test Automation in the bottom left.
-
Follow the instructions to configure your test automation.
-
Once created, your test automation will appear in the list. Use it to test your function against the project’s data.
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]/automations/[automation-id]
.
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 must:- Be an owner of the Speckle project.
- Have published the function to the Function Library.
- Ensure the function has at least one release (current technical limitation).
Future Restrictions: We may introduce further restrictions, such as requiring the test automation owner to be the author of the function being tested.
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.