Testing Value Patterns

tltr Move away from literals if possible. Divert and generate values. How do we specify the values to be used in tests? The values assigned to the attributes of objects in our test fixture and the expected outcome of our test are frequently interconnected, as defined in the requirements. It is vital to accurately determine these values and understand the relationship between the pre-conditions and post-conditions. This relationship plays a critical role in ensuring the correct behavior is incorporated into the System Under Test (SUT)....

June 30, 2023 · 12 min · 2414 words · dcebotarenco

Fixture Strategy Management

tltr Refactor code from testcase by class to testcase by fixture My opinion based on references: xUnit Test Patterns book by Gerard Meszaros Test Drive Development: By Example by Kent Beck. Growing Object-Oriented Software, Guided by Tests by Steve Freeman, Nat Pryce Object Mother ObjectMother - Easing Test Object Creation in XP The post contains text snippets from books. Testcase Class per what? - Fixture Strategy Management How do we organize our Test Methods onto Testcase Classes?...

June 28, 2023 · 10 min · 2069 words · dcebotarenco

General Fixture

tltr Build Minimal. My opinion based on references: xUnit Test Patterns book by Gerard Meszaros Test Drive Development: By Example by Kent Beck. Growing Object-Oriented Software, Guided by Tests by Steve Freeman, Nat Pryce Object Mother ObjectMother - Easing Test Object Creation in XP The post contains text snippets from books. Let’s define ‘fixture’ The test fixture is everything we need to have to set up in order to exercise the SUT....

June 10, 2023 · 8 min · 1695 words · dcebotarenco

⛅ Hazelcast in minikube

Build a Spring-boot Hazelcast cluster in Kubernetes For local testing purposes, you might want to have a cluster of microservices that use Hazelcast where you can watch the replication, rollout of pods and test some Kubernetes infrastructure-related changes. Prerequisites Docker minikube kubectl helm minikube Dashboard or Lens Goal Deploy a spring-boot hazelcast cluster locally using helm and connect to it via hazelcast management center Isolate the POC in a separate environment and play with the same microservices and Hazelcast upgrades Limitations We cannot push to any cloud image registries like Azure Container Registry, say it’s forbidden by the security policy....

November 9, 2022 · 6 min · 1071 words · dcebotarenco

🪤 Peek & Filter Stream API

🧑‍🎓 tltr 1 1234 Print is executed multiple times till the first value that matches both filter conditions is found. ❓Question 1 2 3 4 5 6 //What is the output? IntStream.range(1, 10) .peek(System.out::print) .filter(i -> i > 2) //A .filter(i -> i > 3) //B .findFirst(); 🕵️‍♂️ Explanation Let’s simplify it 1 IntStream.range(1, 10); This won’t do anything because there is no terminal operation which triggers the reading from the source stream....

August 16, 2022 · 3 min · 606 words · dcebotarenco