Syntax Overview
File Structure
Every vanya file starts with a header declaring the language version and script title:
Vanya test scenario (vanya-lang.org/v0.1)
Script title: "login_test"The Vanya test scenario (domain/version) line declares the language version. The Script title: line provides a name for the test script (used for generated file names).
Test Structure
Vanya tests are organized into scenarios. Each scenario is an independent test case with a descriptive name:
Vanya test scenario (vanya-lang.org/v0.1)
Script title: "checkout_flow"
Setup for each Scenario: Within the Browser (plugin: playwright-python, type: browser, url: 'http://localhost:3000') go to "/cart"
Scenario: "empty cart shows message" see a div (text: 'Your cart is empty')
Scenario: "can proceed to checkout" click button (testid: 'add-item') click button (testid: 'checkout') see url contains "/checkout"The Setup for each Scenario: block runs before each scenario, providing shared initialization like browser setup and navigation. Each scenario generates a separate test function.
For simple single-test files, you can omit the Setup for each Scenario: and Scenario: blocks - the single-scenario syntax is still supported.
Indentation
Vanya uses significant indentation (like Python). Blocks are defined by their indentation level:
Within the Browser (plugin: playwright-python, type: browser, url: 'http://localhost:3000') go to "/login" Within the Login Form (type: element, id: 'login_form') Define email-input (label: 'Email') type "user@example.com" into email-input click submit-buttonUse consistent indentation (2 or 4 spaces). Tabs are not allowed.
Comments
Single-line comments start with #:
# This is a commentgo to "/login" # inline commentStrings
Strings can use single or double quotes:
go to "https://example.com"click button (id: 'submit')Keywords
Vanya has the following reserved keywords (all sentence case):
Vanya- file header declarationScript- script title declarationSetup- shared initialization block that runs before each scenario (followed byfor each Scenario:)Scenario- individual test case with a descriptive name; each generates a separate test functionWithin- context block (always followed bythe)Define- alias definitionExport- variable exportCapture- capture a value into a variable