juneau-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Russell <craig.russ...@oracle.com>
Subject Re: Unit test failures?
Date Wed, 03 Aug 2016 18:10:47 GMT
Hi Peter,

I’ve had some experience with writing test cases that verify unordered results.

> On Aug 2, 2016, at 10:04 PM, Peter Haumer <phaumer@us.ibm.com> wrote:
> 
> Hello.
> - releng is for the parent pom that defines the modules as well as common properties
and configs to be inherited to the children. It does not have a result of its own, but its
purpose is to inherit and to execute the child modules. 
> - distrib is a modules that is executed at the end which assembles jars from its peers.
It has a result, which is the assembly. Currently I am creating uber jars as well as dirs
with all the jars inside. It also has the docs and sources. The assembly doc are the complete
javadocs. The other modules such as core or client have their own local Javadocs and sources
as well. You find them in the /target dir once compilation finishes. 
> 
> About the compilation errors. They happen randomly in asserts that compare a serialization
of an ObjectMap against a static string. As these use HashMaps where the iterator does not
guarantee the order of the results the compare can fail as the serialization is different,
e.g. [{f1:'foo',f2:1,f3:true},{f1:'bar',f2:2,f3:false},{f1:'baz',f2:3,f3:true}] vs [{f3:true,f2:1,f1:'foo'},{f3:false,f2:2,f1:'bar'},{f3:true,f2:3,f1:'baz'}]
in CT_PojoQuery.testFilterCollectionViewOneLevel:419. I think this article explains why it
worked before when we were building in Jazz https://examples.javacodegeeks.com/core-java/util/hashmap/hashmap-changes-in-java-8/
<https://examples.javacodegeeks.com/core-java/util/hashmap/hashmap-changes-in-java-8/>
> 
> Perhaps we should create a test utility that reads back the static string into a HashMap
and compare these via their keys?
> 
For this case, it might be trivial for the test case to read the static string into an ordered
Map like TreeMap that can be compared with an expected TreeMap simply using expected.equals(actual).

Craig
> 
> 
> 
> Thanks and best regards,
> Peter Haumer.
> 
> ______________________________________________________________
> 
> PETER HAUMER, Dr. rer. nat.
> IBM zSystems Software
> ______________________________________________________________
> 
> James Bognar ---08/02/2016 07:09:04 PM---@John...I'll take a look at these tomorrow.
@Peter....qq...what's the difference between the releng
> 
> From: James Bognar <james.bognar@salesforce.com>
> To: "dev@juneau.incubator.apache.org" <dev@juneau.incubator.apache.org>
> Date: 08/02/2016 07:09 PM
> Subject: Re: Unit test failures?
> 
> 
> 
> 
> @John...I'll take a look at these tomorrow.
> 
> @Peter....qq...what's the difference between the releng and distrib folders?
> 
> On Tuesday, August 2, 2016, John D. Ament <johndament@apache.org> wrote:
> 
> > Trying to build juneau locally.  I think I figured out that the current
> > root pom is in org.apache.juneau.releng.  Running on the command line
> > results in the following test failures:
> >
> > Failed tests:
> >   CT_Common.testTrimEmptyArrays:147
> > expected:<...null/></tr><tr><td><[null/></td><td><]string>s2</string></...>
> > but was:<...null/></tr><tr><td><[]string>s2</string></...>
> >   CT_Common.testTrimEmptyLists:113
> > expected:<...null/></tr><tr><td><[null/></td><td><]string>s2</string></...>
> > but was:<...null/></tr><tr><td><[]string>s2</string></...>
> >   CT_PojoQuery.testFilterCollectionViewOneLevel:407
> > expected:<[{f1:'foo'[},{f1:'bar'},{f1:'baz']}]> but
> >
> > was:<[{f1:'foo'[,f2:1,f3:true},{f1:'bar',f2:2,f3:false},{f1:'baz',f2:3,f3:true]}]>
> >   CT_PojoQuery.testFilterCollectionViewTwoLevel:460
> > expected:<[{f1:'foo'[},{f1:'bar'},{f1:'baz']}]> but
> >
> > was:<[{f1:'foo'[,f2:{f1:'f2_foo',f2:'f2_foo'},f3:[{f1:'f31_foo',f2:'f31_foo'},{f1:'f32_foo',f2:'f32_foo'}]},{f1:'bar',f2:{f1:'f2_bar',f2:'f2_bar'},f3:[{f1:'f31_bar',f2:'f31_bar'},{f1:'f32_bar',f2:'f32_bar'}]},{f1:'baz',f2:{f1:'f2_baz',f2:'f2_baz'},f3:[{f1:'f31_baz',f2:'f31_baz'},{f1:'f32_baz',f2:'f32_baz'}]]}]>
> >   CT_PojoQuery.testFilterMapOneLevel:514 expected:<{f1:'foo'[]}> but
> > was:<{f1:'foo'[,f2:1,f3:true]}>
> >   CT_PojoQuery.testFilterMapTwoLevel:554 expected:<{f1:'foo'[]}> but
> >
> > was:<{f1:'foo'[,f2:{f1:'f2_foo',f2:'f2_foo'},f3:[{f1:'f31_foo',f2:'f31_foo'},{f1:'f32_foo',f2:'f32_foo'}]]}>
> >   CT_PojoQuery.testSorting:620
> > expected:<[{f1:2,f2:'bar'[},{f1:3,f2:'baz'},{f1:1,f2:'foo]'}]> but
> > was:<[{f1:2,f2:'bar'[,f3:false,f4:'2011/02/01
> > 00:00:00'},{f1:3,f2:'baz',f3:true,f4:'2012/02/01
> > 00:00:00'},{f1:1,f2:'foo',f3:true,f4:'2010/02/01 00:00:00]'}]>
> >
> > Tests run: 3041, Failures: 7, Errors: 0, Skipped: 2
> >
> 
> 
> -- 
> James Bognar
> 
> 
> 

Craig L Russell
Architect
craig.russell@oracle.com
P.S <mailto:Craig.Russell@oracle.comP.S>. A good JDO? O, Gasp!






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