Skip to main content
GeorbitTECHNOLOGY & RESEARCH WING
ResearchPublicationsBlogTeamFellowships
Join Research Wing →
ResearchPublicationsBlogTeamFellowships
Join Research Wing →
GeorbitTECHNOLOGY & RESEARCH WING
Open Computer Science, Autonomous Intelligence & Systems Research.

Georbit's primary technology research wing advancing open scientific inquiry across autonomous intelligence, latent precursor modeling, and spatio-temporal informatics. Dedicated to reproducible preprints and open code.

Looking for product-based work? Visit the dedicated Product Division.

Research Navigation
ResearchPublicationsBlogTeamFellowships
Faculty Laboratories
LAB-TAProf. Tanvir AhmadLAB-MAProf. Musheer AhmadLAB-AMProf. Mohammad AmjadLAB-SGSachin Gaur
Open Research & Code
GitHub / georbit-orgPublications & Preprintsresearch@georbit.orgJoin Research Wing / Fellowships →
Georbit Technology & Research Wing · New Delhi & Dehradun · © 2026 · Site content CC BY 4.0 · Code under MIT / Apache-2.0Apply for Research Fellowship →
← Back to Blog
LAB-AMSoftware TestingGenetic Algorithm

Using Genetic Algorithms to Automatically Generate Test Cases — From Research to Practical Software Testing

Manual test case generation is slow, expensive, and systematically biased toward cases the developer already knows about. Genetic algorithms find the cases you didn't think of. Here's how we applied evolutionary search to Java unit testing.

AM

Prof. Mohammad Amjad

Faculty Director, Networks & Software Engineering Lab

1 September 2025

10 min read

Software testing is a fundamentally undecidable problem: there is no algorithm that can tell you whether your test suite is complete. The best we can do is maximise coverage — statement, branch, path — and trust that more coverage correlates with fewer shipped bugs. The question is: how do we generate high-coverage test suites efficiently?

The Genetic Algorithm Approach

Genetic algorithms (GAs) treat test case generation as an optimisation problem. A chromosome encodes a candidate test input; a fitness function evaluates how much new code it exercises; selection, crossover, and mutation evolve the population toward higher-coverage individuals over successive generations.

In our UPCON 2016 paper, we paired the GA with mutation analysis — a technique that deliberately introduces faults (mutants) into the program and measures whether the test suite detects them. This gives us a richer fitness signal than raw coverage: a test case that covers a line scores higher if it also kills a mutant on that line.

Key Design Decisions

  • Chromosome Encoding — We encode method input parameters as typed sequences, with range constraints derived from the method signature and boundary analysis.
  • Fitness Function — A weighted combination of branch coverage (60%), mutation kill rate (30%), and execution cost (10%, penalising slow test cases).
  • Mutation Operators — Arithmetic operator replacement, relational operator replacement, statement deletion, and variable substitution — the five most common real-world fault classes.
  • Termination — The GA runs until 100% branch coverage is achieved or a generation budget (default: 500) is exhausted.

Results on Benchmark Programs

Evaluated on 12 open-source Java utility classes (ranging from 50 to 800 lines), the GA approach achieved a mean branch coverage of 91.4% and a mean mutation kill rate of 83.7%, compared to 71.2% and 61.4% for random test generation. The improvement was most pronounced on programs with complex conditional logic and deeply nested branches.

Extensions We Are Working On

Current active work in the lab extends this framework to web application performance testing (load scenarios) and IoT firmware unit testing, where the execution environment is significantly more constrained than a standard JVM. We are also exploring grammar-based chromosome encodings for programs that accept structured inputs like JSON or XML.

Software TestingGenetic AlgorithmTest Case GenerationMutation AnalysisAutomated Testing

More from the Lab

CORE

How We Built a 14-Layer Safety Intelligence Pipeline to Catch Industrial Incidents Before They Happen

Ayaan Saifi9 min
LAB-MA

Why Chaotic Dynamical Systems Make Better S-Boxes — And Why That Matters for Modern Cryptography

Prof. Musheer Ahmad11 min
CORE

Predicting Disaster Risk Across India Using 11 Years of Climate Data — What We Built, What We Learned

Matrika Regmi8 min
View All Posts →