[infinispan-dev] A tip: Using a random word generator to generate uncommon test data
Mircea Markus
mircea.markus at jboss.com
Tue Sep 15 03:26:53 EDT 2009
On Sep 14, 2009, at 12:02 PM, Galder Zamarreno wrote:
>
>
> On 09/12/2009 12:31 AM, Michael Neale wrote:
>> A crazier alternative is to grab the testMethod name and use that as
>> part of the key/string - you can do it by getting the stack trace and
>> a little bit of work (I had a helper method somewhere).
>>
>> Something like:
>> Thread.currentThread().getStackTrace()(1).getMethodName() (at the top
>> of the test method)-- its probably 1 as 0 would be the getStackTrace
>> method itself... I have found it helpful when digging through things
>> and I see a value from a certain test...
That's a good idea but doesn't apply when there's inheritance between
test classes (and ISPN uses inheritance).
Eg.
abstract class Base {
public void testMethod(){}
}
@Test
public class A extends Base{}
@Test
public class B extends Base{}
Now test method will be run twice, and the stack trace won't let you
make the difference between it being run in the context of class A or
of class B.
But yep, in all other scenarios this is a very useful mechanism.
>
> Maybe you could add this debugging method as a static method to
> TestingUtil class?
>
> Btw, I've updated
> http://www.jboss.org/community/wiki/InfinispanQuickStartGuideforDevelopers
> with these two tips.
>
>>
>>
>> On Fri, Sep 11, 2009 at 10:23 PM, Mircea Markus<mircea.markus at jboss.com
>> > wrote:
>>> Another thing that helps is using the thread name. It's true that
>>> there are some threads created within jgroups, and these won't match
>>> but generally it helps.
>>> Before starting a test, a log message is being output - this
>>> contains
>>> the name of the test that is to be executed. Same after the test is
>>> finished. Logs look like:
>>> "Starting test..."
>>> and
>>> "Test Xyz failed"/"Test Xyz skipped"/"Test Xyz succeeded"
>>>
>>> On Sep 11, 2009, at 1:13 PM, Galder Zamarreno wrote:
>>>
>>>> p.s. I'm currently using
>>>> http://watchout4snakes.com/creativitytools/RandomWord/RandomWordPlus.aspx
>>>> as
>>>> random word generator.
>>>>
>>>> On 09/11/2009 12:12 PM, Galder Zamarreno wrote:
>>>>> Guys,
>>>>>
>>>>> Looking at the Infinispan tests, I've seen plenty same keys/values
>>>>> repeated in loads of tests, i.e. k1, k2, v1, v2....etc, so
>>>>> sometimes,
>>>>> when you're debugging a specific tests, particularly when
>>>>> running the
>>>>> whole testsuite, it's hard to pint point the data related to your
>>>>> test
>>>>> since same key/values are used by several tests.
>>>>>
>>>>> So, to try to help with finding the data related to my tests, I'm
>>>>> trying
>>>>> to use random word generator to generate uncommon or obscure words
>>>>> that
>>>>> I can use in the tests. Doing this allows me to quickly find my
>>>>> data in
>>>>> the logs, i.e. "key-isoprene"
>>>>>
>>>>> I don't know whether other people are interesting in using a
>>>>> similar
>>>>> method but at least for me, it helps.
>>>>>
>>>>> Cheers,
>>>>
>>>> --
>>>> Galder Zamarreño
>>>> Sr. Software Engineer
>>>> Infinispan, JBoss Cache
>>>> _______________________________________________
>>>> infinispan-dev mailing list
>>>> infinispan-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>>
>>>
>>> _______________________________________________
>>> infinispan-dev mailing list
>>> infinispan-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>>
>>
>>
>>
>
> --
> Galder Zamarreño
> Sr. Software Engineer
> Infinispan, JBoss Cache
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
More information about the infinispan-dev
mailing list