Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
F

fixture-monkey

> 编程语言
Open source

Let Fixture Monkey generates fully-customizable, randomly populated instance. Focus on the properties of the class that really matter in your test.

697 stars0 likes1 views
WebsiteGitHub

About

Let Fixture Monkey generates fully-customizable, randomly populated instance. Focus on the properties of the class that really matter in your test.

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
  • Quick Start
  • Why use Fixture Monkey?
  • Real Test Example
  • Requirements
  • Documentation
  • Additional Resources
  • Contributors
  • License

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:

bash
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

groovy
// Java
testImplementation("com.navercorp.fixturemonkey:fixture-monkey-starter:1.2.3")

// Kotlin
testImplementation("com.navercorp.fixturemonkey:fixture-monkey-starter-kotlin:1.2.3")

Maven

xml

    com.navercorp.fixturemonkey
    fixture-monkey-starter
    1.2.3
    test

    com.navercorp.fixturemonkey
    fixture-monkey-starter-kotlin
    1.2.3
    test

Create your first test object:

java
// Java
FixtureMonkey fixtureMonkey = FixtureMonkey.create();
Product product = fixtureMonkey.giveMeOne(Product.class);

// Kotlin
val fixtureMonkey = FixtureMonkey.create()
val product = fixtureMonkey.giveMeOne()

Java Example

…

Kotlin Example

kotlin
@Test
fun sampleOrder() {
    val sut = FixtureMonkey.builder()
            .plugin(KotlinPlugin())
            .build()

    val actual = sut.giveMeBuilder()
            .setExp(Order::orderNo, "1")
            .setExp(Order::productName, "Line Sally")
            .minSizeExp(Order::items, 1)
            .sample()

    then(actual.orderNo).isEqualTo("1")
    then(actual.productName).isEqualTo("Line Sally")
    then(actual.items).hasSizeGreaterThanOrEqualTo(1)
}

Note: Add "lombok.anyConstructor.addConstructorProperties=true" in lombok.config when using Lombok with Fixture Monkey

Why use Fixture Monkey?

1. One-Line Test Object Generation

java
// Before: Manual object creation
Product product = new Product();
product.setId(1L);
product.setName("Test Product");
// ... many more setters

// After: With Fixture Monkey
Product product = fixtureMonkey.giveMeOne(Product.class);

Stop writing boilerplate code for test object creation. Generate any test object with a single line of code.

2. Intuitive Path-Based Configuration

java
// Set all product names to "Special Product" with a single expression
ArbitraryBuilder orderBuilder = fixtureMonkey.giveMeBuilder(Order.class)
    .set("items[*].product.name", "Special Product");

Bid farewell to endless getter/setter chains. Path expressions let you configure any nested field with a single line.

3. Reusable Test Specifications

java
// Define once, reuse everywhere
ArbitraryBuilder productBuilder = fixtureMonkey.giveMeBuilder(Product.class)
    .set("category", "Book")
    .set("price", 1000);

// Reuse in different tests
Product product1 = productBuilder.sample();  
Product product2 = productBuilder.size("reviews", 3).sample();

Eliminate test code duplication by defining specifications once and reusing them across your test suite.

4. Universal Object Generation

java
// Handles inheritance, circular references, and complex structures
Foo foo = FixtureMonkey.create().giveMeOne(Foo.class);  // even with circular references
Bar bar = FixtureMonkey.create().giveMeOne(Bar.class);  // even with inheritance

From simple POJOs to complex object graphs, Fixture Monkey handles all object structures.

5. Dynamic Test Data

java
// Each sample generates unique test data
Product sample1 = fixtureMonkey.giveMeBuilder(Product.class).sample();
Product sample2 = fixtureMonkey.giveMeBuilder(Product.class).sample();
assertThat(sample1).isNotEqualTo(sample2);

Move beyond static test data to discover edge cases that static data might miss.

Real Test Example

java
@Test
void testOrderProcessing() {
    // Given
    Order order = fixtureMonkey.giveMeBuilder(Order.class)
        .set("items[*].quantity", 2)
        .set("items[*].product.price", 1000)
        .sample();
    
    // When
    OrderResult result = new OrderProcessor().process(order);
    
    // Then
    assertThat(result.getTotalAmount()).isEqualTo(4000); // 2 items * 2 quantity * 1000 price
    assertThat(result.getStatus()).isEqualTo(OrderStatus.COMPLETED);
}

Requirements

  • JDK 1.8 or higher
  • Jqwik 1.7.3
  • Kotlin 1.8 or higher (for Kotlin support)
  • kotest-property 5.9.1 (for Kotlin support)

Battle-Tested in Production

Originally developed at Naver, Fixture Monkey has proven its reliability in handling complex business requirements at scale, supporting over 10,000 tests for South Korea's leading mobile payment service.

Documentation

  • English
  • Korean

Additional Resources

FAQ

Third-party Modules

Tools and Plugins

  • FixtureMonkey Helper - IntelliJ plugin for easier Fixture Monkey usage
  • Claude Code plugin - teaches the agent to write scenario-faithful fixtures

Articles

  • fixure monkey로 예외 발생 테스트
  • 테스트 객체를 더쉽게 만들어보자, Fixture-monkey
  • Junit Test with Fixture Monkey
  • Fixture monkey
  • 테스트 데이터도구 - Fixture Monkey
  • Fixture Monkey란?
  • 테스트를 작성할 수 밖에 없는 사람들에게
  • Fixture Monkey 사용해보기
  • Simplify Unit Testing with Fixture Monkey
  • Getting Started Easy Test Fixture Customization with Fixture Monkey
  • [Fixture Monkey] 픽스쳐 몽키로 테스트 코드 작성하기 (Java Spring)
  • TestFixture를 쉽게 생성해 주는 라이브러리가 있다?
  • Fixture Monkey로 테스트 픽스처를 쉽게 생성하고 리팩토링 해보자
  • Fixture Monkey를 적용해보자 w/JPA Test
  • [Fixture Monkey] 불변 객체를 위한 사용자 정의 인트로스펙터 예제 코드

Welcome to write articles about Fixture Monkey! Please make an issue to let us know if you'd like to share your post.

Contributors

  • ah.jo
  • mhyeon-lee
  • acktsap
  • benelog
  • jwChung
  • SooKim1110

Thanks to all contributors

License

Copyright 2021-present NAVER Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javajavakotlinrandom-populated-objecttest

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言