Simplifying integration testing with .NET and Playwright

In my earlier blog, Integration Testing with Playwright and Testcontainers, I shared how to use a WebApplicationFactory with TestContainers and Playwright to set up integration tests. While this approach works well, I encountered a problem: the setup inadvertently spins up two separate hosts, leading to unwanted behaviour. Nwwz.Mvc.Testing I am introducing NuGet package Nwwz.Mvc.Testing to solve those issue.It’s a simple helper to easily setup a .NET application fro integration testing while allowing a browser to connect to it. ...

28 December 2024 · 3 min · Jos Hendriks

Integration testing with Playwright and Testcontainers in ASP.NET

Testing plays a crucial role in software development and we strive to test as much as possible using isolated unittests. However, there are times when these unittests fail to capture issues that arise when the entire application is tested. Such issues may include discrepancies between front-end and back-end implementation of APIs, or differences in behavior between real and mocked databases. These problems can be easily identified by running a series of scenarios that test the entire application, including the front-end, back-end, and database. Many developers resort to manual testing to achieve this, but automated testing offers greater repeatability and the ability to integrate checks into the development pipeline. ...

13 March 2023 · 7 min · Jos Hendriks

Safer Jenkins pipelines on kubernetes

Jenkins and kubernetes are a great combination. I love the concept of leveraing container technology to provide any build tools that you might require. However in many cases the examples provided are not always the best or most secure. In Section 10.2.2 Building your image of Mannings Microservices in Action the following Jenkins Pipeline script is suggested: def withPod(body) { podTemplate(label: 'pod', serviceAccount: 'jenkins', containers: [ containerTemplate(name: 'docker', image: 'docker', command: 'cat', ttyEnabled: true), containerTemplate(name: 'kubectl', image: 'morganjbruce/kubectl', command: 'cat', ttyEnabled: true) ], volumes: [ hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock'), ] ) { body() } } withPod { node('pod') { def tag = "${env.BRANCH_NAME}.${env.BUILD_NUMBER}" def service = "market-data:${tag}" checkout scm container('docker') { stage('Build') { sh("docker build -t ${service} .") } } container('kubectl') { stage('Deploy') { sh("kubectl --namespace=staging apply -f deploy/staging/") } } } } In this script there are three things that bother me: ...

20 April 2020 · 4 min · Jos Hendriks

Automated Kubernetes installation on Hyper-V

This artice describes how you can create a kubernetes custer using Vagrant, Hyper-V and Packer. Update (11-05-2020) I have updated the scripts to use contianerd in favor of docker. Don’t worry using docker is still possible. In /packer/ubuntu-18.04-amd64.json replace containerd.sh woth docker.sh. Why? I found myself in the need of having a kubernetes test cluster. Instead of using minikube or enabling Kubernetes on Docker Desktop. I thought I could learn from setting up a cluster from scratch. This also allows me to easiliy simulate network failures or have nodes go down. ...

10 April 2020 · 4 min · Jos Hendriks