Brainstorm - nricheton/tdm GitHub Wiki
- Same test data for unit testing, integration testing and performance
- Designed for developers, easy for business users
- Business model (no sql, row/column level)
- Data in scm, no database required
- Json format
- Multiple implementations , 1st one : JVM
- Server app for integration/performance tests
- Log data usage on each run. Can be used for reports.
- Design app / wiki integration
- Object Templates : business object definition, which can be parametrized
- Business object type : model and its injector
- No unique/full test dataset. Instead use templates and values to prevent reuse a a single test case regardless of the needs of each single test.
- TestID : data identifier within the test. Can be used to retrieve the technical ID.
- Defaults to object type
- Can be set by the test
- On conflict type0, type1
- File & path based
- Tests lookup for a complete path + object type + name
- UI performs a scan of directories
Folder/Folder/templates/<name>/
Folder/Folder/objects/<name>/
- Object / template data :
- json / yaml ?
- Scripting : Scripting is required for templating complex types or injection a parametrized number of objects.
- js (required for client-side implementations)
Tests case data:
Data: | user |
---|---|
group | ADMIN |
loginFailed | 3 |
Data (user0): | userWithOrders |
---|---|
orderCount | 10 |
Data (user1): | userWithOrders |
---|---|
orderCount | 0 |
public void testBasic(){
TestData dataId = tdm.create( "user",
map( "group", "ADMIN",
"loginFailed",3)
);
User u = UserService.getUser( dataI.id( "user"));
AssertTrue( u.isAdmin);
assertFalse(u.canLogin());
}
public void testWithOrders(){
TestData dataId = tdm.create(
"userWithOrders", map( "orderCount",10),
"userWithOrders", map("orderCount",0)
);
assertTrue ( OrderService.getCommands(dataId.id( "user0")) > 0 );
assertTrue( OrderService.getCommands( dataId.id( "user1")) == 0 );
}
/**
* Run multiple variants
**/
public void testWithOrdersVariants(){
for( TestDataVariant variant : tdm.variants("userWithOrders") ){
// Run this test with all variants of userWithOrders
// Do not combine multiple variants automatically : this would create too many tests
TestData dataId = variant.create(
"userWithOrders", map( "orderCount",10),
"userWithOrders", map("orderCount",0)
);
assertTrue ( OrderService.getCommands(dataId.id( "user0")) > 0 );
assertTrue( OrderService.getCommands( dataId.id( "user1")) == 0 );
}
}
/**
* Run multiple variants with annotations
**/
@Variants( "userWithOrders" )
public void testWithOrdersVariants(){
TestData dataId = variant.create(
"userWithOrders", map( "orderCount",10),
"userWithOrders", map("orderCount",0)
);
assertTrue ( OrderService.getCommands(dataId.id( "user0")) > 0 );
assertTrue( OrderService.getCommands( dataId.id( "user1")) == 0 );
}
map() uses Guava-style map creation.
http://tdm/create?data=user&group=ADMIN&loginFailed=3
Within unit tests, we try not to depend on external components. Wiring is done using ioc (spring,...) or test setups
When integration tests are required, tdm client/server is used.
TODO.