1

I'm using Team Foundation Version Control as a source control for my .NET Core 2.1 project. AzureDevOps is configured in continuous integration to checkout the code and build it. We have 3 environments (Staging, PreProd, Prod). The Staging is not isometric with Prod so it is untrustworthy and we have to execute our integration tests on each environment with environmental data. My build is generated by an agent in AzureDevOps on an OnPremise server which can only reach Prod environment.

I'd like to automate my XUnit integration tests in an AzureDevOps pipeline, however, I don't know where and how to do it. Am I supposed to execute the integration test step after building? or after releasing?

It looks like I need to deploy my binaries first on my environments, then execute the integration tests, and, if they go wrong, rollback the release.

Weird?!?

How can unblock this situation?

Regards,

madhatterx
  • 53
  • 8

2 Answers2

0

If you want to run integration tests you need to first deploy your binaries to environment. You can do it as a separate:

  • step,
  • stage
  • pipeline

after deploying code.

Here it is up to you how you will do it. (To achieve last option you need to use pipeline triggers)

If you follow approach shift left, it means you detect issues as quickly as possible, you should don't worry about breaking them. If it happens on staging I would rather encourage you to fix the issue instead of roll backing code. Especially if it involves data model change.

And on production you can run only smoke tests, which are kind of integration tests which doesn't impact on state. They are like GET in REST - smoke tests should be idempotent, so you can run them without worrying bout changing state.

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
0

Since you use TFVC version, you could define a build pipeline to build and test your code, and then to publish artifacts. You also define a release pipeline to consume and deploy those artifacts to deployment targets.

enter image description here

As you have to execute integration tests on each environment with environmental data, you can run your XUnit integration tests in Release pipeline via VSTest task.

Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39