Skip to main content

Unit-Test Export Frameworks Across UI, REST, and MCP

· 2 min read
Alan Richardson
Creator of AnyWayData

We added a dedicated Code (Unit Test) export capability that now works consistently across the UI, REST API, and MCP tool interfaces.

Generated output is data-driven (parameterized) test code, with shared options for suite naming, setup scaffolding, pretty print, and data source strategy.

Code vs Code (Unit Test)

  • Code export outputs plain data structures in a programming language (for example arrays/objects/maps) that you can use anywhere in application code.
  • Code (Unit Test) export outputs parameterized test scaffolding for a specific unit test framework, including test-case feeding and assertion skeletons.

In short: Code is data-as-code; Code (Unit Test) is test-scaffold-as-code.

What Is Included

Supported frameworks:

  • Java: junit4, junit5, junit6, testng
  • Python: pytest, unittest, nose2
  • JavaScript: jest, vitest, mocha
  • C#: xunit, nunit, mstest
  • Ruby: rspec, minitest
  • PHP: phpunit, pest
  • Kotlin: kotest, junit5-kotlin, spek
  • Perl: test-more, test2-suite

Interfaces

The same output formats are available in:

  • Web UI: Code (Unit Test) tab with language-specific framework options
  • REST: existing /v1/generate and /v1/generate/fromschema endpoints via outputFormat
  • MCP: existing generation tool format enum/options

Example: Generated Vitest Unit Test

import { describe, expect, it } from 'vitest';

const rows = [
{ Name: 'Connie', Age: 21 },
{ Name: 'Miles', Age: 34 },
];

describe('GeneratedDataTests', () => {
it.each(rows)('row_parameterized_%#', (row) => {
const actual = mapRowUnderTest(row);
expect(actual['Name']).toStrictEqual(row['Name']);
expect(actual['Age']).toStrictEqual(row['Age']);
});
});

function mapRowUnderTest(input: Record<string, unknown>) {
// Replace with your SUT call, e.g. return userMapper.normalize(input);
return input;
}

Docs

The detailed option behavior and framework mapping are documented here:

Official Framework References