| title | All files test cases for Azure Resource Manager test toolkit |
|---|---|
| description | Describes the tests that are run for all files by the Azure Resource Manager template test toolkit. |
| ms.topic | how-to |
| ms.custom | devx-track-arm-template |
| ms.date | 07/23/2025 |
This article describes the tests that are run with the template test toolkit for all JavaScript Object Notation (JSON) files. The examples include the test names and code samples that pass or fail the tests. For more information about how to run tests or how to run a specific test, see Test parameters.
Test name: JSONFiles Should Be Valid
This test checks that all JSON files contain valid syntax. For example, azuredeploy.json, azuredeploy.parameters.json, or createUiDefinition.json files. If the test fails, you'll see failures or warnings for other tests, or JSON parsing.
The following example fails because in azuredeploy.json the leading curly brace ({) is missing from parameters, comboBox, and location.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"comboBox": {
"type": "string"
},
"location": {
"type": "string"
}
},
"resources": [],
"outputs": {
"comboBox": {
"type": "string",
"value": "[parameters('comboBox')]"
},
"location": {
"type": "string",
"value": "[parameters('location')]"
}
}
}The following example passes.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"comboBox": {
"type": "string"
},
"location": {
"type": "string"
}
},
"resources": [],
"outputs": {
"comboBox": {
"type": "string",
"value": "[parameters('comboBox')]"
},
"location": {
"type": "string",
"value": "[parameters('location')]"
}
}
}The following example fails because azuredeploy.parameters.json uses a parameter without a value.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"value":
}
}
}The following example passes.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"value": "westus"
}
}
}The following example fails because in createUiDefinition.json the leading curly brace ({) is missing from the outputs section.
{
"$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#",
"handler": "Microsoft.Azure.CreateUIDef",
"version": "0.1.2-preview",
"parameters": {
"basics": [
{
"name": "comboBox",
"type": "Microsoft.Common.DropDown",
"label": "Example drop down",
"toolTip": "This is a tool tip"
}
],
"steps": [],
"outputs":
"comboBox": "[basics('comboBox')]",
"location": "[location()]"
}
}
}The following example passes.
{
"$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#",
"handler": "Microsoft.Azure.CreateUIDef",
"version": "0.1.2-preview",
"parameters": {
"basics": [
{
"name": "comboBox",
"type": "Microsoft.Common.DropDown",
"label": "Example drop down",
"toolTip": "This is a tool tip"
}
],
"steps": [],
"outputs": {
"comboBox": "[basics('comboBox')]",
"location": "[location()]"
}
}
}- To learn about the test toolkit, see Use ARM template test toolkit.
- For ARM template tests, see Test cases for ARM templates
- To test parameter files, see Test cases for parameter files.
- For createUiDefinition tests, see Test cases for createUiDefinition.json