Azure Stream Analytics adds support for unit testing in a CI/CD pipeline
Published Sep 23 2020 07:30 AM 3,185 Views

We are enriching the CI/CD tools to add the support for query unit testing for Azure Stream Analytics! Now you can add and run unit tests for your Stream Analytics jobs on any arbitrary machine or in a CI/CD pipeline.

The unit test cases run on a fully functioned Stream Analytics single node runtime locally. It’s very easy to use the query unit testing feature with the Stream Analytics CI/CD tools. This article will walk through the main steps. Please refer our documentation for more details and for the commands to be used for adding and running a test case.




Add a test case


In any command terminal, run the command 'addtestcase' to add a test case template for your project. If the template already exists, it will add a new test case in the file.


azure-streamanalytics-cicd addtestcase -project <projectFullPath> [-testConfigPath] <testConfigFileFullPath>


Then specify the test case inputs and expected outputs in the generated testconfig.json file.




Run unit tests

Use the following command to run one or multiple test cases for your project. A test report is output to the console. Testing outputs, intermediate results for each case along with a test summary file is generated in the output folder specified by ‘-outputPath’ parameter.


azure-streamanalytics-cicd test -project <projectFullPath> [-testConfigPath <testConfigFileFullPath>] [-outputPath <outputPath>] [-customCodeZipFilePath <zipFilePath>]






  • The feature only takes local static data file as inputs and outputs to a local folder.
  • The feature only supports Windows if your query contains JavaScript User-Defined Functions (UDF) or User-Defined Aggregates (UDA).
  • Time policies (late arrival tolerance, event ordering policies, etc) don’t apply in unit testing.


Setting up a CI/CD pipeline

Check out the step by step guide on how to use the tools in general with any CI/CD systems. You can also learn more about specific instructions for build, test and deployment with Azure Pipelines.


Feedback and engagement


Engage with us and get early glimpses of new features by following us on Twitter at @AzureStreaming.


The Azure Stream Analytics team is highly committed to listening to your feedback and letting the user's voice influence our future investments. We welcome you to join the conversation and make your voice heard via our UserVoice page. For tooling specific feedback you can also contact Stream Analytics tools feedback.




Version history
Last update:
‎Sep 23 2020 07:35 AM
Updated by: