DRAFT
This page summarizes points to consider when adding or revisiting tests for some feature or functionality. Tests should be omitted only if there are certain reasons for not implementing tests of some kind.
There is a plane to have Full API test coverage of Ignite functionality. See:
.The purpose of this ticket is to make sure that all ignite operations should work for any configuration properties combination.
Ignite already has Full API test suites, but currently it's hard to test all configuration combinations.
The framework provides an ability to write a test-case once and run it in multiple Ignite and Cache configurations.
Test class has to extend IgniteConfigVariationsAbstractTest or IgniteCacheConfigVariationsAbstractTest.
TestSuite has to be built using ConfigVariationsTestSuiteBuilder.
As an example see IgniteCacheBasicConfigVariationsFullApiTestSuite
.
Examples:
The following code will test SomeFunctionalityTest
with basic set of IgniteConfiguration
variations (BinaryMarshaller
/ OptimizedMarshaller
and enabled / disabled per class loading), will be used Ignite cluster with 3 nodes, the second started node is client (client with idx=1
), each test-method will be run with testedGrid=0
and testedGrid=1
(see testedGrid()
method) .
TestSuite suite = new ConfigVariationsTestSuiteBuilder( "Basic Ignite Configuration Variations Some Functionality Test Suite", SomeFunctionalityTest.class) .gridsCount(3) .testedNodesCount(2).withClients() .build();
The following code will test SomeFunctionalityTest
with basic set of IgniteConfiguration
variations (see above), will be used Ignite cluster with 5 nodes, the second started node is client (with nodeIdx=1
) and the third started node is client with near-only cache (with nodeIdx=2
), each test-method will be run with testedGrid=0
and testedGrid=1
(see testedGrid()
method) .
TestSuite suite = new ConfigVariationsTestSuiteBuilder( "Basic Cache Configuration Variations Some Cache Functionality Test Suite", SomeCacheFunctionalityTest.class) .withBasicCacheParams() .gridsCount(5).backups(1) .testedNodesCount(3).withClients() .build();
IgniteConfigVariationsAbstractTest has methods key(int i)
and value(int i)
. To run a test scenario in all supported by the framework data modes (Serializable
, Externaliazable
, plane, mixed and etc. objects), it's enough to write test scenario using these methods to generate different keys and values and to place test scenario inside runInAllDataModes(TestRunnable runnable)
method.
For example to test cache's put-get scenario in all supported by the framework data modes you can write the following code:
public void testPutGet() throws Exception { runInAllDataModes(new TestRunnable() { @Override public void run() throws Exception { IgniteCache cache = jcache(); Object key = key(1); Object val = value(1); cache.put(key, val); assertEquals(val, cache.get(key)); } }); }