Posts

Showing posts with the label testing

Evals need to be end-2-end

Image
Evals need to be E2E If you build AI agents, sub-agents, and agent skills. You know you need evals; that can be tricky. If you run agents inside your organization in our internal systems and services, it's pretty simple to collect evals. IF others and external companies run your skills/agents, then the story is a bit different, as you might not have control of the whole execution context. Its All under the testing umbrella There are 3 things that have a very close proximity: tests, observability and now evals. Testing includes classical pre-production and post-production tests, like unit tests, end-to-end tests, integration tests, chaos testing, stress testing, property-based testing, fuzzy testing, CSS testing, contract testing, and more. These can be done before production and in lower environWhich can be done before production and lower environments or in production. Production testing also encompasses things like canary and observability, which are forms things like canary and...

You can't fix code review with code review

Image
Engineers never liked doing code reviews. Especially if there were lots of files, you got fewer reviews. That was so 2023. Today, in 2026, AI Coding agents generate most of the code, and the code review problem is much worse than it ever was. Paddo captures very well the disaster that is Amazon Kiro and Spect Driven Development. Everybody believe that code review is a bottleneck; let's be honest with the anti-pattern of vibe-coding, and when speed beats safety, bad things happen. Many companies are seeing twice as many incidents, including Microsoft GitHub and many others. Safety needs to come first and speed next, not the other way around. Industrial logic got that decades ago with Modern Agile . Modern agile was a second take on the agile movement with the addition of modern concepts. That is not new; in fact, Modern Agile was created back in 2016. One of the principles was "Make safety a prerequisite".  More AI: Means more things to review Many companies and people b...

State Induction

Image
Imagine you are coaching a basketball team. You want to train your team to be good at 2-point shooting from the inside. Now imagine for some weird reason you can't test that, and you need to play a whole 4 quarters basketball game in order to be able to maybe, with a lot of luck, score 2 points. That would suck, right? This actually sounds insane because we all know we can skip the whole game and just train 2 points from inside right? Well, what IF I told you the basketball game is often a people test software, and they cannot train exact scenarios (State Induction), and they actually need to test the whole thing (expensive E2E testing). What if we could write tests in a very different way, so that it would allow us to have massive parallelism, and perhaps multiple people could test the same thing at the same time, and it would work.

Environments and People

Image
IF you talk with engineers, software architects, managers, pretty much everyone, the answer will be the same: they are not happy with shared environments. We can narrow down shared environments to common envs like dev, test, stage, demo, etc Pretty much all non-prod environments suck. That is the reality in our technology industry. I don't think I ever liked any env in any company, so think about this: did you ever see a non-prod env that you liked? Now the answer for this problem is very weird because if you talk to people, what do they say you you? IF we could have one more environment them we would get it right. So my question is, why can't we get it right in the environment that we have in the first place? Why do we need a new one? In fact, we don't need it. 

Testing Mocks

Image
One common mistake engineers make is to test mocks. However, would you know what the right principles are and how to spot good or bad tests according to these principles?  IF you don't have first principles, you are very likely shooting into the dark.  In Brazil, we have this metaphor that if you play chess with a pigeon (I will use a chicken in this post), you will very likely lose because the pigeon does not know what it is doing and probably will be upset with you for whatever you say. People say if you truly know, you know how to explain. Well, I will go further and say IF you truly know you extract first principles and explain with those principles, so your explanation is short, concise, and direct. Otherwise, you are a chicken on a chessboard just doing random things you don't fully understand.

Testing Queues and Batch Jobs

Image
Testing could be considered a solved problem. Everybody knows the importance of testing. Unit testing and integration testing are not rocket science. However, it is still not uncommon to see a lack of testing, poor coverage, and flaky tests in the industry. Internal service implementation can be tested using fakes and mocks. Testing classes is a simple task if you have a good design. Refactoring a legacy system to have a better design makes it easier to test and could be more entangled, but it is still possible and desired. However, sometimes you have a good design, which is still hard to test. Some architectures can be more complex to test naturally. If we consider standard RPC services, it's pretty vanilla to test them. However, things get more messy when we consider integration tests or end-to-end testing, mainly because of dependencies and state. From the test point of view, RPC services are simple. You have a request, very likely a rest call, and you have some assumptions; you...

Scala TestContainers

Image
TestContainers is a great project for integration tests, mocking, and even for Chaos Engineering. Scala TestContainers is the library in the form of idiomatic-scala with some sugar to make it even easier to use it. I want to show you guys how we can use Scala Test Containers in an SBT 1.5.0 Project using Scala Spec in order to test as MySQL docker container. So let's get started!

