You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geode.apache.org by Kirk Lund <kl...@apache.org> on 2018/02/05 19:42:59 UTC

Naming unit tests and integration tests

The industry standard names for tests are FooTest and FooIntegrationTest
and I think we should stick to that for UnitTest and IntegrationTest.

The following block is defined in our wiki. I'd like to replace the line
"End with JUnitTest" -- there's no reason to including "JUnit" in the name
of our JUnit tests. Even if we decide to separate test categories in some
way other than the @Category support in Gradle's junit task, the next
preferred alternative should be different src tests (src/test,
src/integrationTest, src/distributedTest). Adding "JUnit" to the name is an
outdated convention tied to our previous Ant build system.

JUnit tests should

. Use Junit 4 Syntax
*. End with JUnitTest*
. Contain an Category annotation of either UnitTest or IntegrationTest.
UnitTests as should complete in milliseconds and test a specific class.

Re: Naming unit tests and integration tests

Posted by John Blum <jb...@pivotal.io>.
+1 to Kirk's last point (and, well, the points before it).

As for bug specific tests, it is common to add a comment of the nature...

class SomeExistingTestClass {

/**
 * ...
 ** @see <a href="http://issues.apache.org/../GEODE-123
<http://issues.apache.org/../GEODE-123>">Bug Title Here</a>*
 */
@Test
public void queryShouldNotIncludeTxSets() {
  ..
}

Also, don't construe JUnit as a "Unit Testing-only" framework just because
of its name.  JUnit is equally applicable to writing Integration Tests,
Smoke Tests, Regression Tests, Acceptance (Functional) Tests or any other
kind of tests.



On Mon, Feb 5, 2018 at 11:55 AM, Bruce Schuchardt <bs...@pivotal.io>
wrote:

> These seem like sensible ideas to me.  I especially don't like tests named
> after bug numbers.  I do like a pointer to relevant tickets in test
> comments/javadocs though.
>
> We also have DUnitTest.  Some designation in the name that it's using the
> dunit infrastructure is often useful to me.  Having to open a file to see
> that it's a DistributedTest vs a regular unit test could make life more
> difficult.  Putting them in their own source tree would help with that.
>
>
>
> On 2/5/18 11:49 AM, Kirk Lund wrote:
>
>> Another valuable naming standard is the use FooRegressionTest for tests
>> that are specific to reproducing a bug and verifying its fix. Don't use
>> Bug007IntegrationTest. Use something description like
>> QueryShouldNotIncludeTXSetsRegressionTest (if you want a separate test
>> class for the bug which is sometimes better -- otherwise just add new
>> tests
>> to existing tests).
>>
>> On Mon, Feb 5, 2018 at 11:42 AM, Kirk Lund <kl...@apache.org> wrote:
>>
>> The industry standard names for tests are FooTest and FooIntegrationTest
>>> and I think we should stick to that for UnitTest and IntegrationTest.
>>>
>>> The following block is defined in our wiki. I'd like to replace the line
>>> "End with JUnitTest" -- there's no reason to including "JUnit" in the
>>> name
>>> of our JUnit tests. Even if we decide to separate test categories in some
>>> way other than the @Category support in Gradle's junit task, the next
>>> preferred alternative should be different src tests (src/test,
>>> src/integrationTest, src/distributedTest). Adding "JUnit" to the name is
>>> an
>>> outdated convention tied to our previous Ant build system.
>>>
>>> JUnit tests should
>>>
>>> . Use Junit 4 Syntax
>>> *. End with JUnitTest*
>>> . Contain an Category annotation of either UnitTest or IntegrationTest.
>>> UnitTests as should complete in milliseconds and test a specific class.
>>>
>>>
>


-- 
-John
john.blum10101 (skype)

Re: Naming unit tests and integration tests

Posted by Kirk Lund <kl...@apache.org>.
I've updated the page
https://cwiki.apache.org/confluence/display/GEODE/Writing+tests -- please
review and provide any feedback you may have.

Sorry to take so long -- I went on PTO immediately after my previous
message and finally got back to this task now.

I'm planning to add in some test examples (see the TBD someone else
previously added to this wiki page) and then I was planning to move on to
updating
https://cwiki.apache.org/confluence/display/GEODE/Distributed-Unit-Tests

