Testifi takes Apifi to the next level by autogenerating integration tests for all autogenerated GraphQL resolvers. It integrates with Mockeri to combine intelligent data mocking with all integration tests.
The purpose of this library is to provide a rudimentary level of integration testing against APIs created with Apifi. It does so by using the Mockeri library to generate sufficient mock data to perform the necessary testing, and then executing CRUD operations against each resolver in the API schema. The objective is to ensure that the API basically works. Obviously, this tool is no replacement for whichever edge-case testing may be necessary in any given use case. That is up to the developer. However, simple flaws in datamodel design, underlying infrastructure and configuration flaws, etc. are detectable using these autogenerated tests.
- Please aquaint yourself with both Apifi and Mockeri prior to using this library.
- Use this tool with several fine grains of salt ;)
Testifi can be installed using jitpack, as follows:
Testifi is available on maven central:
<dependency>
<groupId>org.sindaryn</groupId>
<artifactId>testifi</artifactId>
<version>0.0.1</version>
</dependency>
- The main class must be annotated either with
@SpringBootApplication
, or@MainClass
. - All entities must have a public
getId()
method.
As previously stated, this library relies on Mockeri for generating data to test against. Therefore, in order to signal to Mockeris' DatabasePopulator
bean to go ahead and populate the database with mock data, the environment varaible DUMMY_POPULATE=true
must be exported, prior to running or debugging the project.
Plug, play & debug.
The getAsEmbeddedCollection
test can be unreliable when evaluating self referencing many to many relationships.
Apache 2.0