Chaos Engineering with ToxiProxy

Image
Chaos Engineering is an important discipline of modern cloud-based services. Failure will happen no matter what and it's improved to prove your infrastructure, code, and configurations are reliable and can resist failure and proper recovery. The only way to know is to either by the worst way possible i.e error 3AM on Sunday night or you can test it and sleep better at night :-).  ToxiProxy from Shopify is a pretty useful and interesting solution. It's a proxy that allows us to introduce all sorts of network chaos in our applications such as latency, hang, timeout, and much more. ToxiProxy is written in Go and you can run the server in a self-contained executable like all Go good stuff. ToxiProxy has multiple clients in multiple languages. I will demonstrate some chaos with Redis using the Lettuce driver in Java and ToxiProxy java client library.

My 2 Cents on "On the Diverse And Fantastical Shapes of Testing"

Image
I want to share my cents about the post: " On the Diverse And Fantastical Shapes of Testing ". First of all, I believe this is a very interesting subject and yet still see very few engineers talking about it. People mostly take tests for granted. Secondly, I would like to acknowledge the parts I agree with on this post mainly around the concept of Sociable and Solitary Unit Tests are quite useful and show be widespread. Also with the need for teams to have reliable, fast, Bounded(Isolated) and not Flacky on Justin tweet . Now that I acknowledge that, let me elaborate on what I think we are missing and why IMHO the pyramid is dated and we need a mentality shift. I have 4 points I want to elaborate on and give more context.

Testing AWS Lambdas with Java

Image
AWS Lambda is an awesome Serverless implementation. Lambdas are a bit tricky because they are ephemeral and short-lived so either they call another lambda or they will mutate some external state. Either an external data store like RDS, Aurora, S3, Kineses, Elasticache or they will call another microservices that does state mutation. In order to properly test Lambdas, we need to design for testability, the easier thing to do is always create more lambdas because you can check the input and output. So lambdas are not pure functions(functional programming) they often need to have side effects. So AWS has this library that makes it easier to test lambdas for Unit Testing / Mocking but also for localized Phased Integration Tests. You can mock source events like S3 ones, and also mock the context, and just test your lambdas with Junit. So I made a simple POC and video I want to share with you guys. So Let's get started!

Mock Server

Image
Mock Server is an interesting and useful testing solution. Mock Server allows HTTP and HTTP Tests and verifications. Mock Server supports Java and NodeJS. Mock Server requires requests to match expectations. It's not that different from a unit test from JUnit. However, Mock Server has the expectations in a central server and you could version those expectations as Json files for instances or use the standard API in order to create the with programmatic code in Java or NodeJS. So today I made a simple POC showing how we can use Mock Server, both with Java and JUNIT in an embedded fashion but also in standalone mode and using the dashboard UI mock server has. So Let's get started!

Synthetic Data Generation and Java Faker

Image
Testing is often hard. Mostly because we need data to perform some forms of testing. For Unit Tests often you can fake your own data pretty easily. However, as we move to Integration Tests, E2E Tests, Big Data Data Science Discovery, Product(PO) Acceptance Testing, PO Discovery we might have a scaling issue. For sure you could build a tactical solution where you hardcoded all domains/data-sets of your company but this approach is highly coupled with systems database and is hard to maintain. So there are the tools and startups on the land of Synthetical Data Generation where they use metadata to understand databases and generate data because of constraints like size, type of data, verifications(CPF for Brazil, SSN for the US). This approach is hard but I believe is the future. Today I want to show something in that direction, but much more simple and maybe a starting point? Which is Java-Faker  which is similar to Faker.js . 

FF4J

Image
FFJ4 is a feature flags/toggles solution built in Java with full support and integration with Spring boot. FF4J is rich in features having: Feature Toggles, Role-Based Toggling, Strategy Based Toggling(White/Black Lists, Time Based, Expressions, even has integration with Drools), AOP-Driven Toggling, Features monitoring, Audit Trail, REST API, +20 Databases support, Properties via Spring, Archaius, commons-config or even consul and more.  FF4J has an interesting UI where we can see the toggles and switch them on or off. So today I made a simple video going through the code and also running the UI. So Let's get started!

Tests with Spring Boot MockMVC

