Brainstorm - nricheton/tdm GitHub Wiki

Goals :

  • 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

Concepts :

  • 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

Data layout :

  • 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>/

Data format

  • 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)

Business case examples

Tests case data:

Data: user
group ADMIN
loginFailed 3
Data (user0): userWithOrders
orderCount 10
Data (user1): userWithOrders
orderCount 0

Unit tests examples

Java

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.

Selenium-testing

http://tdm/create?data=user&group=ADMIN&loginFailed=3

Wiring

Java unit test

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.

Javascript unit test

integration / perf

TODO.

⚠️ **GitHub.com Fallback** ⚠️