Thanks,
Kirk

On Tue, Feb 6, 2018 at 9:24 AM, Kirk Lund <kl...@apache.org> wrote:

> +1 for renaming existing tests to follow the new conventions and
> especially renaming old TRAC bug number tests
>
> I'll update the wiki today and then report back to this thread.
>
> On Mon, Feb 5, 2018 at 1:09 PM, Bruce Schuchardt <bs...@pivotal.io>
> wrote:
>
>> Should we make a pass over all of the tests and rename them to follow the
>> conventions we come up with?  It would take some time, and maybe access to
>> Pivotal's old Trac issue tracker in order to rename files with "Bug" and
>> numbers for a name.
>>
>>
>>
>> On 2/5/18 12:28 PM, Kirk Lund wrote:
>>
>>> I've been using the name FooDistributedTest for new dunit tests. I
>>> should've included that.
>>>
>>> For RegressionTests, I've been including the GEODE jira ticket number and
>>> summary in the javadocs on the test class. I'll include that in any
>>> changes
>>> I make to the wiki.
>>>
>>> On Mon, Feb 5, 2018 at 11:55 AM, Bruce Schuchardt <
>>> bschuchardt@pivotal.io>
>>> wrote:
>>>
>>> These seem like sensible ideas to me.  I especially don't like tests
>>>> named
>>>> after bug numbers.  I do like a pointer to relevant tickets in test
>>>> comments/javadocs though.
>>>>
>>>> We also have DUnitTest.  Some designation in the name that it's using
>>>> the
>>>> dunit infrastructure is often useful to me.  Having to open a file to
>>>> see
>>>> that it's a DistributedTest vs a regular unit test could make life more
>>>> difficult.  Putting them in their own source tree would help with that.
>>>>
>>>>
>>>> On 2/5/18 11:49 AM, Kirk Lund wrote:
>>>>
>>>> Another valuable naming standard is the use FooRegressionTest for tests
>>>>> that are specific to reproducing a bug and verifying its fix. Don't use
>>>>> Bug007IntegrationTest. Use something description like
>>>>> QueryShouldNotIncludeTXSetsRegressionTest (if you want a separate test
>>>>> class for the bug which is sometimes better -- otherwise just add new
>>>>> tests
>>>>> to existing tests).
>>>>>
>>>>> On Mon, Feb 5, 2018 at 11:42 AM, Kirk Lund <kl...@apache.org> wrote:
>>>>>
>>>>> The industry standard names for tests are FooTest and
>>>>> FooIntegrationTest
>>>>>
>>>>>> and I think we should stick to that for UnitTest and IntegrationTest.
>>>>>>
>>>>>> The following block is defined in our wiki. I'd like to replace the
>>>>>> line
>>>>>> "End with JUnitTest" -- there's no reason to including "JUnit" in the
>>>>>> name
>>>>>> of our JUnit tests. Even if we decide to separate test categories in
>>>>>> some
>>>>>> way other than the @Category support in Gradle's junit task, the next
>>>>>> preferred alternative should be different src tests (src/test,
>>>>>> src/integrationTest, src/distributedTest). Adding "JUnit" to the name
>>>>>> is
>>>>>> an
>>>>>> outdated convention tied to our previous Ant build system.
>>>>>>
>>>>>> JUnit tests should
>>>>>>
>>>>>> . Use Junit 4 Syntax
>>>>>> *. End with JUnitTest*
>>>>>> . Contain an Category annotation of either UnitTest or
>>>>>> IntegrationTest.
>>>>>> UnitTests as should complete in milliseconds and test a specific
>>>>>> class.
>>>>>>
>>>>>>
>>>>>>
>>
>

