Skip to main content

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:

ColumnDescription
NameTemplate name (e.g., "Playwright (TypeScript)")
FrameworkThe testing framework or tool
File ExtensionOutput file extension (e.g., .spec.ts)
LanguageProgramming language
EnabledWhether the template appears in the QuickScript dropdown
DefaultThe default template is pre-selected when using QuickScript
ActionsEdit 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

  1. Click Add QuickScript Template.

  2. 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.
  3. 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.
  4. Verify the output in the Preview panel on the right, which renders the template with sample data in real time.

  5. Click Submit.

Editing a Template

  1. Click the Edit button (pencil icon) for the template.
  2. Modify any fields. The preview updates as you type.
  3. Click Submit.

Deleting a Template

  1. Click the Delete button (trash icon) for the template. The default template cannot be deleted.
  2. 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

VariableTypeDescription
{{name}}TextTest case name
{{id}}IntegerTest case ID
{{folder}}TextFolder name
{{state}}TextWorkflow state
{{estimate}}IntegerTime estimate in seconds
{{automated}}CheckboxWhether the case is automated
{{tags}}TextComma-separated tag names
{{createdBy}}TextCreator's name or email
{{createdAt}}DateCreation date (yyyy-MM-dd)

Steps

Use a Mustache section block to iterate over test steps:

{{#steps}}
{{order}}. {{step}} — {{expectedResult}}
{{/steps}}
VariableTypeDescription
{{#steps}}...{{/steps}}BlockIterates over each step
{{order}}IntegerStep number (1-indexed)
{{step}}TextStep description
{{expectedResult}}TextExpected 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}}}.

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.