Table Data

Your business logic tests can greatly improve maintainability of your documentation. The example below tests what account types are allowed to perform Trading Activities. package org.testingisdocumenting.testing.examples import import org.testingisdocumenting.webtau.documentation.DocumentationArtifacts import org.junit.Test class TestToDocExample { @Test void shouldRestrictAccountsActivity() { def rules = ["Account Type" | "Operation" | "Restriction"] { _________________________________________________ "SPB3" | "Buy Options" | "weekends only" "TR" | "Sell Futures" | "except holidays" "BOSS" | "Buy Stocks" | "none" } validateRules(rules) } private static void validateRules(TableData rules) { DocumentationArtifacts.create(TestToDocExample, "account-rules.json", rules.toJson()) } } As part of validation of account types, the test also captures data that was used for testing. We can refer to this data later in our documentation by using the layout/tables include-table plugin :include-table: account-rules.json Your test data and user-facing documentation is now linked. Account Type Operation Restriction SPB3 Buy Options weekends only TR Sell Futures except holidays BOSS Buy Stocks none