Skip to content
YAML Test Fixtures for JPA
Java Groovy
Latest commit 066e83e Nov 14, 2013 @sberan Merge pull request #19 from eskatos/feature/libraries-upgrade
Upgrade all dependencies to the latest version available
Failed to load latest commit information.
fixy-core/src/main/java/fixy Package rename from com.fixy to fixy Nov 12, 2013
fixy-morphia/src Upgrade com.googlecode.morphia 0.104 to org.mongodb.morphia 0.105 Nov 14, 2013
.gitignore convert to gradle Mar 11, 2012
.travis.yml use new travis java support Mar 10, 2012 #13 Allow field access on entities May 12, 2013
build.gradle Upgrade com.googlecode.morphia 0.104 to org.mongodb.morphia 0.105 Nov 14, 2013
fixy.jpg add a piece of flare Dec 23, 2011
settings.gradle convert to gradle Mar 11, 2012

Fixy : Yaml fixtures for Java

Build Status

Winner - 2012 10gen Open Source Hackathon

"Fixy has made my unit-testing life (outside of using Play framework) quite a bit easier" -Fixy User

Fixy makes unit testing your persistence layer much easier using SnakeYAML to create test fixtures and persist them to your database. It's similar to Rails and Play! Framework's test fixtures, with a few goodies added such as package declaration, imports, and processors

Supported Persistence Frameworks:

  • JPA
  • Morphia (MongoDB)

Example (using JPA)


- !package com.innotech

- Employee(bill):
    firstName: Bill
    lastName: Lumbergh

- Employee(peter):
    firstName: Peter
    lastName: Gibbons
    manager: Employee(bill)

Now use your fixtures from Java: (assuming you have a transaction active)

//load fixtures
Fixy fixtures = new JpaFixyBuilder(entityManager).build();

//run query
Employee peter = entityManager.createNamedQuery("developers", Employee.class).getSingleResult();

assertEquals("Gibbons", peter.getLastName());
assertEquals("Lumbergh", peter.getManager().getLastName());


Fixy allows you to import fixtures between files. You can even refer to entities created in other files.


- !package com.innotech

- !import employees.yaml

- Department(development):
        - Employee(peter)
        - Employee(samir)
        - Employee(michael)

Package declarations are scoped to the file, and files are guaranteed to only import one time, regardless of how many times they are declared.


Processors allow you to simulate stored procedures and other logic before your entities get persisted. New entities can be added via the processor as well.


Fixy fixtures = new JpaFixyBuilder(entityManager).build();
fixtures.addProcessor(new Processor<Employee>(Employee.class) {
    public void process(Employee emp) {
        emp.setName(emp.getFirstName() + " " + emp.getLastName());


The Fixy jars are located in My Repository.

If you're using Maven, simply add my Maven repository:


And the Fixy dependency:






  • Sam Beran (@sberan)
  • Chris Collison (@collisonchris)
  • Mohamed Mounirou (@mmounirou)
  • Jens Nehlmeier (@jnehlmeier)

Additional Documentation

See the JPA unit tests for some great usage examples.

Something went wrong with that request. Please try again.