Unit Test of standard lib

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Unit Test of standard lib

Abdessamed MANSOURI
Hello all,

I was looking about how Java do unit tests of its standard library and i've
found in the code source of OpenJDK unit tests under test folder, my
question is why Java uses direct unit tests (using main) and it doesn't use
a powerfull framework as JUnit? i think it is possible to use it because
unit tests of standard lib are already written in Java.

--
Thanks,

Abdessamed MANSOURI
Reply | Threaded
Open this post in threaded view
|

Re: Unit Test of standard lib

roger riggs
Hi,

The tests in the JDK has been accumulating for two plus decades and
several different frameworks
have been used over time.  More recent tests use the TestNG framework as
supported
by jtreg.    Some developers prefer the direct usefulness of main with
no extra work to
setup and run individual tests as is needed for debugging.

$.02, Roger


On 10/26/2016 4:43 PM, Abdessamed MANSOURI wrote:
> Hello all,
>
> I was looking about how Java do unit tests of its standard library and i've
> found in the code source of OpenJDK unit tests under test folder, my
> question is why Java uses direct unit tests (using main) and it doesn't use
> a powerfull framework as JUnit? i think it is possible to use it because
> unit tests of standard lib are already written in Java.
>

Reply | Threaded
Open this post in threaded view
|

Re: Unit Test of standard lib

Jonathan Gibbons
In reply to this post by Abdessamed MANSOURI


On 10/26/2016 01:43 PM, Abdessamed MANSOURI wrote:
> Hello all,
>
> I was looking about how Java do unit tests of its standard library and i've
> found in the code source of OpenJDK unit tests under test folder, my
> question is why Java uses direct unit tests (using main) and it doesn't use
> a powerfull framework as JUnit? i think it is possible to use it because
> unit tests of standard lib are already written in Java.
>

There are various aspects to this.

The most obvious one is that many of the tests date back to a time
before there
was any framework like JUnit or TestNG.

In addition, many of the tests rely on features not directly supported
by those
frameworks, such as the easy ability to execute in a separate JVM, or to
vary
the security manager or policy for each test.

Finally, the OpenJDK test framework (jtreg) does now support tests
written for
TestNG, and to a lesser extent, JUnit as well, and this has been used
for some
of the more recent additions to the test suite.

-- Jon


Reply | Threaded
Open this post in threaded view
|

Re: Unit Test of standard lib

Abdessamed MANSOURI
Rogger and Jon, Thank you for your quick answers, I didn't noticed the
presence of these framework, i was primarily how Java unit test IO API to
respect the contracts because i need to provide some streams, and as Jon
said, these tests date back to a time before there were theses frameworks,
so i thought Java doesn't use any framework (So its less probably to see
test written in TestNG from the first time).

2016-10-26 22:33 GMT+01:00 Abdessamed MANSOURI <[hidden email]>:

> Rogger and Jon, Thank you for your quick answers, I didn't noticed the
> presence of these framework, i was primarily how Java unit test IO API to
> respect the contracts because i need to provide some streams, and as Jon
> said, these tests date back to a time before there were theses frameworks,
> so i thought Java doesn't use any framework (So its less probably to see
> test written in TestNG from the first time).
>



--
Thanks,

Abdessamed MANSOURI
Reply | Threaded
Open this post in threaded view
|

Re: Unit Test of standard lib

Abdessamed MANSOURI
Rogger and Jon, Thank you for your quick answers, I didn't noticed the
presence of these framework, i was primarily how Java unit test IO API to
respect the contracts because i need to provide some streams, and as Jon
said, these tests date back to a time before there were theses frameworks,
so i thought Java doesn't use any framework (So its less probably to see
test written in TestNG from the first time).

2016-10-26 22:34 GMT+01:00 Abdessamed MANSOURI <[hidden email]>:

> Rogger and Jon, Thank you for your quick answers, I didn't noticed the
> presence of these framework, i was primarily how Java unit test IO API to
> respect the contracts because i need to provide some streams, and as Jon
> said, these tests date back to a time before there were theses frameworks,
> so i thought Java doesn't use any framework (So its less probably to see
> test written in TestNG from the first time).
>
> 2016-10-26 22:33 GMT+01:00 Abdessamed MANSOURI <[hidden email]>:
>
>> Rogger and Jon, Thank you for your quick answers, I didn't noticed the
>> presence of these framework, i was primarily how Java unit test IO API to
>> respect the contracts because i need to provide some streams, and as Jon
>> said, these tests date back to a time before there were theses frameworks,
>> so i thought Java doesn't use any framework (So its less probably to see
>> test written in TestNG from the first time).
>>
>
>
>
> --
> Thanks,
>
> Abdessamed MANSOURI
>



--
Thanks,

Abdessamed MANSOURI
Reply | Threaded
Open this post in threaded view
|

Re: Unit Test of standard lib

Semyon Sadetsky
In reply to this post by Abdessamed MANSOURI
On 10/26/2016 11:43 PM, Abdessamed MANSOURI wrote:
> Hello all,
>
> I was looking about how Java do unit tests of its standard library and i've
> found in the code source of OpenJDK unit tests under test folder, my
> question is why Java uses direct unit tests (using main) and it doesn't use
> a powerfull framework as JUnit? i think it is possible to use it because
> unit tests of standard lib are already written in Java.
>
There may be license incompatibility.

In general GPL v2 (OpenJDK) is not compatible with EPL (JUnit) and
Apache 2.0 (TestNG).

--Semyon