[jbosscache-dev] Writing parallel-execution-ready test

Manik Surtani manik at jboss.org
Mon Aug 11 06:13:19 EDT 2008


Thanks Dominik, excellent work.  Looking forward to having the 3500+  
test suite execute in 15 mins.  :-)


On 8 Aug 2008, at 20:47, Dominik Pospisil wrote:

> The process of paralellizing JBossCache testsuite is underway and  
> here are
> some guidelines to help write new tests which could be ran using  
> parallel
> TestNG testsuite runner.
>
> 1. Declare the test class as sequential using @Test annotation or
> (preferrably) write the test class thread safe so the test methods  
> could be
> ran simultaneously.
>
> Example of @Test annotation to be used in a non thread-safe test  
> class:
> @Test(groups = {"functional", "transaction", "optimistic"},  
> sequential = true)
>
> 2. In the case the test class needs replicated cache use  
> UnitTestCacheFactory
> class to instantiate the cache. The UnitTestCacheFactory will ensure  
> that the
> cache will use different mcast_addr and mcast_port than other tests  
> running in
> different threads. Also, create the cache configuration before  
> invoking
> createCache factory method and pass the configuration as an argument.
>
> Example:
>
> Configuration c = new Configuration();
> c 
> .setTransactionManagerLookupClass 
> (DummyTransactionManagerLookup.class.getName());
> c.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
> c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
> Cache cache = new UnitTestCacheFactory<Object,  
> Object>().createCache(c,
> false));
>
> 3. At the end of the test (or test method if not sequential), all  
> the cache
> instances must be destroyed. The cleanUp method of the  
> UnitTestCacheFactory
> could be used for this purpose. Note that the method relies on the  
> fact that
> it is executed in the same thread as the thread in which the  
> cache(s) were
> created.
>
> 4. That's it!
>
> Thanks,
>
> - Dominik
>
> _______________________________________________
> jbosscache-dev mailing list
> jbosscache-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jbosscache-dev

--
Manik Surtani
Lead, JBoss Cache
manik at jboss.org







More information about the jbosscache-dev mailing list