Re: Naming unit tests and integration tests

Posted by Kirk Lund <kl...@apache.org>.
+1 for renaming existing tests to follow the new conventions and especially
renaming old TRAC bug number tests

I'll update the wiki today and then report back to this thread.

On Mon, Feb 5, 2018 at 1:09 PM, Bruce Schuchardt <bs...@pivotal.io>
wrote:

> Should we make a pass over all of the tests and rename them to follow the
> conventions we come up with?  It would take some time, and maybe access to
> Pivotal's old Trac issue tracker in order to rename files with "Bug" and
> numbers for a name.
>
>
>
> On 2/5/18 12:28 PM, Kirk Lund wrote:
>
>> I've been using the name FooDistributedTest for new dunit tests. I
>> should've included that.
>>
>> For RegressionTests, I've been including the GEODE jira ticket number and
>> summary in the javadocs on the test class. I'll include that in any
>> changes
>> I make to the wiki.
>>
>> On Mon, Feb 5, 2018 at 11:55 AM, Bruce Schuchardt <bschuchardt@pivotal.io
>> >
>> wrote:
>>
>> These seem like sensible ideas to me.  I especially don't like tests named
>>> after bug numbers.  I do like a pointer to relevant tickets in test
>>> comments/javadocs though.
>>>
>>> We also have DUnitTest.  Some designation in the name that it's using the
>>> dunit infrastructure is often useful to me.  Having to open a file to see
>>> that it's a DistributedTest vs a regular unit test could make life more
>>> difficult.  Putting them in their own source tree would help with that.
>>>
>>>
>>> On 2/5/18 11:49 AM, Kirk Lund wrote:
>>>
>>> Another valuable naming standard is the use FooRegressionTest for tests
>>>> that are specific to reproducing a bug and verifying its fix. Don't use
>>>> Bug007IntegrationTest. Use something description like
>>>> QueryShouldNotIncludeTXSetsRegressionTest (if you want a separate test
>>>> class for the bug which is sometimes better -- otherwise just add new
>>>> tests
>>>> to existing tests).
>>>>
>>>> On Mon, Feb 5, 2018 at 11:42 AM, Kirk Lund <kl...@apache.org> wrote:
>>>>
>>>> The industry standard names for tests are FooTest and FooIntegrationTest
>>>>
>>>>> and I think we should stick to that for UnitTest and IntegrationTest.
>>>>>
>>>>> The following block is defined in our wiki. I'd like to replace the
>>>>> line
>>>>> "End with JUnitTest" -- there's no reason to including "JUnit" in the
>>>>> name
>>>>> of our JUnit tests. Even if we decide to separate test categories in
>>>>> some
>>>>> way other than the @Category support in Gradle's junit task, the next
>>>>> preferred alternative should be different src tests (src/test,
>>>>> src/integrationTest, src/distributedTest). Adding "JUnit" to the name
>>>>> is
>>>>> an
>>>>> outdated convention tied to our previous Ant build system.
>>>>>
>>>>> JUnit tests should
>>>>>
>>>>> . Use Junit 4 Syntax
>>>>> *. End with JUnitTest*
>>>>> . Contain an Category annotation of either UnitTest or IntegrationTest.
>>>>> UnitTests as should complete in milliseconds and test a specific class.
>>>>>
>>>>>
>>>>>
>

Re: Naming unit tests and integration tests

Posted by Bruce Schuchardt <bs...@pivotal.io>.
Should we make a pass over all of the tests and rename them to follow 
the conventions we come up with?  It would take some time, and maybe 
access to Pivotal's old Trac issue tracker in order to rename files with 
"Bug" and numbers for a name.


