Tests
JavaScript applications can be tested with tests written in JavaScript.
The JavaScript test files must be located in the project folder src/test/js
.
All JavaScript files (*.js
) found in this folder, at any level, are considered as test files.
In order to setup JavaScript tests for your application, follow these steps:
create an Add-On Library project or a Standalone Application project
define the following configuration in the build file of the project:
add the MicroEJ JavaScript dependency in the build file of the project:
define the platform to use to run the tests with one of the options described in Select a VEE Port section
create a file
assert.js
in the foldersrc/test/resources
with the following content:
This method assert
will be available in all tests to do assertions.
create a file
test.js
in the foldersrc/test/js
and write your first test:
build the application in the SDK or in command line with the MMM CLI
The execution of the tests produces a report available in the folder target~/test/html
for the project.