Skip to main content

Manual Liquid Test Specs

Testspace manual test specifications now support the Liquid templating language. Test specs are handled as template files, meaning they get preprocessed before being statically rendered. This functionality enables a markdown file to use variables, include other markdown files (subroutines) along with passing parameters, and even implement conditional logic.

Leveraging the GitHub static website generator Jekyll, which supports Liquid, test specs can be implemented and previewed on your desktop during development.

Testspace uses Liquid to pre-process test spec files written in markdown. The Liquid language consists of:

  • objects/variable - contains content displayed
  • tags - control flow
  • filters - changes the output of objects/variables

For more details on implementing test specs leveraging the Liquid template language, refer here.

Example

The following example leverages variables and tags (i.e. include).

Example of a reusable include file:

/specs/_includes/inc.md
## Case 2
My description here
- Check this subdomain: {{ spec.subdomain }}
- Click here: https://{{ spec.subdomain }}.{{ include.domain }}

Example of a test spec including and passing parameters:

/specs/myspec.md
---
testspace: true
title: Test 1
subdomain: s2
---

# {{ spec.title }}
Some description

## Case 1
- Do this
- Do that

{% include inc.md domain="testspace.com" %}

The test spec will be rendered as follows:

Test 1

Some description

Case 1
  • Do this
  • Do that
Case 2

My description here