Image
Spring and Spring Boot provide several ways to test our applications/services. Recently I made a post and video about Testing approaches that might be interesting for you. Previously I also made a post and video about TestRestTemplate  and mocks . For this post, I want to focus a bit on the MockMVC capability. MockMVC has a FakeDispatcher servlet(It will feel pretty real) simulating the MVC stack, however, there are no real network connections being made in practice. So MockMVC provides a lightweight way to test controllers as fast as possible. For this post, we will see a simple POC I wrote with a video going to set up a Spring Boot application and also test some scenarios with the MockMVC feature. So Let's Get Started! 

Dealing with Tests Dependencies

Image
Dealing with Tests Dependencies is a way to reduce internal complexity and make services easier to maintain and more resilient to migrations and less expensive over time. Several times fixing tests is more expensive than fixing the real code itself. That could happen for several reasons either by lack of trust between teams or because there is a lack of ways to deal with test dependencies issues. Often people don't pay much attention to tests because either is an engineering or QA problem. However, tests are critical for proper CI/CD and at scale require attention. Overtime complexity and tech debt can charge a high price making all future improvements harder, thats why we need to have ways to deal with this problem in the most effective way possible. So Let's get started! 

Spring Boot 2.x TestRestTemplate

Image
Spring has lots of interesting features to make testing easier. There are many ways we can test our application. Often tests are about confidence but not only that tests are also about having a healthy and clean mindset for maintaining systems. For one reason or another there are migrations that need to happen, either for InfoSec remands or Business wants to have a better set of a new feature for user experience or simply the team wants to make the service right and faster. No matter the reason if you have a healthy set of tests your life will be much easier. The building is easier, maintaining system health requires discipline and tests are a  very important part of it. Today I want to show how easy is for us to write proper and yet lightweight integration tests using Spring Boot 2.x and TestRestTemplate. There is a simple application I wrote and also a video which I will cover the code with more depth. So Let's get started.

Java Mutation Testing with Pitest

Image
Line by Line coverage can be very tricky. Many companies rely on line coverage as metric signals however you can easily have waste with that kind of metric like Getters/Setters, Database Calls, etc. The other issue is that kind of tools can be easily gamed.  The mutation test is not a new idea, it appears in the 70s. The main idea behind mutation testing is to test your Tests. Therefore harden your application solution and tests. The mutation test has the concept of mutators . Mutators are bugs and they should be KILLEd if they SURVIVE it means you have bugs in your code that your tests are not catching. Mutants are much harder to fool unlike line coverage tools. Today I want to share a hands-on Refactoring video I made using Pitest .  So Let's get started.

Property Based Testing with Jqwik

Image
Property-Based Testing in a really nice functional programing way todo testing. Originally created at Haskell with QuickCheck . Today there are frameworks for pretty much all languages.  Jqwik is a property-based testing framework for java.  Property-based Testing is cool because you focus on a predicate / boolean expression and forget about inputs. When I say forget about, thats happen because the property based testing takes care to generate all possible inputs for you and you can save lots of typing, creating uses cases. You still need to work in your property/assertions however you end up writing much less code and cover a much wider range of possible inputs.  Today I want to share a video I made about it, so let's get started.

Code Forensics

Image
Troubleshooting it's a very interesting skill-set. Often engineering teams dont expose this issue. People are always fixing bugs but very little we are talking about bugs(investigations).  Being able to run investigations(Fix bugs) is a must-have skill in a cloud / distributed systems world that we live. I believe troubleshooting is someting much more strong in SRE/DevOps than it is on engineering. I deeply believe we can and we should improve our debugability tools, tricks, and techniques not only because we want to build better user experiences in digital products but also because we want to spot major trends and fix and improve our overall engineering process and products.  Today I have a slidecast for you guys, so let's get started. 

Going Faster with Testing

Image
The traditional management says that quality changes as we increase or decrease scope. That came from the traditional management triangle(Scope, Time, Price and Quality in the middle). This idea is completely wrong. Quality does not make us go slow, actually is the opposite, it makes as goes much faster. There are 2 important questions: A) Why do we need to go Faster? B) What faster means? Companies want to innovate, grow and increase revenue and market share, most of the companies today realized they won't achieve it with current mindsets, skillsets, and technology. So there is a rush for acquisition, companies need to acquire: 1) New Business Capability 2) Talent Density 3) Better ways to build digital products and innovate. However, there is something wrong. So for an unknown reason, we often are stuck in old mindsets like Only Deliver features, Follow Plans, Keep current process and Values. Great but what's the relation from the Business mindset with Testing. Testing is a...