harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stepan Mishura" <stepan.mish...@gmail.com>
Subject Re: duplicate tests (was: RE: svn commit: r395188 - in /incuba...)
Date Thu, 20 Apr 2006 06:36:59 GMT
IMHO, we should avoid creating duplicate tests. I guess that in this case
the second test was created just only mark that we tested both methods
(readBoolean and writeBoolean).

I think that if there is no unique (different from other scenarios used to
check class implementation) testing scenario for a class's method  then we
should mark that the method was tested with others methods. For example, for
our case:

/**
  * @tests java.io.RandomAccessFile#readBoolean()
  * @tests java.io.RandomAccessFile#writeBoolean()
  */
public void test_readBoolean_AND_writeBoolean() throws IOException {
    // Test for method boolean java.io.RandomAccessFile.readBoolean()
    RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
    raf.writeBoolean(true);
    raf.seek(0);
    assertTrue("Incorrect boolean read/written", raf.readBoolean());
    raf.close();
}

Thanks,
Stepan.

On 4/19/06, Mikhail Loenko wrote:
>
> Hello
>
> I've added a couple of regression tests to
> test/java/tests/api/java/io/RandomAccessFileTest.java
> and a bit reorganized remaining tests to get them close to conventions
> we discussed somewhere here recently.
>
> I've noticed that there are tests that are looking very similar, for
> example:
>
> /**
> * @tests java.io.RandomAccessFile#readBoolean()
> */
> public void test_readBoolean() throws IOException {
>    // Test for method boolean java.io.RandomAccessFile.readBoolean()
>    RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
>    raf.writeBoolean(true);
>    raf.seek(0);
>    assertTrue("Incorrect boolean read/written", raf.readBoolean());
>    raf.close();
> }
>
> and
>
>
> /**
> * @tests java.io.RandomAccessFile#writeBoolean(boolean)
> */
> public void test_writeBooleanZ() throws IOException {
>    // Test for method void java.io.RandomAccessFile.writeBoolean(boolean)
>    RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
>    raf.writeBoolean(true);
>    raf.seek(0);
>    assertTrue("Incorrect boolean read/written", raf.readBoolean());
>    raf.close();
> }
>
> I understand that in general we might have couples of equivalent tests
> that
> designed to test different scenarios (because when we change one of those
> tests
> the second one still cover the second scenario...), but do we need this
> kind of
> duplication here?
>
> Thanks,
> Mikhail
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>

-----------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org

Thanks,
Stepan Mishura
Intel Middleware Products Division

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message