|
From: Paul B. <eye...@gm...> - 2006-06-20 16:27:15
|
Hello, me again - I have another situation, that Im not sure if anyone has come across / solved? I need to be able to run a test whose result is asynchronous. This is not necessarily the same as an asynchronous setup, so I dont really want to be overriding run (which is what i normally do with an async test...) has anyone done this, got a strategy for doing this in ASUnit (3)? ta PBH |
|
From: Alias <ali...@gm...> - 2006-06-20 17:30:34
|
Hi Paul! Why can't you override run? Where does the result come from? Cheers, Alias On 6/20/06, Paul BH <eye...@gm...> wrote: > Hello, > me again - I have another situation, that Im not sure if anyone has > come across / solved? > > I need to be able to run a test whose result is asynchronous. This is > not necessarily the same as an asynchronous setup, so I dont really > want to be overriding run (which is what i normally do with an async > test...) > > has anyone done this, got a strategy for doing this in ASUnit (3)? > > ta > > PBH > > > _______________________________________________ > Asunit-users mailing list > Asu...@li... > https://lists.sourceforge.net/lists/listinfo/asunit-users > |
|
From: Paul B. <eye...@gm...> - 2006-06-20 17:56:55
|
Hi matey - long time no chat... I use async tests for testing method calls that you expect to trigger an event at some time in the future.So lets say for example that I have a class that takes some xml, does some shizzle with it and broadcasts an event when its done. I would use standard overriding of run to load the xml - so far so good, but testing that this class dispatches an event when parseMyStuff gets called is a testMethod specific async case. there may be another test method within the same testCase that sends its result immediately, and I certainly wouldnt want to call parseMyStuff in the setup (as its specific to just one test) make sense, or am i just rambling? PBH On 6/20/06, Alias <ali...@gm...> wrote: > Hi Paul! > > Why can't you override run? Where does the result come from? > > Cheers, > Alias > > On 6/20/06, Paul BH <eye...@gm...> wrote: > > Hello, > > me again - I have another situation, that Im not sure if anyone has > > come across / solved? > > > > I need to be able to run a test whose result is asynchronous. This is > > not necessarily the same as an asynchronous setup, so I dont really > > want to be overriding run (which is what i normally do with an async > > test...) > > > > has anyone done this, got a strategy for doing this in ASUnit (3)? > > > > ta > > > > PBH > > > > > > _______________________________________________ > > Asunit-users mailing list > > Asu...@li... > > https://lists.sourceforge.net/lists/listinfo/asunit-users > > > > > _______________________________________________ > Asunit-users mailing list > Asu...@li... > https://lists.sourceforge.net/lists/listinfo/asunit-users > |
|
From: Alias <ali...@gm...> - 2006-06-20 18:02:41
|
Aha, yeah, that's the same problem I had. Have you tried adding a listener in your test, to listen for that event, then trigger the run function? Alias On 6/20/06, Paul BH <eye...@gm...> wrote: > Hi matey - long time no chat... > > I use async tests for testing method calls that you expect to trigger > an event at some time in the future.So lets say for example that I > have a class that takes some xml, does some shizzle with it and > broadcasts an event when its done. > > I would use standard overriding of run to load the xml - so far so > good, but testing that this class dispatches an event when > parseMyStuff gets called is a testMethod specific async case. there > may be another test method within the same testCase that sends its > result immediately, and I certainly wouldnt want to call parseMyStuff > in the setup (as its specific to just one test) > > make sense, or am i just rambling? > > PBH > > On 6/20/06, Alias <ali...@gm...> wrote: > > Hi Paul! > > > > Why can't you override run? Where does the result come from? > > > > Cheers, > > Alias > > > > On 6/20/06, Paul BH <eye...@gm...> wrote: > > > Hello, > > > me again - I have another situation, that Im not sure if anyone has > > > come across / solved? > > > > > > I need to be able to run a test whose result is asynchronous. This is > > > not necessarily the same as an asynchronous setup, so I dont really > > > want to be overriding run (which is what i normally do with an async > > > test...) > > > > > > has anyone done this, got a strategy for doing this in ASUnit (3)? > > > > > > ta > > > > > > PBH > > > > > > > > > _______________________________________________ > > > Asunit-users mailing list > > > Asu...@li... > > > https://lists.sourceforge.net/lists/listinfo/asunit-users > > > > > > > > > _______________________________________________ > > Asunit-users mailing list > > Asu...@li... > > https://lists.sourceforge.net/lists/listinfo/asunit-users > > > > > _______________________________________________ > Asunit-users mailing list > Asu...@li... > https://lists.sourceforge.net/lists/listinfo/asunit-users > |
|
From: Chris A. <mrc...@gm...> - 2006-06-20 18:04:53
|
On 6/20/06, Alias <ali...@gm...> wrote: > Hi Paul! > > Why can't you override run? Where does the result come from? > Overriding run() means that he would have to have one TestCase per test. This is not a great option for all cases.We are doing similar things with the AssetLoader classes in the Fling project. Feel free to take a look at the test package there to get an idea of what we are doing: http://svn1.cvsdude.com/osflash/fling/DEV_Source/classes/org/osflash/fling/tests/ In addition, keep in mind that you can still do assertions outside of a testMethod() and you don't have to override run either. Take a look at AssetLoaderTest.as for an example of this. This is more along the lines of what you were asking I believe. I hope this helps a little. -Chris > On 6/20/06, Paul BH <eye...@gm...> wrote: > > Hello, > > me again - I have another situation, that Im not sure if anyone has > > come across / solved? > > > > I need to be able to run a test whose result is asynchronous. This is > > not necessarily the same as an asynchronous setup, so I dont really > > want to be overriding run (which is what i normally do with an async > > test...) > > > > has anyone done this, got a strategy for doing this in ASUnit (3)? > > > > ta > > > > PBH > > > > > > _______________________________________________ > > Asunit-users mailing list > > Asu...@li... > > https://lists.sourceforge.net/lists/listinfo/asunit-users > > > > > _______________________________________________ > Asunit-users mailing list > Asu...@li... > https://lists.sourceforge.net/lists/listinfo/asunit-users > |
|
From: Alias <ali...@gm...> - 2006-06-20 18:07:31
|
Wouldn't it be possible to modify the testcase framework to execute different run methods depending on which test is running? Alias On 6/20/06, Chris Allen <mrc...@gm...> wrote: > On 6/20/06, Alias <ali...@gm...> wrote: > > Hi Paul! > > > > Why can't you override run? Where does the result come from? > > > Overriding run() means that he would have to have one TestCase per > test. This is not a great option for all cases.We are doing similar > things with the AssetLoader classes in the Fling project. Feel free to > take a look at the test package there to get an idea of what we are > doing: > http://svn1.cvsdude.com/osflash/fling/DEV_Source/classes/org/osflash/fling/tests/ > > In addition, keep in mind that you can still do assertions outside of > a testMethod() and you don't have to override run either. Take a look > at AssetLoaderTest.as for an example of this. This is more along the > lines of what you were asking I believe. > > I hope this helps a little. > > -Chris > > > On 6/20/06, Paul BH <eye...@gm...> wrote: > > > Hello, > > > me again - I have another situation, that Im not sure if anyone has > > > come across / solved? > > > > > > I need to be able to run a test whose result is asynchronous. This is > > > not necessarily the same as an asynchronous setup, so I dont really > > > want to be overriding run (which is what i normally do with an async > > > test...) > > > > > > has anyone done this, got a strategy for doing this in ASUnit (3)? > > > > > > ta > > > > > > PBH > > > > > > > > > _______________________________________________ > > > Asunit-users mailing list > > > Asu...@li... > > > https://lists.sourceforge.net/lists/listinfo/asunit-users > > > > > > > > > _______________________________________________ > > Asunit-users mailing list > > Asu...@li... > > https://lists.sourceforge.net/lists/listinfo/asunit-users > > > > > _______________________________________________ > Asunit-users mailing list > Asu...@li... > https://lists.sourceforge.net/lists/listinfo/asunit-users > |
|
From: Luke B. <lb...@gm...> - 2006-06-20 18:13:58
|
Don't forget that there's a big difference between asynchronous and event-driven. The synchronous test runner should support testing event-driven functionality. Occasionally, we have to build a mock object that subclasses the "class under test" and exposes the event triggering features as a test-only interface. I have often found that when I'm doing this, what I am actually testing is the EventDispatcher, not the features that I'm really interested in. But it does make sense in some cases. Usually, I will just subscribe to the event I'm interested in, change the state of the object in the test method, and call "fail()" in my event handler if the state is not expected. This should unwind properly to the output. Writing multiple test methods that work asynchronously is quite a bit more complicated with AsUnit3 because we built it over JUnit which uses exceptions to manage test status. Because of this, once we're executing a test method, we need to unwind the same thread in order to get valid results. I haven't checked out the stuff chris and others have posted, but I hope that helps. Thanks, Luke www.asunit.org |
|
From: Paul B. <eye...@gm...> - 2006-06-20 18:15:09
|
Hi Chris,
I'll take a look at this and see how you've gone about it... I'm
actually in the middle of comparing flexunit & ASUnit to see how they
compare - I have to admit I really like that flexunit has this
functionality already availible. The thing is , I also really like the
lightweightness of asunit, and that it is decoupled from the flex
framework (and the more enthusiastic community)
Even though I found I could assert outside of a test (ie in a
callback), the problem is that my testRunner needs to know when my
test suite has completed running, and this 'complete' gets triggered
early as the following trace shows (testrunneroutput gets printed when
all tests have completed, but *after* this, we get an assert Failing
that is triggered by my asynchronous call:
[SWF] C:\Documents and Settings\a384513\My
Documents\projects\ASUnitTest\bin\ASUnitTest-debug.swf - 429,357 bytes
after decompression
-----------------TESTRUNNEROUTPUTBEGINS----------------
<testsuites>
<testsuite name="com.fmr.asunitTests::SimpleTestClassTest">
<testcase name="testToFarenheight" time="0.002"/>
<testcase name="testToCelsius" time="0"/>
</testsuite>
<testsuite name="com.fmr.asunitTests::AsyncTestClassTest">
<testcase name="testInvokeAsync" time="0.001"/>
</testsuite>
</testsuites>
Test Suite success: true
-----------------TESTRUNNEROUTPUTENDS----------------
callback
AssertionFailedError
at asunit.framework::Assert$/fail()[C:\Documents and
Settings\a384513\My
Documents\asunit\as3\asunit\framework\Assert.as:68]
at asunit.framework::Assert$/assertTrue()[C:\Documents and
Settings\a384513\My
Documents\asunit\as3\asunit\framework\Assert.as:39]
at ()[C:\Documents and Settings\a384513\My
Documents\projects\ASUnitTest\com\fmr\asunitTests\AsyncTestClassTest.as:40]
at flash.events::EventDispatcher/dispatchEvent()
at com.fmr.testClasses::AsyncTestClass/timerHandler()[C:\Documents
and Settings\a384513\workspace\SampleTests\com\fmr\testClasses\AsyncTestClass.as:25]
at flash.utils::Timer/flash.utils:Timer::tick()
I suspect that your approach would have the same issue chris?
thx
PBH
On 6/20/06, Chris Allen <mrc...@gm...> wrote:
> On 6/20/06, Alias <ali...@gm...> wrote:
> > Hi Paul!
> >
> > Why can't you override run? Where does the result come from?
> >
> Overriding run() means that he would have to have one TestCase per
> test. This is not a great option for all cases.We are doing similar
> things with the AssetLoader classes in the Fling project. Feel free to
> take a look at the test package there to get an idea of what we are
> doing:
> http://svn1.cvsdude.com/osflash/fling/DEV_Source/classes/org/osflash/fling/tests/
>
> In addition, keep in mind that you can still do assertions outside of
> a testMethod() and you don't have to override run either. Take a look
> at AssetLoaderTest.as for an example of this. This is more along the
> lines of what you were asking I believe.
>
> I hope this helps a little.
>
> -Chris
>
> > On 6/20/06, Paul BH <eye...@gm...> wrote:
> > > Hello,
> > > me again - I have another situation, that Im not sure if anyone has
> > > come across / solved?
> > >
> > > I need to be able to run a test whose result is asynchronous. This is
> > > not necessarily the same as an asynchronous setup, so I dont really
> > > want to be overriding run (which is what i normally do with an async
> > > test...)
> > >
> > > has anyone done this, got a strategy for doing this in ASUnit (3)?
> > >
> > > ta
> > >
> > > PBH
> > >
> > >
> > > _______________________________________________
> > > Asunit-users mailing list
> > > Asu...@li...
> > > https://lists.sourceforge.net/lists/listinfo/asunit-users
> > >
> >
> >
> > _______________________________________________
> > Asunit-users mailing list
> > Asu...@li...
> > https://lists.sourceforge.net/lists/listinfo/asunit-users
> >
>
>
> _______________________________________________
> Asunit-users mailing list
> Asu...@li...
> https://lists.sourceforge.net/lists/listinfo/asunit-users
>
|
|
From: Chris A. <mrc...@gm...> - 2006-06-20 18:52:13
|
On 6/20/06, Paul BH <eye...@gm...> wrote: > Even though I found I could assert outside of a test (ie in a > callback), the problem is that my testRunner needs to know when my > test suite has completed running, and this 'complete' gets triggered > early as the following trace shows (testrunneroutput gets printed when > all tests have completed, but *after* this, we get an assert Failing > that is triggered by my asynchronous call: > > > > I suspect that your approach would have the same issue chris? > Yeah, Mine would have the same exact problem. We need a way to trigger the complete event manually. Then we would be able to do this properly. I will take a look at an approach for this soon, as I will also need this behaivior at some point, once I have figured out how to keep the process of the Flash player running in OSX. See my posts on the osflash.org list if you are curious about that. -Chris |
|
From: erixtekila <eri...@gm...> - 2006-06-20 22:01:46
|
Le 20 juin 06, =E0 20:52, Chris Allen a =E9crit : > once I have figured out how to keep the > process of the Flash player running in OSX. See my posts on the > osflash.org list if you are curious about that. Any progress on this, Chris ? ----------- erixtekila http://blog.v-i-a.net/ |
|
From: Chris A. <mrc...@gm...> - 2006-06-21 18:16:03
|
On 6/20/06, erixtekila <eri...@gm...> wrote: > > Le 20 juin 06, =E0 20:52, Chris Allen a =E9crit : > > > once I have figured out how to keep the > > process of the Flash player running in OSX. See my posts on the > > osflash.org list if you are curious about that. > > Any progress on this, Chris ? > Unfortunately no. I haven't had a lot of time to devote to it either. My thoughts were to try wrapping it in something like Screenweaver to keep hold of the process. Unfortunately, there's no Mac version of that yet, so not a good option yet. The other approach is to simply let the flash player process end and keep the socket server up and running. Then have the test case trigger the complete event, send that to the socket server, then it can finish the rest of the Ant task. This should work, but seems like a lot to manage. Any thoughts or suggestions. -Chris |