# Testing Controllers

## Running the Semi-automatic Controller Tests

Launch the Testing Façade. By default the Testing Façade will run on localhost port 5001. This can be altered by adding `TESTING_FACADE_PORT` to your `UserConfig.py` file as described in [Installation](1.0.%20Installation.md).

```shell
python3 nmos-testing-facade.py
```

Launch the NMOS Testing tool in the usual way.

In the NMOS Testing Tool select one of the 'Controller' test suites and configure the IP/Hostname to that of the machine running the Testing Façade (e.g. localhost) and the Port to the Testing Façade's port (use 5001 by default).

Select and launch the tests from the NMOS Testing tool, and follow the instructions displayed on the Testing Façade.

## Secure Controller Testing

Secure testing should typically be done in a unicast DNS-SD environment, by setting DNS_SD_MODE to 'unicast' in UserConfig.py (see [Usage - Testing Unicast Discovery](2.1.%20Usage%20-%20Testing%20Unicast%20Discovery.md)).

Before running the Controller tests in secure mode, add entries to the hosts file of the host running the test suite, and the host running the Controller under test, pointing at the IP address of the host running the test suite.
These entries should correspond to the DNS_DOMAIN and be of the form 'mocks.<DNS_DOMAIN>', which by default should be 'mocks.testsuite.nmos.tv'.

More details on secure testing can be found in the [BCP-003-01 TLS section](2.2.%20Usage%20-%20Testing%20BCP-003-01%20TLS.md).

## Adjusting Testing Façade Timeout

By default, each user action presented on the Testing Façade will timeout if there is no user action after the number of seconds specified by CONTROLLER_TESTING_TIMEOUT in Config.py.
This value can be overridden by adding CONTROLLER_TESTING_TIMEOUT to your UserConfig.py.

To disable the timeout mechanism set the CONTROLLER_TESTING_TIMEOUT value to None.
When the timeout mechanism is disabled the Testing Façade will block indefinitely until there is a user action.

## Known Issues

* The "auto" test selection, although present, doesn't do anything presently as there is no RAML associated with the Controller tests.
* The Mock Registry is currently open to registrations from any NMOS Node. Therefore NMOS Nodes on your network searching for a Registry are likely to register with the Mock Registry.