On 2/5/18 12:28 PM, Kirk Lund wrote:
> I've been using the name FooDistributedTest for new dunit tests. I
> should've included that.
>
> For RegressionTests, I've been including the GEODE jira ticket number and
> summary in the javadocs on the test class. I'll include that in any changes
> I make to the wiki.
>
> On Mon, Feb 5, 2018 at 11:55 AM, Bruce Schuchardt <bs...@pivotal.io>
> wrote:
>
>> These seem like sensible ideas to me.  I especially don't like tests named
>> after bug numbers.  I do like a pointer to relevant tickets in test
>> comments/javadocs though.
>>
>> We also have DUnitTest.  Some designation in the name that it's using the
>> dunit infrastructure is often useful to me.  Having to open a file to see
>> that it's a DistributedTest vs a regular unit test could make life more
>> difficult.  Putting them in their own source tree would help with that.
>>
>>
>> On 2/5/18 11:49 AM, Kirk Lund wrote:
>>
>>> Another valuable naming standard is the use FooRegressionTest for tests
>>> that are specific to reproducing a bug and verifying its fix. Don't use
>>> Bug007IntegrationTest. Use something description like
>>> QueryShouldNotIncludeTXSetsRegressionTest (if you want a separate test
>>> class for the bug which is sometimes better -- otherwise just add new
>>> tests
>>> to existing tests).
>>>
>>> On Mon, Feb 5, 2018 at 11:42 AM, Kirk Lund <kl...@apache.org> wrote:
>>>
>>> The industry standard names for tests are FooTest and FooIntegrationTest
>>>> and I think we should stick to that for UnitTest and IntegrationTest.
>>>>
>>>> The following block is defined in our wiki. I'd like to replace the line
>>>> "End with JUnitTest" -- there's no reason to including "JUnit" in the
>>>> name
>>>> of our JUnit tests. Even if we decide to separate test categories in some
>>>> way other than the @Category support in Gradle's junit task, the next
>>>> preferred alternative should be different src tests (src/test,
>>>> src/integrationTest, src/distributedTest). Adding "JUnit" to the name is
>>>> an
>>>> outdated convention tied to our previous Ant build system.
>>>>
>>>> JUnit tests should
>>>>
>>>> . Use Junit 4 Syntax
>>>> *. End with JUnitTest*
>>>> . Contain an Category annotation of either UnitTest or IntegrationTest.
>>>> UnitTests as should complete in milliseconds and test a specific class.
>>>>
>>>>


Re: Naming unit tests and integration tests

Posted by Kirk Lund <kl...@apache.org>.
I've been using the name FooDistributedTest for new dunit tests. I
should've included that.

For RegressionTests, I've been including the GEODE jira ticket number and
summary in the javadocs on the test class. I'll include that in any changes
I make to the wiki.

On Mon, Feb 5, 2018 at 11:55 AM, Bruce Schuchardt <bs...@pivotal.io>
wrote:

> These seem like sensible ideas to me.  I especially don't like tests named
> after bug numbers.  I do like a pointer to relevant tickets in test
> comments/javadocs though.
>
> We also have DUnitTest.  Some designation in the name that it's using the
> dunit infrastructure is often useful to me.  Having to open a file to see
> that it's a DistributedTest vs a regular unit test could make life more
> difficult.  Putting them in their own source tree would help with that.
>
>
> On 2/5/18 11:49 AM, Kirk Lund wrote:
>
>> Another valuable naming standard is the use FooRegressionTest for tests
>> that are specific to reproducing a bug and verifying its fix. Don't use
>> Bug007IntegrationTest. Use something description like
>> QueryShouldNotIncludeTXSetsRegressionTest (if you want a separate test
>> class for the bug which is sometimes better -- otherwise just add new
>> tests
>> to existing tests).
>>
>> On Mon, Feb 5, 2018 at 11:42 AM, Kirk Lund <kl...@apache.org> wrote:
>>
>> The industry standard names for tests are FooTest and FooIntegrationTest
>>> and I think we should stick to that for UnitTest and IntegrationTest.
>>>
>>> The following block is defined in our wiki. I'd like to replace the line
>>> "End with JUnitTest" -- there's no reason to including "JUnit" in the
>>> name
>>> of our JUnit tests. Even if we decide to separate test categories in some
>>> way other than the @Category support in Gradle's junit task, the next
>>> preferred alternative should be different src tests (src/test,
>>> src/integrationTest, src/distributedTest). Adding "JUnit" to the name is
>>> an
>>> outdated convention tied to our previous Ant build system.
>>>
>>> JUnit tests should
>>>
>>> . Use Junit 4 Syntax
>>> *. End with JUnitTest*
>>> . Contain an Category annotation of either UnitTest or IntegrationTest.
>>> UnitTests as should complete in milliseconds and test a specific class.
>>>
>>>
>

