QuickScript Templates
QuickScript Templates let you define the structure of the automation scripts generated by QuickScript. Each template is built with Mustache syntax and can target a specific framework (Playwright, Cypress, pytest, etc.), language, and file extension.
Overview
The QuickScript templates system provides:
- Mustache-based templating with access to all case fields, steps, and custom fields
- Header and footer sections for content that should appear once per file (e.g., import statements)
- Live preview with sample data while editing templates
- Built-in templates covering popular testing frameworks and formats, with the ability to create your own
Managing QuickScript Templates
To manage QuickScript templates, navigate to Administration and select QuickScript Templates from the left-hand navigation menu.
Viewing Templates
Templates are organized by category in collapsible accordion sections. Each section shows a count of templates in that category. The table columns are:
| Column | Description |
|---|---|
| Name | Template name (e.g., "Playwright (TypeScript)") |
| Framework | The testing framework or tool |
| File Extension | Output file extension (e.g., .spec.ts) |
| Language | Programming language |
| Enabled | Whether the template appears in the QuickScript dropdown |
| Default | The default template is pre-selected when using QuickScript |
| Actions | Edit and Delete buttons |
You can filter templates by searching across name, category, framework, language, and file extension. Additional dropdown filters are available for Framework, File Extension, Language, and enabled status.
Adding a Template
-
Click Add QuickScript Template.
-
Fill in the template details:
- Name: A unique, descriptive name (e.g., "Playwright (TypeScript)")
- Description: Optional summary of what the template generates
- Category: Group label for organizing templates (e.g., "Browser E2E", "Unit Testing"). You can type a new category or select an existing one.
- Framework: The testing framework (e.g., "Playwright", "Cypress"). Supports new or existing values.
- File Extension: Output file extension (e.g.,
.spec.ts,.feature). Supports new or existing values. - Language: Programming language (e.g., "typescript", "python"). Supports new or existing values.
- Enabled: Toggle to make the template available in QuickScript.
- Default: Toggle to pre-select this template in the QuickScript dialog. Only one template can be default.
-
Write the template content:
- Header Template (optional): Content rendered once at the top of the file. Use this for import statements, class declarations, or other boilerplate that should not repeat per test case. When AI generation is enabled, this is provided to the AI as a starting point it can extend.
- Template Body (required): The Mustache template rendered once per test case. Use the Insert Variable dropdown to insert available variables at the cursor position.
- Footer Template (optional): Content rendered once at the bottom of the file. Use this for closing brackets, export statements, or cleanup code.
-
Verify the output in the Preview panel on the right, which renders the template with sample data in real time.
-
Click Submit.
Editing a Template
- Click the Edit button (pencil icon) for the template.
- Modify any fields. The preview updates as you type.
- Click Submit.
Deleting a Template
- Click the Delete button (trash icon) for the template. The default template cannot be deleted.
- Confirm the deletion in the dialog.
Setting a Default Template
Click the Default toggle for any template. The previous default is unset automatically. The default template is pre-selected when users open the QuickScript dialog from the Repository.
Template Syntax
Templates use Mustache syntax. The Template Body is rendered once per test case with the case's data as context.
Available Variables
Case Fields
| Variable | Type | Description |
|---|---|---|
{{name}} | Text | Test case name |
{{id}} | Integer | Test case ID |
{{folder}} | Text | Folder name |
{{state}} | Text | Workflow state |
{{estimate}} | Integer | Time estimate in seconds |
{{automated}} | Checkbox | Whether the case is automated |
{{tags}} | Text | Comma-separated tag names |
{{createdBy}} | Text | Creator's name or email |
{{createdAt}} | Date | Creation date (yyyy-MM-dd) |
Steps
Use a Mustache section block to iterate over test steps:
{{#steps}}
{{order}}. {{step}} — {{expectedResult}}
{{/steps}}
| Variable | Type | Description |
|---|---|---|
{{#steps}}...{{/steps}} | Block | Iterates over each step |
{{order}} | Integer | Step number (1-indexed) |
{{step}} | Text | Step description |
{{expectedResult}} | Text | Expected result |
Custom Fields
Any enabled custom case fields are available under the fields namespace using the field's system name:
{{fields.priority}}
{{fields.preconditions}}
{{fields.component}}
The Insert Variable dropdown in the template editor lists all available custom fields with their types.
Escaping
Template output uses code-safe escaping by default: backslashes are escaped as \\ and double quotes as \". This makes output safe for use inside string literals in generated code. To output raw unescaped values, use triple braces: {{{name}}}.
Header and Footer Templates
When exporting multiple test cases into a single file, the Template Body repeats for each case. Without headers, content like import statements would duplicate:
import { test, expect } from "@playwright/test"; // case 1
test.describe("Login", () => { ... });
import { test, expect } from "@playwright/test"; // case 2 — duplicate!
test.describe("Signup", () => { ... });
The Header Template and Footer Template fields solve this. They render once per file, wrapping the repeated case bodies:
[Header — rendered once]
[Case 1 — from Template Body]
[Case 2 — from Template Body]
[Footer — rendered once]
Common uses:
- Header: Import statements, module declarations, test suite setup, license headers
- Footer: Closing brackets, export statements, teardown code
When AI generation is enabled, the header and footer are provided to the AI as a starting point. The AI generates a complete file and may extend or adapt them based on the repository context it has access to.
Exporting from the Repository
For instructions on how users generate scripts using QuickScript, see QuickScript.
Example: Creating a Custom Template
Here is an example of a template for Go tests using the standard testing package.
Header Template:
package myapp_test
import "testing"
Template Body:
// Test{{{name}}} verifies: {{{name}}}
func Test{{{name}}}(t *testing.T) {
{{#steps}}
// Step {{order}}: {{{step}}}
// Expected: {{{expectedResult}}}
t.Run("{{{step}}}", func(t *testing.T) {
t.Skip("Not implemented")
})
{{/steps}}
}
Footer Template: (empty)
With two test cases selected, the single-file export would produce:
package myapp_test
import "testing"
// TestUserLogin verifies: User Login
func TestUserLogin(t *testing.T) {
// Step 1: Navigate to login page
// Expected: Login page is displayed
t.Run("Navigate to login page", func(t *testing.T) {
t.Skip("Not implemented")
})
// Step 2: Enter credentials
// Expected: Fields accept input
t.Run("Enter credentials", func(t *testing.T) {
t.Skip("Not implemented")
})
}
// TestUserLogout verifies: User Logout
func TestUserLogout(t *testing.T) {
// Step 1: Click logout button
// Expected: User is redirected to login page
t.Run("Click logout button", func(t *testing.T) {
t.Skip("Not implemented")
})
}
Notice how the import "testing" statement appears only once at the top thanks to the Header Template.