Fixture Monkey


Designed by
SeongIn Hong
"Write once, Test anywhere"
Fixture Monkey is a Java & Kotlin library designed to generate controllable arbitrary test objects.
Its most distinctive feature is the ability to freely access and configure any nested fields through path-based expressions.
It focuses on simplifying test writing by facilitating the generation of necessary test fixtures.
Make your JVM tests more concise and safe with Fixture Monkey.
Table of Contents
Use with AI Agents
Fixture Monkey ships a Claude Code plugin that teaches the agent to write tests the way the library intends: enumerate the cases a method can produce, keep the ones worth testing, and pin only the properties that force the expected outcome — leaving everything else random, so the test stays out of unrelated diffs.
Install it with one line — paste it into Claude Code, or run it in a terminal:
claude plugin marketplace add naver/fixture-monkey --sparse .claude-plugin claude-plugins && claude plugin install fixture-monkey@fixture-monkey
Then just ask for tests — write tests for OrderService.calculate — and the skill activates on its own. /fixture-monkey:write-fixture invokes it explicitly.
The plugin only teaches the agent. Add the library itself to your build from Quick Start below.
Notes
--sparse limits the checkout to the plugin directories instead of cloning the whole library.
- The
naver/fixture-monkey shorthand clones over SSH by default. If Git SSH is not set up, prefix the command with CLAUDE_CODE_PLUGIN_PREFER_HTTPS=1.
Using a different agent? The rules are published as plain documentation, so any tool can read them. Point your Cursor rule, AGENTS.md, or Copilot instructions file at:
https://naver.github.io/fixture-monkey/docs/agent-guide/writing-tests
https://naver.github.io/fixture-monkey/docs/agent-guide/api-reference
See the AI Agents guide for the full procedure and the condensed Java/Kotlin API reference.
Quick Start
Add Fixture Monkey to your project:
Gradle
// Java
testImplementation("com.navercorp.fixturemonkey:fixture-monkey-starter:1.2.4")
// Kotlin
testImplementation("com.navercorp.fixturemonkey:fixture-monkey-starter-kotlin:1.2.4")
Maven
<!-- Java -->
<dependency>
<groupId>com.navercorp.fixturemonkey</groupId>
<artifactId>fixture-monkey-starter</artifactId>
<version>1.2.4</version>
<scope>test</scope>
</dependency>
<!-- Kotlin -->
<dependency>
<groupId>com.navercorp.fixturemonkey</groupId>
<artifactId>fixture-monkey-starter-kotlin</artifactId>
<version>1.2.4</version>
<scope>test</scope>
</dependency>
Create your first test object:
// Java
FixtureMonkey fixtureMonkey = FixtureMonkey.create();
Product product = fixtureMonkey.giveMeOne(Product.class);
// Kotlin
val fixtureMonkey = FixtureMonkey.create()
val product = fixtureMonkey.giveMeOne<Product>()
Java Example
@Test
void sampleOrder() {
FixtureMonkey sut = FixtureMonkey.builder()
.objectIntrospector(ConstructorPropertiesArbitraryIntrospector.INSTANCE)
.build();
Order actual = sut.giveMeBuilder(Order.class)
.set(javaGetter(Order::getOrderNo), "1")
.set(javaGetter(Order::getProductName), "Line Sally")
.minSize(javaGetter(Order::getItems), 1)
.sample();
then(actual.getOrderNo()).isEqualTo("1");
then(actual.getProductName()).isEqualTo("Line Sally");
then(actual.getItems()).hasSizeGreaterThanOrEqualTo(1);
}
Kotlin Example
@Test
fun sampleOrder() {
val sut = FixtureMonkey.builder()
.plugin(KotlinPlugin())
.build()