Test that fail randomly with wounit
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. - The EOModel 'KAAccessControl' has an empty connection dictionary. - The EOModel 'KAAccessControl' has an empty connection dictionary. - 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? 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) 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 ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Test that fail randomly with wounit
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) ...
Re: Test that fail randomly with wounit
Hi Chuck, 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. I was wondering a multiple test side effect and build a single test class to verify and the situation is still there (I put the complete class except import and static final declarations in my previous message). I suspect some concurrency problem but where is the concurrency with a single test running? Even the debugger see only one thread. 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? I added dummy connection information in the model and the 2 empty connection dictionary warning for KAAccessControl disappeared but not the … already contains a model with that name. warning. Those are printed during the MockEditingContext creation. I have no idea that explain why the warning are duplicated. I do not use multiple EOF stack and anyway in the context of running the test, everything is from the sole MockEditingContext defined in the test class. The NPE is raised on the first EOUtilities.createAndInsertInstance() call sometime. Samuel 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
Re: Test that fail randomly with wounit
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 ch...@global-village.net 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
Re: Test that fail randomly with wounit
Le 2013-06-18 à 20:41, Samuel Pelletier sam...@samkar.com a écrit : 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. And lucky you, he will be at WOWODC :-) Samuel Le 2013-06-18 à 18:10, Chuck Hill ch...@global-village.net 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)