IDE support for TableTest tables used in JUnit data-driven tests.
Website and docs: tabletest.org
Works in both desktop VS Code and VS Code for the Web (vscode.dev, github.dev, and compatible browser-hosted environments).
TableTest is a JUnit extension for writing data-driven tests as readable tables instead of repetitive test methods.
- Each column represents an input parameter or expected output
- Each row represents a test case
This style keeps test data clear, maintainable, and easy to extend.
- Rich syntax highlighting for TableTest tables:
- Header cells, including distinct styling for expected-value columns ending with
? //table comments- Map keys (quoted or unquoted)
- Nested list/set/map structures
- Header cells, including distinct styling for expected-value columns ending with
- Table auto-formatting with aligned
|columns - Cell value normalisation for lists/sets/maps
- Support for Java, Kotlin, and standalone
.tablefiles - Warnings for invalid table cell syntax, including:
- unquoted map keys that need quoting (for example
[key with spaces: value]) - trailing-comma empty elements (for example
[a, b,]) - map entries without values (for example
[key:]) - map values with extra top-level colons (for example
[a: b:c:d])
- unquoted map keys that need quoting (for example
- Automatic language injection for
@TableTestin Java and Kotlin, plus fully-qualified Java@org.tabletest.junit.TableTest(...)
| Context | Highlighting | Formatting |
|---|---|---|
.table file |
✅ source.tabletest grammar |
✅ Standard Format Document / Format Selection |
Java / Kotlin @TableTest(...) triple-quoted string |
✅ Injection grammar (source.java / source.kotlin) |
✅ TableTest: Format All Tables in Document |
Java @TableTest({ ... }) string-array table |
✅ Java injection grammar | ✅ TableTest: Format All Tables in Document |
Formatting in Java/Kotlin is intentionally exposed as a command so normal Java/Kotlin formatter entry points are not overridden.
The extension also runs as a web extension in browser-hosted VS Code.
.tablelanguage features work in the browser host.- Java and Kotlin support still depends on the corresponding language support being available in that environment.
tabletest.format.extraIndentLevelworks as normal in the browser host.- Browser-hosted VS Code does not read Java formatter XML from
java.format.settings.url; whentabletest.format.extraIndentLevelis not explicitly configured, Java falls back to the built-in TableTest default indentation.
From VS Code:
- Open Extensions (
Ctrl+Shift+X/Cmd+Shift+X) - Search for
TableTest - Install the extension published by
tabletest
Direct links:
- VS Code Marketplace: TableTest for VS Code
- Companion IntelliJ plugin: TableTest on JetBrains Marketplace
Command line:
code --install-extension tabletest.tabletestFrom local package (.vsix):
- Open Extensions view
...menu ->Install from VSIX...- Select your
.vsixfile
- Add TableTest dependency to your project alongside JUnit.
Maven:
<dependency>
<groupId>org.tabletest</groupId>
<artifactId>tabletest-junit</artifactId>
<version>1.0.0</version>
<scope>test</scope>
</dependency>Gradle:
testImplementation "org.tabletest:tabletest-junit:1.0.0"- Create a test using
@TableTestand write test data as a table in the annotation. - Format your tables with
TableTest: Format All Tables in Documentfrom Command Palette. - Use standard VS Code shortcut to comment/uncomment lines:
Ctrl+/(Windows/Linux) orCmd+/(macOS). - Use standard VS Code shortcut to move lines up/down:
Alt+Up/Down(Windows/Linux) orOption+Up/Down(macOS).
Cell values can be:
- Empty
- Unquoted text
- Single-quoted or double-quoted strings
- Line comments:
// comment - Lists:
[a, b, c] - Sets:
{a, b, c} - Maps:
[k: v, "x": y, 'z': w] - Nested combinations of the above
Before:
a|b
[1,2]|[k:v]
After:
a | b
[1, 2] | [k: v]
Use Command Palette:
TableTest: Format All Tables in Document
Typical annotation forms:
@TableTest("""...""")@TableTest(value = """...""")@org.tabletest.junit.TableTest("""...""")(Java)@TableTest({ "header|value", "row|value" })(Java)@TableTest(value = { "header|value", "row|value" })(Java)
tabletest.format.extraIndentLevel(user-configurable; by default Kotlin behaves as0, while Java follows formatter continuation indentation)- Adds extra indentation levels to formatted rows inside Java/Kotlin
@TableTesttriple-quoted strings and Java string-array tables. - For Java, when this setting is not explicitly configured, TableTest reads
java.format.settings.urlprofile values (continuation_indentation_for_array_initializer/continuation_indentation) and falls back to2levels if unavailable. - In browser-hosted VS Code,
java.format.settings.urlis not read; Java falls back to2levels unless this TableTest setting is explicitly configured. - Indent width follows VS Code formatting options (
tabSize/insertSpaces) and respects EditorConfig-applied indentation.
- Adds extra indentation levels to formatted rows inside Java/Kotlin
- Annotation extraction in Java/Kotlin uses a lightweight scanner, not a full parser.
valueis extracted only from a direct supported literal:- triple-quoted literal (
"""..."""), or - Java static string-array literal (
{"...", "..."}).
- triple-quoted literal (
- For implicit Java string-array formatting, the formatter normalises boundaries to
@TableTest({...}). - Implicit extraction is only used when there is exactly one positional argument and no named arguments.
- Diagnostics currently focus on syntax problems inside recognisable table cells, including malformed list/set/map values and unquoted map keys that require quoting.
Developer documentation and release workflow are in CONTRIBUTING.md.
Common local test commands:
- Fast unit suite:
npm testornpm run test:unit - Strict VS Code integration suite:
npm run test:integration:strict - Browser-hosted web integration smoke suite:
npm run test:integration:web - Full local suite matching CI gates:
npm run test:full