• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Test that fail randomly with wounit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Test that fail randomly with wounit


  • Subject: Re: Test that fail randomly with wounit
  • From: Samuel Pelletier <email@hidden>
  • Date: Tue, 18 Jun 2013 20:41:29 -0400

Hi Chuck,

I think your last comment was correct:

>> I think that means a model is being used that is not yet in an EOModelGroup.

I added the model name to the new MockEditingContext() call and no more fail to date when I run only this test class. If I run the complete project tests, I still have intermittent fail at the same place even after adding the model name to all the MockEditingContext constructors. I hate intermittent problems!

Maybe Henrique Prange understand the situation. If the model name is mandatory to ensure it's loading before the test run, I suggest to enforce at least one name in the constructor of the MockEditingContext.

Samuel


Le 2013-06-18 à 18:10, Chuck Hill <email@hidden> a écrit :

> Hi Samuel,
>
> JUnit can/will run tests in a different order each time.  So if your tests depend on something else having happened (EOF getting fully initialized, some other test running first) you will see random failures like this.  I think it an/will run tests in multiple threads too (I use both JUnit and TestNG and sometimes mix up their features :-) so concurrency can also cause problems like this.
>
>
> On 2013-06-18, at 2:13 PM, Samuel Pelletier wrote:
>
>> Hi,
>>
>> I have a test that succeed sometime and fail other times. If I run the jUnit source that contain this test, it fail sometime in the loadPermission() method. I have no idea where to look at. It is even more strange that sometime, I can have 6 successful tests and after 4 failed in a row.
>>
>> These test are inside a framework project. When I run the tests, I have these lines on the console but they do not seems to cause problem with the about 100 others tests in the project.
>>
>> - The EOModel 'erprototypes' has an empty connection dictionary.
>> - The EOModel 'erprototypes' has an empty connection dictionary.
>
> Those are likely to be OK.
>
>> - The EOModel 'KAAccessControl' has an empty connection dictionary.
>> - The EOModel 'KAAccessControl' has an empty connection dictionary.
>
> I am guessing you need that model for the permissions testing.  This is likely a problem.
>
>
>> - The model 'KAAccessControl' (path: file:/Users/sam/work/KavijuWO/KAAccessControl/Resources/KAAccessControl.eomodeld) cannot be added to model group <EOModelGroup (("KAAccessControl", "file:/Users/sam/work/KavijuWO/KAAccessControl/Resources/KAAccessControl.eomodeld"), ("erprototypes", "file:/Users/sam/work/WonderSource/Frameworks/Core/ERPrototypes/Resources/erprototypes.eomodeld"))> because it already contains a model with that name.
>>
>> Any idea?
>
> Do you have multiple EOF stacks (multiple EOObjectStoreCoordinators)?  You could be using default* methods that only work with the default stack.  Is there a stack trace for that last one to show where duplication model loading is having?
>
>
>>
>> Samuel
>>
>> RolesFileLoader load a plist file to create and update objects in the database.
>>
>> Here is a my test source with a single test:
>>
>> 	@Rule public MockEditingContext ec = new MockEditingContext();
>>
>> 	@Before
>> 	public void loadPermissions() {
>> 		ERXProperties.setStringForKey("SampleRolesFile", RolesFileLoader.rolesFileNamePropertyKey);
>> 		RolesFileLoader.loadRolesFile(ec);
>> 	}
>>
>> 	@Test
>> 	public void testReloadPermissions() {
>> 		ERXProperties.setStringForKey("SampleRolesFile", RolesFileLoader.rolesFileNamePropertyKey);
>> 		RolesFileLoader.loadRolesFile(ec);
>> 	}
>>
>> The error stack:
>>
>> com.webobjects.foundation.NSForwardException [java.lang.reflect.InvocationTargetException] null:java.lang.reflect.InvocationTargetException
>> 	…
>> Caused by: java.lang.reflect.InvocationTargetException
>> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>> 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>> 	at com.webobjects.foundation._NSUtilities.instantiateObjectWithConstructor(_NSUtilities.java:659)
>> 	... 32 more
>> Caused by: java.lang.NullPointerException
>> 	at com.webobjects.eoaccess.EOModel.createPrototypeCache(EOModel.java:631)
>
> I think that means a model is being used that is not yet in an EOModelGroup.
>
>
> Chuck
>
>> 	at com.webobjects.eoaccess.EOModel.prototypeAttributeNamed(EOModel.java:699)
>> 	at com.webobjects.eoaccess.ERXModel.prototypeAttributeNamed(ERXModel.java:290)
>> 	at com.webobjects.eoaccess.EOAttribute.<init>(EOAttribute.java:998)
>> 	at com.webobjects.eoaccess.EOEntity.attributes(EOEntity.java:816)
>> 	at com.webobjects.eoaccess.EOEntity.attributeNamed(EOEntity.java:789)
>> 	at com.webobjects.eoaccess.EOEntity.classProperties(EOEntity.java:1098)
>> 	at com.webobjects.eoaccess.EOEntity._propertyDictionaryInitializer(EOEntity.java:3321)
>> 	at com.webobjects.eoaccess.EOEntity._newDictionaryForProperties(EOEntity.java:3667)
>> 	at com.webobjects.eoaccess.EOEntityClassDescription._newDictionaryForProperties(EOEntityClassDescription.java:88)
>> 	at com.webobjects.eocontrol.EOGenericRecord.__setClassDescription(EOGenericRecord.java:111)
>> 	at com.webobjects.eocontrol.EOGenericRecord.__setClassDescription(EOGenericRecord.java:100)
>> 	at com.webobjects.eocontrol.EOGenericRecord.<init>(EOGenericRecord.java:73)
>> 	at er.extensions.eof.ERXGenericRecord.<init>(ERXGenericRecord.java:106)
>> 	at com.kaviju.accesscontrol.model.base._KAAccessList.<init>(_KAAccessList.java:15)
>> 	at com.kaviju.accesscontrol.model.KAAccessList.<init>(KAAccessList.java:8)
>> 	... 37 more
>
> --
> Chuck Hill
> Executive Managing Partner, VP Development and Technical Services
>
> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/gvc/practical_webobjects
>
> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
>
> Global Village Consulting ranks 44th in 25th annual PROFIT 500 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
>
>
>
>
>
>
>
>
>
>
>
>


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Test that fail randomly with wounit
      • From: Pascal Robert <email@hidden>
References: 
 >Test that fail randomly with wounit (From: Samuel Pelletier <email@hidden>)
 >Re: Test that fail randomly with wounit (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Test that fail randomly with wounit
  • Next by Date: Re: Test that fail randomly with wounit
  • Previous by thread: Re: Test that fail randomly with wounit
  • Next by thread: Re: Test that fail randomly with wounit
  • Index(es):
    • Date
    • Thread