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/11 07:46:11 UTC
reporting failure
I'm evaluating failures caused by intagration of H-88 tests and found out
that that style which is used in some tests is not very convinient for me.
I'd like to hear others' opinion.
So for example here is a failure
test: tests.api.java.security.AlgorithmParameterGeneratorTest
test case: test_initLjava_security_spec_AlgorithmParameterSpec
InvalidAlgorithmParameterException getting spec
junit.framework.AssertionFailedError:
InvalidAlgorithmParameterException getting spec at
tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec(AlgorithmParameterGeneratorTest.java:207)
at
java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
This is how the test currently looks like:
public void test_initLjava_security_spec_AlgorithmParameterSpec() {
....
try {
DSAParameterSpec spec = new DSAParameterSpec(
BigInteger.ONE, BigInteger.ONE, BigInteger.ONE);
AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
.getInstance("DSA");
gen.init(spec);
} catch (NoSuchAlgorithmException e) {
fail("getInstance did not find algorithm DSA");
} catch (InvalidAlgorithmParameterException e) {
fail("InvalidAlgorithmParameterException getting spec");
}
}
This is how I would rewrite the test:
public void test_initLjava_security_spec_AlgorithmParameterSpec()
throws Exception {
...
// checks that no exception is thrown
DSAParameterSpec spec = new DSAParameterSpec(BigInteger.ONE,
BigInteger.ONE, BigInteger.ONE);
AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
.getInstance("DSA");
gen.init(spec);
}
And here is new output:
No supported AlgorithmParameterSpec for DSA parameter generation.
java.security.InvalidAlgorithmParameterException: No supported
AlgorithmParameterSpec for DSA parameter generation. at
org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DSA.engineInit(Unknown
Source) at java.security.AlgorithmParameterGenerator.init(AlgorithmParameterGenerator.java:164)
at tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec(AlgorithmParameterGeneratorTest.java:203)
at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
I can see where the failure occurs and its reason (missing
functionality rather then
invalid parameter spec)
Comments?
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: reporting failure
Posted by Sergey Soldatov <se...@gmail.com>.
As far as I remember, fail() is pretty simple. it just throws another
exception with string or null parameter, so it's not possible to find where
the initial exception was thrown. I agree with Misha, that tests with
expected exceptions should be rewritten according to these 'best practices'
On 4/11/06, Geir Magnusson Jr <ge...@pobox.com> wrote:
>
> Your suggestion is probably how I would have done it, because I'm lazy.
> I'd add output from a try/catch if I thought that I had more
> meaningful information to add. is there a fail() that also shows the
> stacktrace for the throw exception?
>
> geir
>
>
> Mikhail Loenko wrote:
> > I'm evaluating failures caused by intagration of H-88 tests and found
> out
> > that that style which is used in some tests is not very convinient for
> me.
> >
> > I'd like to hear others' opinion.
> >
> > So for example here is a failure
> > test: tests.api.java.security.AlgorithmParameterGeneratorTest
> > test case: test_initLjava_security_spec_AlgorithmParameterSpec
> >
> > InvalidAlgorithmParameterException getting spec
> >
> > junit.framework.AssertionFailedError:
> > InvalidAlgorithmParameterException getting spec at
> >
> tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec
> (AlgorithmParameterGeneratorTest.java:207)
> > at
> > java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
> >
> > This is how the test currently looks like:
> >
> > public void test_initLjava_security_spec_AlgorithmParameterSpec() {
> > ....
> > try {
> > DSAParameterSpec spec = new DSAParameterSpec(
> > BigInteger.ONE, BigInteger.ONE, BigInteger.ONE);
> > AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
> > .getInstance("DSA");
> > gen.init(spec);
> > } catch (NoSuchAlgorithmException e) {
> > fail("getInstance did not find algorithm DSA");
> > } catch (InvalidAlgorithmParameterException e) {
> > fail("InvalidAlgorithmParameterException getting spec");
> > }
> > }
> >
> > This is how I would rewrite the test:
> >
> > public void test_initLjava_security_spec_AlgorithmParameterSpec()
> > throws Exception {
> > ...
> > // checks that no exception is thrown
> > DSAParameterSpec spec = new DSAParameterSpec(BigInteger.ONE,
> > BigInteger.ONE, BigInteger.ONE);
> > AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
> > .getInstance("DSA");
> > gen.init(spec);
> > }
> >
> > And here is new output:
> > No supported AlgorithmParameterSpec for DSA parameter generation.
> >
> > java.security.InvalidAlgorithmParameterException: No supported
> > AlgorithmParameterSpec for DSA parameter generation. at
> >
> org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DSA.engineInit
> (Unknown
> > Source) at java.security.AlgorithmParameterGenerator.init(
> AlgorithmParameterGenerator.java:164)
> > at
> tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec
> (AlgorithmParameterGeneratorTest.java:203)
> > at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
> >
> >
> > I can see where the failure occurs and its reason (missing
> > functionality rather then
> > invalid parameter spec)
> >
> > Comments?
> >
> > 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
>
>
--
Sergey Soldatov
Intel Middleware Products Division
Re: reporting failure
Posted by Mark Hindess <ma...@googlemail.com>.
You are right, we probably should. At the time I was looking at
integration and so trying to avoid making additional changes.
-Mark.
On 4/11/06, Mikhail Loenko <ml...@gmail.com> wrote:
> why not fix according to the guidlines Stepan has posted in this thread?
>
> Thanks,
> Mikhail
>
> 2006/4/11, Mark Hindess <ma...@googlemail.com>:
> > Mikhail,
> >
> > I came across one of these the other day, when looking at the
> > integration of the security tests from HARMNOY-88 IIRC. It did seem
> > to result in particularly unhelpful output. I think we should fix
> > them to give more helpful errors in the event of problems.
> >
> > -Mark.
> >
> > On 4/11/06, Mikhail Loenko <ml...@gmail.com> wrote:
> > > There is code that prints exception name but not the trace.
> > >
> > > } catch (Exception e) {
> > > fail("Exception while creating policy file : " + e);
> > > }
> > >
> > > Thanks,
> > > Mikhail
> > >
> > > 2006/4/11, Geir Magnusson Jr <ge...@pobox.com>:
> > > > Your suggestion is probably how I would have done it, because I'm lazy.
> > > > I'd add output from a try/catch if I thought that I had more
> > > > meaningful information to add. is there a fail() that also shows the
> > > > stacktrace for the throw exception?
> > > >
> > > > geir
> > > >
> > > >
> > > > Mikhail Loenko wrote:
> > > > > I'm evaluating failures caused by intagration of H-88 tests and found out
> > > > > that that style which is used in some tests is not very convinient for me.
> > > > >
> > > > > I'd like to hear others' opinion.
> > > > >
> > > > > So for example here is a failure
> > > > > test: tests.api.java.security.AlgorithmParameterGeneratorTest
> > > > > test case: test_initLjava_security_spec_AlgorithmParameterSpec
> > > > >
> > > > > InvalidAlgorithmParameterException getting spec
> > > > >
> > > > > junit.framework.AssertionFailedError:
> > > > > InvalidAlgorithmParameterException getting spec at
> > > > > tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec(AlgorithmParameterGeneratorTest.java:207)
> > > > > at
> > > > > java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
> > > > >
> > > > > This is how the test currently looks like:
> > > > >
> > > > > public void test_initLjava_security_spec_AlgorithmParameterSpec() {
> > > > > ....
> > > > > try {
> > > > > DSAParameterSpec spec = new DSAParameterSpec(
> > > > > BigInteger.ONE, BigInteger.ONE, BigInteger.ONE);
> > > > > AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
> > > > > .getInstance("DSA");
> > > > > gen.init(spec);
> > > > > } catch (NoSuchAlgorithmException e) {
> > > > > fail("getInstance did not find algorithm DSA");
> > > > > } catch (InvalidAlgorithmParameterException e) {
> > > > > fail("InvalidAlgorithmParameterException getting spec");
> > > > > }
> > > > > }
> > > > >
> > > > > This is how I would rewrite the test:
> > > > >
> > > > > public void test_initLjava_security_spec_AlgorithmParameterSpec()
> > > > > throws Exception {
> > > > > ...
> > > > > // checks that no exception is thrown
> > > > > DSAParameterSpec spec = new DSAParameterSpec(BigInteger.ONE,
> > > > > BigInteger.ONE, BigInteger.ONE);
> > > > > AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
> > > > > .getInstance("DSA");
> > > > > gen.init(spec);
> > > > > }
> > > > >
> > > > > And here is new output:
> > > > > No supported AlgorithmParameterSpec for DSA parameter generation.
> > > > >
> > > > > java.security.InvalidAlgorithmParameterException: No supported
> > > > > AlgorithmParameterSpec for DSA parameter generation. at
> > > > > org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DSA.engineInit(Unknown
> > > > > Source) at java.security.AlgorithmParameterGenerator.init(AlgorithmParameterGenerator.java:164)
> > > > > at tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec(AlgorithmParameterGeneratorTest.java:203)
> > > > > at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
> > > > >
> > > > >
> > > > > I can see where the failure occurs and its reason (missing
> > > > > functionality rather then
> > > > > invalid parameter spec)
> > > > >
> > > > > Comments?
> > > > >
> > > > > 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
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > 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
> > >
> > >
> >
> >
> > --
> > Mark Hindess <ma...@googlemail.com>
> > IBM Java Technology Centre, UK.
> >
> > ---------------------------------------------------------------------
> > 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
>
>
--
Mark Hindess <ma...@googlemail.com>
IBM Java Technology Centre, UK.
---------------------------------------------------------------------
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: reporting failure
Posted by Mikhail Loenko <ml...@gmail.com>.
why not fix according to the guidlines Stepan has posted in this thread?
Thanks,
Mikhail
2006/4/11, Mark Hindess <ma...@googlemail.com>:
> Mikhail,
>
> I came across one of these the other day, when looking at the
> integration of the security tests from HARMNOY-88 IIRC. It did seem
> to result in particularly unhelpful output. I think we should fix
> them to give more helpful errors in the event of problems.
>
> -Mark.
>
> On 4/11/06, Mikhail Loenko <ml...@gmail.com> wrote:
> > There is code that prints exception name but not the trace.
> >
> > } catch (Exception e) {
> > fail("Exception while creating policy file : " + e);
> > }
> >
> > Thanks,
> > Mikhail
> >
> > 2006/4/11, Geir Magnusson Jr <ge...@pobox.com>:
> > > Your suggestion is probably how I would have done it, because I'm lazy.
> > > I'd add output from a try/catch if I thought that I had more
> > > meaningful information to add. is there a fail() that also shows the
> > > stacktrace for the throw exception?
> > >
> > > geir
> > >
> > >
> > > Mikhail Loenko wrote:
> > > > I'm evaluating failures caused by intagration of H-88 tests and found out
> > > > that that style which is used in some tests is not very convinient for me.
> > > >
> > > > I'd like to hear others' opinion.
> > > >
> > > > So for example here is a failure
> > > > test: tests.api.java.security.AlgorithmParameterGeneratorTest
> > > > test case: test_initLjava_security_spec_AlgorithmParameterSpec
> > > >
> > > > InvalidAlgorithmParameterException getting spec
> > > >
> > > > junit.framework.AssertionFailedError:
> > > > InvalidAlgorithmParameterException getting spec at
> > > > tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec(AlgorithmParameterGeneratorTest.java:207)
> > > > at
> > > > java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
> > > >
> > > > This is how the test currently looks like:
> > > >
> > > > public void test_initLjava_security_spec_AlgorithmParameterSpec() {
> > > > ....
> > > > try {
> > > > DSAParameterSpec spec = new DSAParameterSpec(
> > > > BigInteger.ONE, BigInteger.ONE, BigInteger.ONE);
> > > > AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
> > > > .getInstance("DSA");
> > > > gen.init(spec);
> > > > } catch (NoSuchAlgorithmException e) {
> > > > fail("getInstance did not find algorithm DSA");
> > > > } catch (InvalidAlgorithmParameterException e) {
> > > > fail("InvalidAlgorithmParameterException getting spec");
> > > > }
> > > > }
> > > >
> > > > This is how I would rewrite the test:
> > > >
> > > > public void test_initLjava_security_spec_AlgorithmParameterSpec()
> > > > throws Exception {
> > > > ...
> > > > // checks that no exception is thrown
> > > > DSAParameterSpec spec = new DSAParameterSpec(BigInteger.ONE,
> > > > BigInteger.ONE, BigInteger.ONE);
> > > > AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
> > > > .getInstance("DSA");
> > > > gen.init(spec);
> > > > }
> > > >
> > > > And here is new output:
> > > > No supported AlgorithmParameterSpec for DSA parameter generation.
> > > >
> > > > java.security.InvalidAlgorithmParameterException: No supported
> > > > AlgorithmParameterSpec for DSA parameter generation. at
> > > > org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DSA.engineInit(Unknown
> > > > Source) at java.security.AlgorithmParameterGenerator.init(AlgorithmParameterGenerator.java:164)
> > > > at tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec(AlgorithmParameterGeneratorTest.java:203)
> > > > at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
> > > >
> > > >
> > > > I can see where the failure occurs and its reason (missing
> > > > functionality rather then
> > > > invalid parameter spec)
> > > >
> > > > Comments?
> > > >
> > > > 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
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >
>
>
> --
> Mark Hindess <ma...@googlemail.com>
> IBM Java Technology Centre, UK.
>
> ---------------------------------------------------------------------
> 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
Re: reporting failure
Posted by Mark Hindess <ma...@googlemail.com>.
Mikhail,
I came across one of these the other day, when looking at the
integration of the security tests from HARMNOY-88 IIRC. It did seem
to result in particularly unhelpful output. I think we should fix
them to give more helpful errors in the event of problems.
-Mark.
On 4/11/06, Mikhail Loenko <ml...@gmail.com> wrote:
> There is code that prints exception name but not the trace.
>
> } catch (Exception e) {
> fail("Exception while creating policy file : " + e);
> }
>
> Thanks,
> Mikhail
>
> 2006/4/11, Geir Magnusson Jr <ge...@pobox.com>:
> > Your suggestion is probably how I would have done it, because I'm lazy.
> > I'd add output from a try/catch if I thought that I had more
> > meaningful information to add. is there a fail() that also shows the
> > stacktrace for the throw exception?
> >
> > geir
> >
> >
> > Mikhail Loenko wrote:
> > > I'm evaluating failures caused by intagration of H-88 tests and found out
> > > that that style which is used in some tests is not very convinient for me.
> > >
> > > I'd like to hear others' opinion.
> > >
> > > So for example here is a failure
> > > test: tests.api.java.security.AlgorithmParameterGeneratorTest
> > > test case: test_initLjava_security_spec_AlgorithmParameterSpec
> > >
> > > InvalidAlgorithmParameterException getting spec
> > >
> > > junit.framework.AssertionFailedError:
> > > InvalidAlgorithmParameterException getting spec at
> > > tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec(AlgorithmParameterGeneratorTest.java:207)
> > > at
> > > java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
> > >
> > > This is how the test currently looks like:
> > >
> > > public void test_initLjava_security_spec_AlgorithmParameterSpec() {
> > > ....
> > > try {
> > > DSAParameterSpec spec = new DSAParameterSpec(
> > > BigInteger.ONE, BigInteger.ONE, BigInteger.ONE);
> > > AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
> > > .getInstance("DSA");
> > > gen.init(spec);
> > > } catch (NoSuchAlgorithmException e) {
> > > fail("getInstance did not find algorithm DSA");
> > > } catch (InvalidAlgorithmParameterException e) {
> > > fail("InvalidAlgorithmParameterException getting spec");
> > > }
> > > }
> > >
> > > This is how I would rewrite the test:
> > >
> > > public void test_initLjava_security_spec_AlgorithmParameterSpec()
> > > throws Exception {
> > > ...
> > > // checks that no exception is thrown
> > > DSAParameterSpec spec = new DSAParameterSpec(BigInteger.ONE,
> > > BigInteger.ONE, BigInteger.ONE);
> > > AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
> > > .getInstance("DSA");
> > > gen.init(spec);
> > > }
> > >
> > > And here is new output:
> > > No supported AlgorithmParameterSpec for DSA parameter generation.
> > >
> > > java.security.InvalidAlgorithmParameterException: No supported
> > > AlgorithmParameterSpec for DSA parameter generation. at
> > > org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DSA.engineInit(Unknown
> > > Source) at java.security.AlgorithmParameterGenerator.init(AlgorithmParameterGenerator.java:164)
> > > at tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec(AlgorithmParameterGeneratorTest.java:203)
> > > at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
> > >
> > >
> > > I can see where the failure occurs and its reason (missing
> > > functionality rather then
> > > invalid parameter spec)
> > >
> > > Comments?
> > >
> > > 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
> >
> >
>
> ---------------------------------------------------------------------
> 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
>
>
--
Mark Hindess <ma...@googlemail.com>
IBM Java Technology Centre, UK.
---------------------------------------------------------------------
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: reporting failure
Posted by Mikhail Loenko <ml...@gmail.com>.
There is code that prints exception name but not the trace.
} catch (Exception e) {
fail("Exception while creating policy file : " + e);
}
Thanks,
Mikhail
2006/4/11, Geir Magnusson Jr <ge...@pobox.com>:
> Your suggestion is probably how I would have done it, because I'm lazy.
> I'd add output from a try/catch if I thought that I had more
> meaningful information to add. is there a fail() that also shows the
> stacktrace for the throw exception?
>
> geir
>
>
> Mikhail Loenko wrote:
> > I'm evaluating failures caused by intagration of H-88 tests and found out
> > that that style which is used in some tests is not very convinient for me.
> >
> > I'd like to hear others' opinion.
> >
> > So for example here is a failure
> > test: tests.api.java.security.AlgorithmParameterGeneratorTest
> > test case: test_initLjava_security_spec_AlgorithmParameterSpec
> >
> > InvalidAlgorithmParameterException getting spec
> >
> > junit.framework.AssertionFailedError:
> > InvalidAlgorithmParameterException getting spec at
> > tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec(AlgorithmParameterGeneratorTest.java:207)
> > at
> > java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
> >
> > This is how the test currently looks like:
> >
> > public void test_initLjava_security_spec_AlgorithmParameterSpec() {
> > ....
> > try {
> > DSAParameterSpec spec = new DSAParameterSpec(
> > BigInteger.ONE, BigInteger.ONE, BigInteger.ONE);
> > AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
> > .getInstance("DSA");
> > gen.init(spec);
> > } catch (NoSuchAlgorithmException e) {
> > fail("getInstance did not find algorithm DSA");
> > } catch (InvalidAlgorithmParameterException e) {
> > fail("InvalidAlgorithmParameterException getting spec");
> > }
> > }
> >
> > This is how I would rewrite the test:
> >
> > public void test_initLjava_security_spec_AlgorithmParameterSpec()
> > throws Exception {
> > ...
> > // checks that no exception is thrown
> > DSAParameterSpec spec = new DSAParameterSpec(BigInteger.ONE,
> > BigInteger.ONE, BigInteger.ONE);
> > AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
> > .getInstance("DSA");
> > gen.init(spec);
> > }
> >
> > And here is new output:
> > No supported AlgorithmParameterSpec for DSA parameter generation.
> >
> > java.security.InvalidAlgorithmParameterException: No supported
> > AlgorithmParameterSpec for DSA parameter generation. at
> > org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DSA.engineInit(Unknown
> > Source) at java.security.AlgorithmParameterGenerator.init(AlgorithmParameterGenerator.java:164)
> > at tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec(AlgorithmParameterGeneratorTest.java:203)
> > at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
> >
> >
> > I can see where the failure occurs and its reason (missing
> > functionality rather then
> > invalid parameter spec)
> >
> > Comments?
> >
> > 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
>
>
---------------------------------------------------------------------
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: reporting failure
Posted by Geir Magnusson Jr <ge...@pobox.com>.
Your suggestion is probably how I would have done it, because I'm lazy.
I'd add output from a try/catch if I thought that I had more
meaningful information to add. is there a fail() that also shows the
stacktrace for the throw exception?
geir
Mikhail Loenko wrote:
> I'm evaluating failures caused by intagration of H-88 tests and found out
> that that style which is used in some tests is not very convinient for me.
>
> I'd like to hear others' opinion.
>
> So for example here is a failure
> test: tests.api.java.security.AlgorithmParameterGeneratorTest
> test case: test_initLjava_security_spec_AlgorithmParameterSpec
>
> InvalidAlgorithmParameterException getting spec
>
> junit.framework.AssertionFailedError:
> InvalidAlgorithmParameterException getting spec at
> tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec(AlgorithmParameterGeneratorTest.java:207)
> at
> java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
>
> This is how the test currently looks like:
>
> public void test_initLjava_security_spec_AlgorithmParameterSpec() {
> ....
> try {
> DSAParameterSpec spec = new DSAParameterSpec(
> BigInteger.ONE, BigInteger.ONE, BigInteger.ONE);
> AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
> .getInstance("DSA");
> gen.init(spec);
> } catch (NoSuchAlgorithmException e) {
> fail("getInstance did not find algorithm DSA");
> } catch (InvalidAlgorithmParameterException e) {
> fail("InvalidAlgorithmParameterException getting spec");
> }
> }
>
> This is how I would rewrite the test:
>
> public void test_initLjava_security_spec_AlgorithmParameterSpec()
> throws Exception {
> ...
> // checks that no exception is thrown
> DSAParameterSpec spec = new DSAParameterSpec(BigInteger.ONE,
> BigInteger.ONE, BigInteger.ONE);
> AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
> .getInstance("DSA");
> gen.init(spec);
> }
>
> And here is new output:
> No supported AlgorithmParameterSpec for DSA parameter generation.
>
> java.security.InvalidAlgorithmParameterException: No supported
> AlgorithmParameterSpec for DSA parameter generation. at
> org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DSA.engineInit(Unknown
> Source) at java.security.AlgorithmParameterGenerator.init(AlgorithmParameterGenerator.java:164)
> at tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec(AlgorithmParameterGeneratorTest.java:203)
> at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
>
>
> I can see where the failure occurs and its reason (missing
> functionality rather then
> invalid parameter spec)
>
> Comments?
>
> 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
Re: reporting failure
Posted by Stepan Mishura <st...@gmail.com>.
This url was send before ... resending
See: http://www.javaworld.com/javaworld/jw-12-2000/jw-1221-junit_p.html
Paragraph: *Utilize JUnit's assert/fail methods and exception handling for
clean test code*
Thanks,
Stepan.
On 4/11/06, Mikhail Loenko wrote:
>
> I'm evaluating failures caused by intagration of H-88 tests and found out
> that that style which is used in some tests is not very convinient for me.
>
> I'd like to hear others' opinion.
>
> So for example here is a failure
> test: tests.api.java.security.AlgorithmParameterGeneratorTest
> test case: test_initLjava_security_spec_AlgorithmParameterSpec
>
> InvalidAlgorithmParameterException getting spec
>
> junit.framework.AssertionFailedError:
> InvalidAlgorithmParameterException getting spec at
>
> tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec
> (AlgorithmParameterGeneratorTest.java:207)
> at
> java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
>
> This is how the test currently looks like:
>
> public void test_initLjava_security_spec_AlgorithmParameterSpec() {
> ....
> try {
> DSAParameterSpec spec = new DSAParameterSpec(
> BigInteger.ONE, BigInteger.ONE, BigInteger.ONE);
> AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
> .getInstance("DSA");
> gen.init(spec);
> } catch (NoSuchAlgorithmException e) {
> fail("getInstance did not find algorithm DSA");
> } catch (InvalidAlgorithmParameterException e) {
> fail("InvalidAlgorithmParameterException getting spec");
> }
> }
>
> This is how I would rewrite the test:
>
> public void test_initLjava_security_spec_AlgorithmParameterSpec()
> throws Exception {
> ...
> // checks that no exception is thrown
> DSAParameterSpec spec = new DSAParameterSpec(BigInteger.ONE,
> BigInteger.ONE, BigInteger.ONE);
> AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
> .getInstance("DSA");
> gen.init(spec);
> }
>
> And here is new output:
> No supported AlgorithmParameterSpec for DSA parameter generation.
>
> java.security.InvalidAlgorithmParameterException: No supported
> AlgorithmParameterSpec for DSA parameter generation. at
>
> org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DSA.engineInit
> (Unknown
> Source) at java.security.AlgorithmParameterGenerator.init(
> AlgorithmParameterGenerator.java:164)
> at
> tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec
> (AlgorithmParameterGeneratorTest.java:203)
> at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
>
>
> I can see where the failure occurs and its reason (missing
> functionality rather then
> invalid parameter spec)
>
> Comments?
>
> 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