Re: Naming unit tests and integration tests

Posted by Bruce Schuchardt <bs...@pivotal.io>.
These seem like sensible ideas to me.  I especially don't like tests 
named after bug numbers.  I do like a pointer to relevant tickets in 
test comments/javadocs though.

We also have DUnitTest.  Some designation in the name that it's using 
the dunit infrastructure is often useful to me.  Having to open a file 
to see that it's a DistributedTest vs a regular unit test could make 
life more difficult.  Putting them in their own source tree would help 
with that.


On 2/5/18 11:49 AM, Kirk Lund wrote:
> Another valuable naming standard is the use FooRegressionTest for tests
> that are specific to reproducing a bug and verifying its fix. Don't use
> Bug007IntegrationTest. Use something description like
> QueryShouldNotIncludeTXSetsRegressionTest (if you want a separate test
> class for the bug which is sometimes better -- otherwise just add new tests
> to existing tests).
>
> On Mon, Feb 5, 2018 at 11:42 AM, Kirk Lund <kl...@apache.org> wrote:
>
>> The industry standard names for tests are FooTest and FooIntegrationTest
>> and I think we should stick to that for UnitTest and IntegrationTest.
>>
>> The following block is defined in our wiki. I'd like to replace the line
>> "End with JUnitTest" -- there's no reason to including "JUnit" in the name
>> of our JUnit tests. Even if we decide to separate test categories in some
>> way other than the @Category support in Gradle's junit task, the next
>> preferred alternative should be different src tests (src/test,
>> src/integrationTest, src/distributedTest). Adding "JUnit" to the name is an
>> outdated convention tied to our previous Ant build system.
>>
>> JUnit tests should
>>
>> . Use Junit 4 Syntax
>> *. End with JUnitTest*
>> . Contain an Category annotation of either UnitTest or IntegrationTest.
>> UnitTests as should complete in milliseconds and test a specific class.
>>


Re: Naming unit tests and integration tests

Posted by Kirk Lund <kl...@apache.org>.
Another valuable naming standard is the use FooRegressionTest for tests
that are specific to reproducing a bug and verifying its fix. Don't use
Bug007IntegrationTest. Use something description like
QueryShouldNotIncludeTXSetsRegressionTest (if you want a separate test
class for the bug which is sometimes better -- otherwise just add new tests
to existing tests).

On Mon, Feb 5, 2018 at 11:42 AM, Kirk Lund <kl...@apache.org> wrote:

> The industry standard names for tests are FooTest and FooIntegrationTest
> and I think we should stick to that for UnitTest and IntegrationTest.
>
> The following block is defined in our wiki. I'd like to replace the line
> "End with JUnitTest" -- there's no reason to including "JUnit" in the name
> of our JUnit tests. Even if we decide to separate test categories in some
> way other than the @Category support in Gradle's junit task, the next
> preferred alternative should be different src tests (src/test,
> src/integrationTest, src/distributedTest). Adding "JUnit" to the name is an
> outdated convention tied to our previous Ant build system.
>
> JUnit tests should
>
> . Use Junit 4 Syntax
> *. End with JUnitTest*
> . Contain an Category annotation of either UnitTest or IntegrationTest.
> UnitTests as should complete in milliseconds and test a specific class.
>