This folder contains all the tests and the relevant test utilities
The test strategy for parsers has been conceived and partially implemented only for the HTML parser. The test framework that is used for the tests is mocha.
readme.md
: the main documentation filenode_modules
: all test utility modules.app
: contains the resources needed for testing purposes. The folder reflects the structure of theapp
folder, so test files are placed in the same hierarchy as the corresponding classes to test.test.js
: the actual test.
The module that is used in order to test the parser is parserTester.js
. You will find the documentation in the file itself, inside JSDoc comments.
Tests definition follow a specific schema, described below.
A test definition can be either:
- a string: in this case the name of the test coincides with the rule to test
- an object: see below
Here is the schema of the object used to defined tests:
name
, mandatory: a string with the name of the test. It is important in order to state where to find the input string and the expected typerule
: the name of the rule to testmultiple
: see the parserTester class for more explanationduration
: the maximum expected duration, if it has to be testeddisplay
: whether the output has to be logged in the consoletoFile
: string. If present, the output will be printed in a file.