Re: wounit: cannot load model
Re: wounit: cannot load model
- Subject: Re: wounit: cannot load model
- From: Chuck Hill <email@hidden>
- Date: Sun, 05 Aug 2012 22:12:12 -0700
Hi Hafid,
Try adding NSProjectBundleEnabled=true to the Program Arguments then. Does that make any difference?
Chuck
On 2012-08-05, at 8:33 PM, hafid ouazib wrote:
> Hi Henrique,
> Hi Chuck,
> I set the property NSProjectBundleEnabled to true in VM arguments, but I always get the same error,
> the only way to run my test:
> -- inside my framwork, I need to close all others Frameworks, only one must still open,
> -- inside my Application, I need to close all frameworks, only 2 Frameworks must still open,
>
> when my test is working, I print the value of the property NSProjectBundleEnabled and is null
>
> Cheers,
>
>
>
>
> 2012/8/5 Henrique Prange <email@hidden>
> Hi Hafid,
>
> As Chuck said, the problem is probably related to the value of the NSProjectBundleEnabled property. By default, WOUnit sets this property to true as described in the issue [1]. However, it can somehow be changed in the testing process. Could you try to print the value of this property in your breaking test? Is it true or false?
>
> Anyway, WOUnit should require no additional configuration to be used. I really would like to know the structure/configuration of your project to provide a fix for this problem.
>
> [1]https://github.com/hprange/wounit/issues/13
>
> Cheers,
>
> Henrique
>
> On 02/08/2012, at 16:38, Chuck Hill <email@hidden> wrote:
>
> > Hi Hafid,
> >
> > Try adding -DNSProjectBundleEnabled=true to the VM Arguments in the launcher for you tests.
> >
> >
> > Chuck
> >
> >
> > On 2012-08-02, at 6:31 AM, hafid ouazib wrote:
> >
> >> Hi Henrique,
> >>
> >> I have the same error message if I run test in my application or in my framework,
> >> but, when I close all my frameworks in Eclipse, the test is working fine,
> >> it is not a good solution because, it will be dificult to run tests if I need to close all my framworks every time:(
> >>
> >> Thanks,
> >>
> >>
> >> 2012/7/31 Henrique Prange <email@hidden>
> >> Hi Hafid,
> >>
> >> It should have worked. WOUnit search for models in the classpath (inside or outside a Resources folder).
> >>
> >> I need more information to understand if it is a bug in WOUnit. Your project is an application or framework? The model ACAIQCore is in the same project of the test class? Have you tried to run the test from your build system? Did it work?
> >>
> >> I've also created the issue [1] #29 to improve the error message in case a model cannot be loaded properly.
> >>
> >> [1]https://github.com/hprange/wounit/issues/29
> >>
> >> Cheers,
> >>
> >> Henrique
> >>
> >> On 30/07/2012, at 10:08, hafid ouazib <email@hidden> wrote:
> >>
> >>> Hi,
> >>> My model is in the folder Resources,
> >>>
> >>> the source of my test is:
> >>>
> >>> package com.acaiq.fondation.acaiqCore;
> >>>
> >>> import org.junit.Rule;
> >>> import org.junit.Test;
> >>> import com.wounit.annotations.UnderTest;
> >>> import com.wounit.rules.MockEditingContext;
> >>>
> >>> public class ExempleTest {
> >>>
> >>> @Rule
> >>> public MockEditingContext ec = new MockEditingContext("ACAIQCore");
> >>>
> >>> @UnderTest
> >>> Membre titulaire;
> >>>
> >>> @Test
> >>> public void exempleUnitTest() {
> >>> System.out.println("first test");
> >>> }
> >>>
> >>> }
> >>>
> >>>
> >>> stack trace:
> >>>
> >>> java.lang.IllegalArgumentException: Cannot load model named 'ACAIQCore'
> >>> at com.wounit.rules.AbstractEditingContextRule.loadModel(AbstractEditingContextRule.java:186)
> >>> at com.wounit.rules.AbstractEditingContextRule.<init>(AbstractEditingContextRule.java:94)
> >>> at com.wounit.rules.MockEditingContext.<init>(MockEditingContext.java:113)
> >>> at com.wounit.rules.MockEditingContext.<init>(MockEditingContext.java:124)
> >>> at com.acaiq.fondation.acaiqCore.ExempleTest.<init>(ExempleTest.java:11)
> >>> 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 org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:202)
> >>> at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:251)
> >>> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> >>> at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:248)
> >>> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
> >>> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
> >>> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> >>> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> >>> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> >>> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> >>> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> >>> at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> >>> at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
> >>> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> >>> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> >>> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> >>> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> >>> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> >>>
> >>>
> >>> Thanks,
> >>>
> >>> 2012/7/27 Henrique Prange <email@hidden>
> >>> Hi Ramsey,
> >>>
> >>> On 27/07/2012, at 17:48, Ramsey Gurley wrote:
> >>>
> >>>> My guess is you or wounit or something hasn't inited the ERXApplication class and so no models. That's just a guess though. I've never used WOUnit.
> >>>>
> >>>
> >>> The ERXApplication initialization is not required to run WOUnit test cases. The WOUnit framework is responsible for loading the required models (you have to specify the names of the required models when creating the MockEditingContext). For instance:
> >>>
> >>> @Rule
> >>> public MockEditingContext ec = new MockEditingContext("MyModel");
> >>>
> >>> This statement creates a MockEditingContext loading the model named MyModel.
> >>>
> >>>> I have a unit testing project template for junit testing frameworks on github that I use. It's modeled after the ERXTest app in wonder and has a nice little setup wizard to get you started with your first test class and suite:
> >>>>
> >>>> https://github.com/nullterminated/ponder/tree/master/Test Application Template
> >>>>
> >>>
> >>> Interesting. Thanks for sharing.
> >>>
> >>> Cheers,
> >>>
> >>> Henrique
> >>> _______________________________________________
> >>> 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
> >>>
> >>
> >>
> >> _______________________________________________
> >> 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
> >
> > --
> > Chuck Hill Senior Consultant / VP Development
> >
> > 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
> >
> >
> >
> >
> >
> >
> >
> >
>
>
> _______________________________________________
> 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
--
Chuck Hill Senior Consultant / VP Development
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
_______________________________________________
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