| Testing Method | Purpose | Script Name | Files Used | Exclude List | CI |
|---|---|---|---|---|---|
| 1. Functional Tests | Validate specific formatting features | Extension Tests | functionalTests |
No | Commit |
| 1.1 Functional → GitHub Issues | Track known GitHub issues | Extension Tests | functionalTests/issuesGithub |
functionalTests/_failures.txt |
Commit |
| 2.1 Stability → Symbol | Preserve non-whitespace symbols | Symbol Tests | ade |
stabilityTests/_symbol_failures.txt |
Commit, Nightly |
| 2.2 Stability → AST | Preserve AST structure | AST Tests | ade |
stabilityTests/_ast_failures.txt |
Commit, Nightly |
| 2.3 Stability → Compilation | Ensure code compiles after formatting | Compilation Tests | ade-sosourceCode |
compilationTests/_failures.txt |
No CI |
| 3.1 Metamorphic → Functional | Apply MRs to Functional Tests | Extension Tests (Metamorphic) | functionalTests |
No (skips failing tests) | No CI |
| 3.2 Metamorphic → AST | Apply MRs to AST Tests | AST Tests (Metamorphic) | ade |
No (skips failing tests) | No CI |
The goal of Functional Testing is to cover as many formatter features as possible using the simplest test cases. Tests are grouped by the formatter feature they validate (e.g. 'for'). Each test includes predefined input and expected output. Default formatter settings are defined in functionalTests/settings.json. An additional folder, functionalTests/issuesGithub, contains test cases derived from reported GitHub issues. These tests are intentionally marked as failing until the issues are fixed and must be listed in functionalTests/_failures.txt.
Stability Testing monitors changes in formatter quality over time by validating its core invariants. It focuses on the following properties:
- Symbol - Ensures the formatter only modifies whitespace (spaces, tabs, newlines) and does not change the count of non-whitespace symbols.
- AST - Ensures the abstract syntax tree (AST) structure remains unchanged after formatting.
- Compilation - Ensures that code known to compile before formatting still compiles afterward.
These tests require real-world code as input. The primary source is the ADE repository, which contains approximately 4,700 OpenEdge files. Compilation testing uses only a subset of ADE, as not all files can be compiled easily.
Metamorphic Testing takes testing to the new dimension by adding additional test cases on top of existing ones. Metamorphic Relation (MR) is a pair of functions which describe how the input and output of original test case has to be changed for test case to pass (or fail). E.g. in OpenEdge we know that by replacing all EQ keywords to = the code logic and structure will not change. So Metamorphic Testing allows us to apply this change to previously created test cases. Currently we added Metamorphic Testing to Functional and AST tests, so in total every MR is applied to more than a 5,000 files.
You can replace ADE repository files with your own OpenEdge code to run Stability Tests. At the moment, Symbol and AST tests are straightforward to run. Compilation testing requires additional setup and depends on your build environment.
- Set up the development environment (It is simple, see instruction here).
- Checkout or copy your code into
resources/adedirectory. - Clear
resources/stabilityTests/_symbol_failures.txtandresources/stabilityTests/_ast_failures.txtexclude files as they contain code files for ADE repository. - Run
Symbol TestsandAST Testsscripts - After completion, any detected failures will be written to
resources/stabilityTests/_ast_failures.txtandresources/stabilityTests/_ast_failures.txtrespectively.
This process can be used in two main ways:
- Regression and Stability Monitoring. Detect newly introduced issues or confirm previously failing cases have been resolved.
- Issue Discovery and Analysis. While Stability Tests won’t catch every formatting issue, failures are almost always true positives. Inspecting failing files typically reveals genuine formatter problems.