

- TEAMCITY TUTORIAL HOW TO
- TEAMCITY TUTORIAL DRIVER
- TEAMCITY TUTORIAL LICENSE
- TEAMCITY TUTORIAL SERIES
Image: codemazeblog/teamcity-agent-docker-compose:latest So let’s stop TeamCity for a moment again with docker-compose stop and add two more lines to docker-compose.yml in /Integration/TeamCity directory. We need to add two more volumes to make Docker daemon available inside our builds. Part of the problem lies in our TeamCity agent configuration. So let’s make some modifications to our command line build step. Since we want to run a non-default docker compose file, we can use the -f option to specify which file to run.Īfter a while, you should see your integration service starting, and the tests should pass. To run the integration tests we simply need to run: docker-compose -f up
TEAMCITY TUTORIAL HOW TO
We’ve also made the integration service dependant on the accountownerapp service, to make sure the database and application are up and running before we start testing them.įor now, we are going to use the fixed tag for our application image (build-2), but we’ll learn how to change that to depend on the latest TeamCity build. First one being the usage of the pre-built image for our ASP.NET Core app instead of building it, and the second one being the addition of the integration service which will actually be responsible for running the integration workflow defined in Dockerfile.Integration file. This file is pretty similar to the docker-compose.yml we already used to build our project. Image: my-registry:50000/codemazeblog/accountownerapp:test Image: my-registry:50000/codemazeblog/accountownerapp:build-2 _MySQL_Init_Script:/docker-entrypoint-initdb.d Next, we want to create a new and slightly modified docker compose file in the solution root: Learning Web API? Get our eBook ASP.NET Core Web API Best Practices and become an expert for FREE! > GET THE BOOK <<
TEAMCITY TUTORIAL SERIES
If any of these concepts are unfamiliar to you, go back to part 3 of the series where we go into detail on how to configure a Dockerfile. So we use /dotnet/core/sdk:3.1 as a base image to be able to run dotnet test, set the working directory to the Integration folder and made this image executable by setting the entry point to the dotnet test command. So let’s make a helper class TestContext.cs, and extract the initialization logic to that class. Learning Web API? Get our eBook ASP.NET Core Web API Best Practices and become an expert for FREE! > GET THE BOOK Įasy and simple as it is, this way of writing tests is plain wrong.īecause we would need to set up the test server and test client in every test. Important note: If you get an error that states that appsettings.json or nfig while running the test, you can solve it by going to properties of those files and setting the Content property to Copy always or Copy if newer. Then, we simply hit the /api/owner endpoint and assert if the HTTP response status was 200 OK, which it should be if we’ve set up our database correctly. The library helps us create the test server and client. Ok, so here we have the simplest test possible. Var response = await client.GetAsync("/api/owner") Īssert.Equal(HttpStatusCode.OK, response.StatusCode) Learning Web API? Get our eBook ASP.NET Core Web API Best Practices and become an expert for FREE! > GET THE BOOK ()) In our case, we are going to make sure that our app communicates with the database. This is something every production-grade application should have because integration tests ensure that all of your application parts communicate properly. We already have a unit test, but since we are using TeamCity now, this is a great opportunity to introduce integration tests. We are going to add some integration tests to our application. How to Add an Integration Test to the Asp.Net Core Appįirst things first.
TEAMCITY TUTORIAL LICENSE
Select "Accept License Agreement" and click on "Continue" buttonĬreate Teamcity account, after the creation is completed, you can log in to Teamcity, and the installation is complete.Here’s what we are going to learn this time: Initializing the Teamcity server component, after initialization is complete, the following interface appears
TEAMCITY TUTORIAL DRIVER
"Note" Before this step, you need to download the MySQL database JDBC driver jar package, Mysql-connector-java-5.1.21.jar, and copy it to C:\ProgramData\JetBrains\TeamCity\lib\ In the JDBC directoryĬlick "Proceed" to start creating the database I select the database for MySQL database, fill in the MySQL access URL and port number. Wait for the installation, after the decompression is complete, the following screen popupĬonfirm the installation path, after accessing the address, click Save, enter the following interface, prompt success, then the configuration is complete.Ĭreate teamcity system user, set user password.Ĭlick "Proceed" to enter the following page Double-click the Teamcity-9.0.exe fileĬlick "Next" to enter the following screen
