Following command will create executable `xs-test` and example programs under ./build directory
```sh
cd path/to/repo
make
```
## Usage
By running the `xs-test` tool, you have to give it a script file path. You can set the optional delay (is seconds) to run tests.
```sh
xs-test script [delay]
```
## Example
There is a example program for demonstrate the test process
run the target exetuable
```sh
./build/greeting
```
run `xs-test` and provide it a script file
```sh
./build/xs-test ./example/greeting.json
```
## How to write script
The script file is a JSON file contains two arrays:
-`mockData`
-`script`
### The `mockData` elements
You can specify which commands/events you want to mock up, and write down the response for commands.
Following is example of mock command, you can set the `param` to match commands come with specific param. Miss `param` will match all.
```json
{
"command":"getPreset",
"param":{
"presetSlot":{
"presetId":"73EBF1A3-B7BC-48AB-A91D-BC3B991AF310"
},
"returnData":{
"withEmbeddedData":true,
"withParam":true
}
},
"response":{
"presetContent":{
"type":"biasFx",
"name":"Monkey Wrench",
"sigPath":[
{
"id":"A667E644-7F1B-4F8C-A939-24C596E4847C",
"dspId":"LIVE.Compressor",
"type":"builtIn",
"active":false,
"param":[
1,
0.4,
0.6,
0.48,
0.6
]
}
],
"embedded":{
}
}
}
}
```
Following is example of mock event listener, an event listener has no expect response, and is necessary if you want to expect the side-effect after run command.
```json
{
"event":"pushPresetSwitched"
}
```
### The `script` elements
You can write which command you want to run and specify the expected results (optional).
Run command with param and have expected response
```json
{
"command":"GUI.GetFx",
"param":{
"uuid":"A667E644-7F1B-4F8C-A939-24C596E4847C"
},
"expect":{
"response":{
"active":false
}
}
}
```
Run command with param and have no expected response
```json
{
"command":"GUI.SetFx",
"param":{
"uuid":"A667E644-7F1B-4F8C-A939-24C596E4847C",
"active":true
}
}
```
Run command with expected commands/events receives (example).