Testing with Simulator¶
In the Kelvin SDK there is a kelvin-publisher test tool to help you ingest data to the inputs and debug the outputs to test the performance of your Kelvin SmartApp™.
It is a CLI utility for exercising your application during development. It is not imported into your code and is used only as a standalone testing tool.
Note
You must have installed the kelvin-python-sdk[publisher] library for this feature to work.
The Kelvin SDK simulator publisher tool is designed to allow testers to ingest messages from a random simulator for testing purposes. Here is the command:
| Starting Test Tool | |
|---|---|
Simulator Tool Overview¶
The simulator publisher tool supports a variety of options to customize its behavior. Below is a list of the available options:
| Test Parameters | Required | Description | Note |
|---|---|---|---|
--config TEXT |
optional | Path to the app.yaml |
Default: Current directory |
--random / --counter |
optional | Random values / Incremental values | Default: Random values |
--min FLOAT |
optional | Minimum value | Default: 0 |
--max FLOAT |
optional | Maximum value | Default: 100 |
--period FLOAT |
optional | Publishing period in seconds | Default: 5 |
--asset-count INTEGER |
optional | Number of Assets (test-asset-N) | Default: 1 |
--asset-parameter TEXT |
optional | Sets App Parameter | Can be used multiple times |
Test your SmartApp¶
Info
In order to show how to use the simulator, we will use it with the Event Detection sample app.
-
Run the Simulator Test Tool:
Starting Test Tool and you should see the following output:
Test Tool Output -
Open a NEW terminal window and run the SmartApp:
Note
Use the
config.yamlfile to override default configurations inapp.yamlor inject sensitive information (API keys, credentials, etc.) that should not be embedded in your Kelvin SmartApp™.Click here to read more about this local testing feature.
Running Kelvin SmartApp™ Python Example and you should see the following output:
-
Go to the Simulator Tool terminal and check the logs: