Building an Exception Testing Platform with ChaosBlade and SpringBoot
This article explains the purpose, tool selection, and implementation of an exception testing platform that uses ChaosBlade for fault injection and a SpringBoot wrapper to simplify backend integration and provide a front‑end UI for injecting various system anomalies.
Exception testing, distinct from functional and performance testing, helps uncover issues caused by system exceptions, dependent service failures, or application bugs, thereby improving overall system stability.
In everyday testing, tight schedules and the difficulty of simulating abnormal conditions often lead teams to ignore exception testing, yet unpredictable production problems such as server crashes or third‑party service outages make it indispensable; traditional methods are costly, so building an exception testing platform lowers the entry barrier.
Tool selection : Various tools exist, including tc , netem , and iptables for network faults, jvm‑sandbox for code‑level injection, and the Chao Monkey framework for random production faults. After extensive research, the team adopted ChaosBlade , which offers CPU, disk, memory, network, and JVM fault injection, and provides a server mode that exposes an HTTP API.
Implementation approach : The ChaosBlade service is deployed on target machines, and a SpringBoot service calls it, wrapping the API to simplify usage, store data, and address specific company requirements. A front‑end UI allows users to input parameters and trigger the desired fault injection with minimal effort.
Backend implementation : When encountering un‑compilable library packages, the solution is to download the chaosblade‑exec‑jvm source from GitHub and skip the problematic libraries during compilation.
Front‑end page : The UI includes a CPU‑load scenario where entering an IP address triggers 100% CPU usage on that machine (requiring appropriate permissions). Users can view operation logs, release the fault, and define custom method return values by specifying service name, package, class, method, and JSON‑formatted return data; the injection typically takes about 10 seconds.
Future expectations :
The initial injection time usually exceeds 15 seconds, with front‑end timeouts that can be adjusted for better user experience.
Convert many input fields to dropdown selections to improve efficiency.
Add retry and edit functionalities.
Provide dynamic mock capabilities.
转转QA
In the era of knowledge sharing, discover 转转QA from a new perspective.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.