Examples: Unit testing solidity code using both Truffle and Remix IDE Unit Testing Plugin
Tag: testing
Integration Testing: MockServer
The Need to Mock External Resources When designing comprehensive integration tests to run in a test environment, one common blocker is the need to mock the behavior of an external API that is outside the control of your team. Sometimes external vendors do not maintain a working test environment for us to test our code […]
Getting Real-World Test Data from Production
Why? To responsibly test changes before deploying them to production, we need a test environment that behaves, in as many aspects as possible, the same way as our production environment does. Integration tests should be running in an environment that is as close to production as possible. We want the ability to reproduce production issues […]
Suppressing Static Initializers with Mockito + Powermock
Often as developers, we need to add unit testing to legacy code while being unable to make non-trivial changes to the code under test. In legacy code, logging and other resources are often set up in a static initializer. That code won’t execute nicely in a unit testing environment (could be using JNDI or something […]
Testing vs. Alerting Part I
If you want to evaluate a testing plan, you must also consider your alerting plan. Alerting and testing are complimentary, both serve to identify defects. Testing typically serves to identify defects before code is deployed to production, while alerting typically notifies developers of an issue with a running system. You need to consider both testing […]
Mocking Static Singletons in Java (Mockito 3.4+, EasyMock, JMockit)
A common problem for Java developers that wish to get comprehensive unit test coverage is handling the mocking of singletons that are implemented using static method calls. Let’s look at how we can mock singleton behavior using three common Java testing libraries Mockito, EasyMock and JMockit. Part 1: Write Code to Test To start with, […]