- gUnit (created by Leon Su) is a unit testing tool for ANTLR v3 grammars.
- gUnitEditor is a Java Swing GUI for creating, editing and running gUnit test cases.
- ANTLR Tool for parsing grammar files and gUnit test scripts.
- StringTemplate for generating gUnit scripts.
- gUnit for running testcases
- ANTLR-3.1.4 snapshot with gUnitEditor
- to run:
$ java -cp antlr-master-3.1.4-SNAPSHOT-completejar.jar org.antlr.gunit.swingui.Tool
How to use
Creating a testsuite
- Open gUnitEditor and click "Create".
- Select the grammar file (*.g) you want to test.
- All the rules will be load into the list on the left.
- Select a rule and add testcases using the editor on the right.
- The testsuite file (*.gunit) is automatically saved in the same directory of the grammar file.
Modifying a testsuite
- Open gUnitEditor and click "Open".
- Select the testsuite file (*.gunit).
- All the tested and un-tested rules will be load into the list.
- The tested grammar file must be in the same directory of the testsuite file.
Running a testsuite
The class files of the parser and lexer should be in the same directory of the .g and .gunit file.
- Create or open a testsuite
- Click "Run"
- The test result tree will show up in a tab.
- Since double-quotes is reserved in gUnit, if your test case uses
", please use
- gUnitEditor is a GUI for gUnit. Currently, gUnit can only test Java targeted grammars.