The nmos-server-api-tests project provides automated tests for the Query-, Node- and Registration-APIs of any given NMOS-server implementation.
This Node.js-project is written in Typescript. It uses the Mocha Javascript test framework and the Chai Assertion Library. The chai-http-plugin is used to extend Chai Assertion Library with tests for http-APIs. The chai-json-schema-plugin is used to validate API-responses against JSON schema.
Up to now the project tests NMOS v1.0 specification. The API-raml-files and the schemas were copied into this project from AMWA-TV/nmos-discovery-registration. It is planned to use the git submodule mechanism in the future to avoid the copies and get the files directly from the AMWA-TV/nmos-discovery-registration-github repository.
- Install Node.js for your platform
- Get the sources into a directory of your choice
git clone https://github.com/Lawo/nmos-server-api-tests.git
- Change to the directory chosen for the sources and type
npm install
- If not running already, start the NMOS-server to be tested.
Now everything is ready to run the tests.
There are two test-scripts available: test
and test-xunit
.
The test results will be displayed in the console.
npm run test --host=192.168.1.76 --node_port=12345 --query_port=8870 --registration_port=8235
The test results will be written into the file test-reports.xml in xUnit-format. This comes in handy when integrating the tests into a CI-System.
npm run test-xunit --host=192.168.1.76 --node_port=12345 --query_port=8870 --registration_port=8235
Host and ports may be specified from the command line when running the tests.
The ip-address of the NMOS-server to be tested.
--host=192.168.1.76
If no host is specified the default value localhost is used.
For each of the Node-, Query- and Registration-API a separate port may be specified.
--node_port=12345 --query_port=8870 --registration_port=8235
If no port is specified the default value 15631 is used.
For users of Visual Studio Code everything is prepared to debug the tests.
- Open project in Visual Studio Code
- Install workspace recommended extensions. Hit
F1
, typework
and select Extensions: Show Workspace Recommended Extensions - Specify Host and Port in the file .vscode/launch.env
- Run build task. Hit
Ctrl
,Shift
andB
- Set breakpoints in any ts-files using
F9
. - Debug the tests. Hit
F5
to start.