You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Mikhail Loenko <ml...@gmail.com> on 2006/04/19 11:56:23 UTC

duplicate tests (was: RE: svn commit: r395188 - in /incuba...)

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


Re: duplicate tests (was: RE: svn commit: r395188 - in /incuba...)

Posted by Mikhail Loenko <ml...@gmail.com>.
OK, I'll remove duplicate tests then

Thanks,
Mikhail

2006/4/20, Stepan Mishura <st...@gmail.com>:
> 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
>
>

---------------------------------------------------------------------
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


Re: duplicate tests (was: RE: svn commit: r395188 - in /incuba...)

Posted by Stepan Mishura <st...@gmail.com>.
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