<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Integration Tests on Daniel Genezini</title><link>https://genezini.com/tags/integration-tests/</link><description>Recent content in Integration Tests on Daniel Genezini</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><copyright>2022 Daniel Genezini All rights reserved</copyright><lastBuildDate>Mon, 31 Jul 2023 20:00:00 -0300</lastBuildDate><atom:link href="https://genezini.com/tags/integration-tests/index.xml" rel="self" type="application/rss+xml"/><item><title>Integration tests with AWS S3 buckets using Localstack and Testcontainers</title><link>https://genezini.com/blog/p/integration-tests-with-aws-s3-buckets-using-localstack-and-testcontainers/</link><pubDate>Mon, 31 Jul 2023 20:00:00 -0300</pubDate><guid>https://genezini.com/blog/p/integration-tests-with-aws-s3-buckets-using-localstack-and-testcontainers/</guid><description>&lt;img src="https://genezini.com/blog/p/integration-tests-with-aws-s3-buckets-using-localstack-and-testcontainers/cover.jpg" alt="Featured image of post Integration tests with AWS S3 buckets using Localstack and Testcontainers" /> As I explained previously in this article, in integration tests, we should mock unmanaged dependencies (dependencies that are external to our system and not controlled by us, like APIs) but test against real managed dependencies (dependencies that are controlled by our system, like databases, queues, etc). This improves the reliability of the integration tests because the communication with these dependencies are a complex part of the system and can break with a package update, a database update or a change in a queue message format.
In this post, I'll show how to use Localstack and Testcontainers to emulate an AWS environment for use in integration tests.</description></item><item><title>How to run scripts on SQL Server container startup</title><link>https://genezini.com/blog/p/how-to-run-scripts-on-sql-server-container-startup/</link><pubDate>Mon, 15 May 2023 06:00:00 -0300</pubDate><guid>https://genezini.com/blog/p/how-to-run-scripts-on-sql-server-container-startup/</guid><description>&lt;img src="https://genezini.com/blog/p/how-to-run-scripts-on-sql-server-container-startup/cover.jpg" alt="Featured image of post How to run scripts on SQL Server container startup" /> Unlike MySQL and PostgreSQL, which execute scripts in the /docker-entrypoint-initdb.d/ directory after initialization, the SQL Server container image doesn't provide a built-in mechanism for running scripts at startup.
In this post, I'll show how to create a custom container image that waits for SQL Server startup and runs a pre-configured script. In addition, I'll show how to use this custom image to run SQL Server in Testcontainers.</description></item><item><title>Why my WireMock mocks aren't working?</title><link>https://genezini.com/blog/p/why-my-wiremock-mocks-arent-working/</link><pubDate>Tue, 11 Apr 2023 08:00:00 -0300</pubDate><guid>https://genezini.com/blog/p/why-my-wiremock-mocks-arent-working/</guid><description>&lt;img src="https://genezini.com/blog/p/why-my-wiremock-mocks-arent-working/cover.jpg" alt="Featured image of post Why my WireMock mocks aren't working?" /> WireMock.Net is a great tool to remove external dependencies when writing integration tests, but because it is highly configurable, it can be hard to find why its mocks aren't working.
In this post, I'll explain how to troubleshoot problems in its configuration and show some common problems that happen in my day-to-day work.</description></item><item><title>How to run disposable databases for your tests. Improve your integration tests accuracy with Testcontainers</title><link>https://genezini.com/blog/p/how-to-run-disposable-databases-for-your-tests.-improve-your-integration-tests-accuracy-with-testcontainers/</link><pubDate>Mon, 09 Jan 2023 07:00:00 -0300</pubDate><guid>https://genezini.com/blog/p/how-to-run-disposable-databases-for-your-tests.-improve-your-integration-tests-accuracy-with-testcontainers/</guid><description>&lt;img src="https://genezini.com/blog/p/how-to-run-disposable-databases-for-your-tests.-improve-your-integration-tests-accuracy-with-testcontainers/cover.jpg" alt="Featured image of post How to run disposable databases for your tests. Improve your integration tests accuracy with Testcontainers" /> Integration tests are essential to ensure that the different components of our system work together as expected and continue to work after changes.
In this post, I'll explain how to spin up disposable database containers to use in integration tests.</description></item><item><title>Time-out requests in ASP.NET Core with cancellation tokens</title><link>https://genezini.com/blog/p/time-out-requests-in-asp.net-core-with-cancellation-tokens/</link><pubDate>Tue, 20 Dec 2022 06:45:00 -0300</pubDate><guid>https://genezini.com/blog/p/time-out-requests-in-asp.net-core-with-cancellation-tokens/</guid><description>&lt;img src="https://genezini.com/blog/p/time-out-requests-in-asp.net-core-with-cancellation-tokens/cover.jpg" alt="Featured image of post Time-out requests in ASP.NET Core with cancellation tokens" /> When ASP.NET Core is running in an AWS Lambda and receiving requests through an AWS API Gateway, the application is not notified of an API Gateway time-out and keeps processing the request, completing it eventually. This will leave metrics and logs of a successful request when the client received a time-out error.
In this post, I'll show how to solve this problem with cancellation tokens and time-outs.</description></item><item><title>Analyzing and enforcing .NET code coverage with coverlet</title><link>https://genezini.com/blog/p/analyzing-and-enforcing-.net-code-coverage-with-coverlet/</link><pubDate>Thu, 03 Nov 2022 08:10:00 -0300</pubDate><guid>https://genezini.com/blog/p/analyzing-and-enforcing-.net-code-coverage-with-coverlet/</guid><description>&lt;img src="https://genezini.com/blog/p/analyzing-and-enforcing-.net-code-coverage-with-coverlet/cover.png" alt="Featured image of post Analyzing and enforcing .NET code coverage with coverlet" /> Automated software tests are a requirement for ensuring we are delivering a product with quality to our users. It helps in finding bugs and requirements not fulfilled at development time, but also decreases the cost of maintenance by making the future changes to our code safer. Besides, the act of writing testable code alone increases the quality of the code we are writing because testable code has to be decoupled.
In this last post of this series, I'll show how to analyze and enforce a minimum code coverage in our applications, and how to use integration tests to increase our testing surface.</description></item><item><title>Integration tests without API dependencies with ASP.NET Core and WireMock.Net</title><link>https://genezini.com/blog/p/integration-tests-without-api-dependencies-with-asp.net-core-and-wiremock.net/</link><pubDate>Sun, 25 Sep 2022 08:00:00 -0300</pubDate><guid>https://genezini.com/blog/p/integration-tests-without-api-dependencies-with-asp.net-core-and-wiremock.net/</guid><description>&lt;img src="https://genezini.com/blog/p/integration-tests-without-api-dependencies-with-asp.net-core-and-wiremock.net/cover.jpg" alt="Featured image of post Integration tests without API dependencies with ASP.NET Core and WireMock.Net" /> Although there are many definitions about the scope of an integration test, Martin Fowler defines Narrow integration tests, where the integration with other systems are tested using mocks, and Broad integration tests, where they communicate using real APIs.
In this post, I'll explain how to create mocks for HTTP APIs in narrow integration tests using the WireMock.Net library.</description></item></channel></rss>