Skip to content

Commit 1833634

Browse files
authored
Merge pull request #181090 from MicrosoftDocs/master
11/25/2021 PM Publish
2 parents 4298f71 + ca86244 commit 1833634

File tree

1 file changed

+83
-2
lines changed

1 file changed

+83
-2
lines changed

articles/stream-analytics/cicd-tools.md

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ azure-streamanalytics-cicd addtestcase -project "/Users/roger/projects/samplejob
136136

137137
If the test configuration file is empty, the following content is written into the file. Otherwise, a test case is added into the array of **TestCases**. Necessary input configurations are automatically filled according to the input configuration files, if they exist. Otherwise, default values are configured. **FilePath** of each input and expected output must be specified before running the test. You can modify the configuration manually.
138138

139-
If you want the test validation to ignore a certain output, set the **Required** field of that expected output to **false**.
140-
141139
```json
142140
{
143141
"Script": "",
@@ -165,6 +163,78 @@ If you want the test validation to ignore a certain output, set the **Required**
165163
}
166164
```
167165

166+
The following example shows two test cases, on a query using two inputs. If you want the test validation to ignore a certain output, set the **Required** field of that expected output to **false**. In this case, the FilePath property must not be empty, but doesn't need to be valid.
167+
168+
```JSON
169+
{
170+
"Script": "C:\\...\\...\\samplejob.asaql",
171+
"TestCases": [
172+
{
173+
"Name": "Case 1 - Testing all outputs at once",
174+
"Inputs": [
175+
{
176+
"InputAlias": "entry",
177+
"Type": "Data Stream",
178+
"Format": "Json",
179+
"FilePath": "C:\\...\\...\\Case1_Data_entry.json",
180+
"ScriptType": "InputMock"
181+
},
182+
{
183+
"InputAlias": "exit",
184+
"Type": "Data Stream",
185+
"Format": "Json",
186+
"FilePath": "C:\\...\\...\\Case1_Data_exit.json",
187+
"ScriptType": "InputMock"
188+
}
189+
],
190+
"ExpectedOutputs": [
191+
{
192+
"OutputAlias": "output1",
193+
"FilePath": "C:\\...\\...\\Case1_output1.json",
194+
"Required": true
195+
},
196+
{
197+
"OutputAlias": "output2",
198+
"FilePath": "C:\\...\\...\\Case1_output2.json",
199+
"Required": true
200+
}
201+
]
202+
},
203+
{
204+
"Name": "Case 2 - Testing only one output at a time (recommended)",
205+
"Inputs": [
206+
{
207+
"InputAlias": "entry",
208+
"Type": "Data Stream",
209+
"Format": "Json",
210+
"FilePath": "C:\\...\\...\\Case2_Data_entry.json",
211+
"ScriptType": "InputMock"
212+
},
213+
{
214+
"InputAlias": "exit",
215+
"Type": "Data Stream",
216+
"Format": "Json",
217+
"FilePath": "C:\\...\\...\Case2_Data_exit.json",
218+
"ScriptType": "InputMock"
219+
}
220+
],
221+
"ExpectedOutputs": [
222+
{
223+
"OutputAlias": "output1",
224+
"FilePath": "C:\\...\\...\\Case2_output1.json",
225+
"Required": true
226+
},
227+
{
228+
"OutputAlias": "output2",
229+
"FilePath": "[N/A]",
230+
"Required": false
231+
}
232+
]
233+
}
234+
]
235+
}
236+
```
237+
168238
> [!NOTE]
169239
> Currently, the only allowed value for the `ScriptType` element is `InputMock`, which is also the default value. If you set it to any other value, it's ignored and the default value (`InputMock`) is used.
170240
@@ -183,6 +253,17 @@ azure-streamanalytics-cicd test -project <projectFullPath> [-testConfigPath <tes
183253
| `-outputPath` | The path of the test result output folder. If it is not specified, the output result files will be placed in the current directory. |
184254
| `-customCodeZipFilePath` | The path of the zip file for custom code such as a UDF or deserializer, if they are used. |
185255

256+
As an example, in a PowerShell enabled terminal, if all test assets are located in a `test` subfolder of the project folder. With each test run output stored in a new timestamped subfolder of a `testResults` subfolder:
257+
258+
```PowerShell
259+
$projectPath = "C:\...\...\samplejob\"
260+
261+
azure-streamanalytics-cicd test `
262+
-project ($projectPath + "asaproj.json") `
263+
-testConfigPath ($projectPath + "test\testConfig.json") `
264+
-outputPath ($projectPath + "test\testResults\$(Get-Date -Format "yyyyMMddHHmmss")\")
265+
```
266+
186267
When all tests are finished, a summary of the test results in JSON format is generated in the output folder. The summary file is named **testResultSummary.json**.
187268

188269
```json

0 commit comments

Comments
 (0)