<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/running-unit-tests-when-deploying-asp-net-to-windows-azure-web-sites-ivsgwppkr" -->

---
title: Running unit tests when deploying ASP.NET to Windows...
description: A walkthrough shows how to customize the Kudu deployment process used by Windows Azure Web Sites so that unit tests run automatically before an ASP.NET...
canonical: https://daily.dev/posts/running-unit-tests-when-deploying-asp-net-to-windows-azure-web-sites-ivsgwppkr
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Running unit tests when deploying ASP.NET to Windows Azure Web Sites | daily.dev
og:description: A walkthrough shows how to customize the Kudu deployment process used by Windows Azure Web Sites so that unit tests run automatically before an ASP.NET...
og:url: https://daily.dev/posts/running-unit-tests-when-deploying-asp-net-to-windows-azure-web-sites-ivsgwppkr
og:image: https://api.daily.dev/og/posts/iVSgwPpKR.png
og:image:alt: Running unit tests when deploying ASP.NET to Windows Azure Web Sites
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Running unit tests when deploying ASP.NET to Windows Azure Web Sites

**[Maarten Balliauw](https://daily.dev/sources/maartenballiauw)** · 5 min read · 0 upvotes · 0 comments

## Summary

A walkthrough shows how to customize the Kudu deployment process used by Windows Azure Web Sites so that unit tests run automatically before an ASP.NET application is deployed. It covers adding a .deployment file, generating a deployment script with azure-cli, and inserting steps to download and run the Gallio test runner against a test assembly, aborting deployment if tests fail.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.maartenballiauw.be/posts/2013-03-26-running-unit-tests-when-deploying-aspnet-to-windows-azure-web-sites>

## Questions this post answers

### How can I make Azure Web Sites deployment fail if my unit tests fail?

Customize the Kudu deployment script generated by azure-cli to run a test runner before the kudusync step, checking the error level afterward. Download and invoke the Gallio.Echo.exe test runner against your test assembly DLL, then add IF !ERRORLEVEL! NEQ 0 goto error so a failing test aborts deployment before files are synced to wwwroot.

_daily.dev surfaces practical deployment scripting tips like this for developers automating ASP.NET pipelines._

### How do I customize the build and deployment process for Windows Azure Web Sites when pushing code with Git?

Add a .deployment file to the repository root containing a command directive, such as command = build.bat, pointing to a batch, PHP, or bash script that Azure Web Sites executes on deployment. The azure-cli tool can auto-generate this file along with a Kudu-based deployment script using the command azure site deploymentscript --aspWAP followed by the project path.

_Developers customizing Azure deployment workflows can track scripting techniques like this on daily.dev._

## Similar posts on daily.dev

- [Security Tests That Prove Themselves — Daily DevOps & .NET](https://daily.dev/posts/security-tests-that-prove-themselves-daily-devops-net-4mutnqllj) · We Are .NET · 1 upvotes · 0 comments
- [Blazor CI/CD with GitHub Actions: Automate Deployment to Azure Static Web Apps](https://daily.dev/posts/blazor-ci-cd-with-github-actions-automate-deployment-to-azure-static-web-apps-ntr3h4pau) · Syncfusion · 0 upvotes · 0 comments
- [5 Architecture Tests You Should Add to Your .NET Projects](https://daily.dev/posts/5-architecture-tests-you-should-add-to-your-net-projects-srtuu4tjc) · Milan Jovanović · 20 upvotes · 0 comments
- [Testing ASP.NET Core Web API: WebApplicationFactory and Integration Tests](https://daily.dev/posts/testing-asp-net-core-web-api-webapplicationfactory-and-integration-tests-8chotq6j5) · We Are .NET · 1 upvotes · 0 comments
- [.NET Aspire 6: Deployment Using Azure Container Apps](https://daily.dev/posts/net-aspire-6-deployment-using-azure-container-apps-ajnipjxrw) · Telerik · 0 upvotes · 0 comments

---

Tags: [#aspnet](https://daily.dev/tags/aspnet), [#azure](https://daily.dev/tags/azure), [#cicd](https://daily.dev/tags/cicd), [#testing](https://daily.dev/tags/testing)

[View this post on daily.dev](https://daily.dev/posts/running-unit-tests-when-deploying-asp-net-to-windows-azure-web-sites-ivsgwppkr)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Running unit tests when deploying ASP.NET to Windows Azure Web Sites","url":"https://daily.dev/posts/running-unit-tests-when-deploying-asp-net-to-windows-azure-web-sites-ivsgwppkr","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/running-unit-tests-when-deploying-asp-net-to-windows-azure-web-sites-ivsgwppkr"},"datePublished":"2026-10-04T13:04:56.652Z","dateModified":"2026-10-15T02:22:32.945Z","description":"A walkthrough shows how to customize the Kudu deployment process used by Windows Azure Web Sites so that unit tests run automatically before an ASP.NET...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/0af8fafde88abb8e8e565ff4e8398d46?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/0af8fafde88abb8e8e565ff4e8398d46?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Maarten Balliauw","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Maarten Balliauw","logo":"https://media.daily.dev/image/upload/s--rOTg3VYO--/f_auto,q_auto/v1791119043/logos/maartenballiauw?_a=BAMAMicg0","url":"https://daily.dev/sources/maartenballiauw"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/running-unit-tests-when-deploying-asp-net-to-windows-azure-web-sites-ivsgwppkr","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"aspnet,azure,cicd,testing","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Maarten Balliauw","item":"https://daily.dev/sources/maartenballiauw"},{"@type":"ListItem","position":3,"name":"Running unit tests when deploying ASP.NET to Windows Azure Web Sites"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/running-unit-tests-when-deploying-asp-net-to-windows-azure-web-sites-ivsgwppkr#faq","mainEntity":[{"@type":"Question","name":"How can I make Azure Web Sites deployment fail if my unit tests fail?","acceptedAnswer":{"@type":"Answer","text":"Customize the Kudu deployment script generated by azure-cli to run a test runner before the kudusync step, checking the error level afterward. Download and invoke the Gallio.Echo.exe test runner against your test assembly DLL, then add IF !ERRORLEVEL! NEQ 0 goto error so a failing test aborts deployment before files are synced to wwwroot. daily.dev surfaces practical deployment scripting tips like this for developers automating ASP.NET pipelines."}},{"@type":"Question","name":"How do I customize the build and deployment process for Windows Azure Web Sites when pushing code with Git?","acceptedAnswer":{"@type":"Answer","text":"Add a .deployment file to the repository root containing a command directive, such as command = build.bat, pointing to a batch, PHP, or bash script that Azure Web Sites executes on deployment. The azure-cli tool can auto-generate this file along with a Kudu-based deployment script using the command azure site deploymentscript --aspWAP followed by the project path. Developers customizing Azure deployment workflows can track scripting techniques like this on daily.dev."}}]}
```

