How to use SequenceRunner with FlexUnit 4

Hi,
I just read the Wiki page about Fluint Sequences at http://docs.flexunit.org/index.php?title=Sequences#Sequences_from_Fluint. I really would like to use sequences as it seems a great way to test flows in UI components.
So I created a first test based on the examples in the wiki. Unfortunately it does not work as I hoped.
The testcase:
package flex.filter.eventFilter.view
      import flash.events.Event;
     import mx.events.FlexEvent;
  import net.digitalprimates.fluint.tests.TestCase;
  import org.fluint.sequence.SequenceRunner;
  import org.fluint.sequence.SequenceSetter;
  import org.fluint.sequence.SequenceWaiter;
  public class RelativeDateInputFluintSequence extends TestCase
    private var form:RelativeDateInput;
    [Before(async)]
    override protected function setUp():void
      form = new RelativeDateInput();
      form.addEventListener(FlexEvent.CREATION_COMPLETE, asyncHandler (pendUntilComplete, 100), false, 0, true);
      addChild(form);
    [After(async)]
    override protected function tearDown():void
      removeChild(form);
      form = null;
    [Test(async)]
    public function testForm():void
      var passThroughData:Object = new Object();
      passThroughData.value = 5;
      passThroughData.selectedUnit = "hours";
      var sequence:SequenceRunner = new SequenceRunner(this);
      // Set time in stepper
      sequence.addStep (new SequenceSetter(form.timeStepper, {value:passThroughData.value}));
      sequence.addStep(new SequenceWaiter(form.timeStepper, FlexEvent.VALUE_COMMIT, 100));
      // Set units
      sequence.addStep (new SequenceSetter(form.unitCombo, {selectedItem:passThroughData.selectedUnit}));
      sequence.addStep(new SequenceWaiter(form.timeStepper, FlexEvent.VALUE_COMMIT, 100));
      sequence.addAssertHandler(handleFiveHoursSet, passThroughData);
      sequence.run();
    private function handleFiveHoursSet(event:Event, passThroughData:Object):void
      assertEquals(passThroughData.value * 60 * 60000, form.milliseconds);
Note that I did not add the test annotations at first as they were ommitted in the Wiki. I added these later after I got the error below.
When sequence.run() is executed I get this error:
Cannot add asynchronous functionality to methods defined by Test,Before or After that are not marked async
Error: Cannot add asynchronous functionality to methods defined by Test,Before or After that are not marked async
    at org.flexunit.async::AsyncLocator$/getCallableForTest()[C:\Users\dmoore\Documents\_Product ion\Flex Unit 4\GIT\FlexUnit4\src\org\flexunit\async\AsyncLocator.as:82]
    at org.fluint.sequence::SequenceWaiter/setupListeners()[C:\Users\dmoore\Documents\_Productio n\Flex Unit 4\GIT\FlexUnit4\src\org\fluint\sequence\SequenceWaiter.as:100]
    at org.fluint.sequence::SequenceRunner/continueSequence()[C:\Users\dmoore\Documents\_Product ion\Flex Unit 4\GIT\FlexUnit4\src\org\fluint\sequence\SequenceRunner.as:177]
    at org.fluint.sequence::SequenceRunner/run()[C:\Users\dmoore\Documents\_Production\Flex Unit 4\GIT\FlexUnit4\src\org\fluint\sequence\SequenceRunner.as:124]
    at com.hp.opr.flex.filter.eventFilter.view::RelativeDateInputFluintSequence/testForm()[/home /cschlipf/data/dev/svn/opr/components/common/flex/lib/opr-fx-common/src/test/flex/com/hp/o pr/flex/filter/eventFilter/view/RelativeDateInputFluintSequence.as:56]
    at net.digitalprimates.fluint.tests::TestCase/protect()[C:\Users\mlabriola\Documents\workspa ces\net\digitalprimates\opensource\flexunit\fluint\fluint\src\main\flex\net\digitalprimate s\fluint\tests\TestCase.as:315]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at net.digitalprimates.fluint.tests::TestCase/executeMethodWhileProtected()[C:\Users\mlabrio la\Documents\workspaces\net\digitalprimates\opensource\flexunit\fluint\fluint\src\main\fle x\net\digitalprimates\fluint\tests\TestCase.as:370]
    at net.digitalprimates.fluint.tests::TestCase/runTestMethod()[C:\Users\mlabriola\Documents\w orkspaces\net\digitalprimates\opensource\flexunit\fluint\fluint\src\main\flex\net\digitalp rimates\fluint\tests\TestCase.as:160]
    at net.digitalprimates.fluint.ui::TestRunner/runTestMethod()[C:\Users\mlabriola\Documents\wo rkspaces\net\digitalprimates\opensource\flexunit\fluint\fluint\src\main\flex\net\digitalpr imates\fluint\ui\TestRunner.as:361]
    at net.digitalprimates.fluint.ui::TestRunner/handleTestProcess()[C:\Users\mlabriola\Document s\workspaces\net\digitalprimates\opensource\flexunit\fluint\fluint\src\main\flex\net\digit alprimates\fluint\ui\TestRunner.as:393]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at net.digitalprimates.fluint.tests::TestCase/handleAsyncEventFired()[C:\Users\mlabriola\Doc uments\workspaces\net\digitalprimates\opensource\flexunit\fluint\fluint\src\main\flex\net\ digitalprimates\fluint\tests\TestCase.as:267]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at net.digitalprimates.fluint.async::AsyncHandler/handleEvent()[C:\Users\mlabriola\Documents \workspaces\net\digitalprimates\opensource\flexunit\fluint\fluint\src\main\flex\net\digita lprimates\fluint\async\AsyncHandler.as:166]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.5.0\frameworks\projects\framework\src \mx\core\UIComponent.as:9440]
    at mx.core::UIComponent/set initialized()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as :1168]
    at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.5.0\frameworks\projects \framework\src\mx\managers\LayoutManager.as:718]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.5.0\frameworks\projects\framew ork\src\mx\core\UIComponent.as:8744]
    at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.5.0\frameworks\projects\framewo rk\src\mx\core\UIComponent.as:8684]
So my guess is that the SequenceRunner is not fully compatible with FlexUnit 4 as asyncronous calls that are internal to the SequenceRunner are not marked as async.
Best regards,
Carsten

If you are interested, I solved it with the TestCase class in the flexunit.framework package:
package com.soma.core.tests.suites.commands {
    import flexunit.framework.TestCase;
    import flash.events.Event;
    import com.soma.core.tests.suites.support.TestSequenceCommand;
    import mx.core.FlexGlobals;
    import flash.display.Stage;
    import com.soma.core.tests.suites.support.TestAsyncCommand;
    import com.soma.core.tests.suites.support.TestEvent;
    import com.soma.core.Soma;
     * <b>Author:</b> Romuald Quantin - <a href="http://www.soundstep.com/" target="_blank">www.soundstep.com</a><br />
     * <b>Class version:</b> 1.0<br />
     * <b>Actionscript version:</b> 3.0<br />
     * <b>Date:</b> Oct 10, 2010<br />
     * @example
     * <listing version="3.0"></listing>
    public class SequenceTestCaseSuccess extends TestCase {
        // private, protected properties
        private var _soma:Soma;
        private var _count:int;
        private static var _stage:Stage;
        // public properties
        // constructor
        public function SequenceTestCaseSuccess() {
        // PRIVATE, PROTECTED
        override public function setUp():void {
            _stage = FlexGlobals.topLevelApplication.stage;
            _count = 0;
            _soma = new Soma(_stage);
            _soma.addCommand(TestEvent.TEST, TestAsyncCommand);
            _soma.addCommand(TestEvent.TEST_SEQUENCE, TestSequenceCommand);
        override public function tearDown():void {
            var command:TestAsyncCommand = _soma.getCommand(TestEvent.TEST) as TestAsyncCommand;
            if (command) command.dispose();
            _soma.removeEventListener(TestEvent.TEST_ASYNC_COMPLETE, testSequenceHandler);
            _soma.dispose();
            _soma = null;
        // PUBLIC
        public function testSequence():void {
            _soma.addEventListener(TestEvent.TEST_ASYNC_COMPLETE, addAsync(testSequenceHandler, 500));
            _soma.dispatchEvent(new TestEvent(TestEvent.TEST_SEQUENCE));
        private function testSequenceHandler(event:TestEvent):void {
            _soma.removeEventListener(TestEvent.TEST_ASYNC_COMPLETE, testSequenceHandler);
            if (++_count < 5) {
                _soma.addEventListener(TestEvent.TEST_ASYNC_COMPLETE, addAsync(testSequenceHandler, 500));
            else {
                _soma.addEventListener(TestEvent.TEST_SEQUENCE_COMPLETE, addAsync(testSequenceCompleteHandler, 100));
            trace("TestSequenceCommand: step", _count + "/5");
        private function testSequenceCompleteHandler(event:TestEvent):void {
            assertNull(_soma.getLastSequencer());
            assertEquals(_soma.getRunningSequencers().length, 0);
            assertNull(_soma.getSequencer(Event(event.data)));

Similar Messages

  • How to use Terminal with KeySpan USB serial adaptor cable?

    I own a KeySpan model USA-19HS to use with our MacBookPro when working on clients networking equipment that require serial communication. I have used ZTerm with excellent luck, but it costs, and is yet another application that I dont really want. I would like to know if any one out there has exacing instructions on how to use Terminal with this adaptor. If I could write a file that had, say, the couple most common settings (9600-8-n-1, 57600-8-n-1, et cetera) that I could simply click on, to open a new Terminal window with those settings, then simply close that, and open a new window (apple+n) in order to get back to a default settings terminal window. All feedback is most appreciated.
    Thanks so much, Jason Sjobeck

    Hi, Jason. Welcome to the Discussions.
    You wrote: "All feedback is most appreciated."OK.
    1. Have you considered discussing this with Keyspan Support?
    2. Have you read the section "OSX has Terminal.app - why do I need ZTerm?" on the ZTerm Home Page? That seems to explain why one needs an app like ZTerm.
    3. A quick search of Keyspan's FAQ for your product and terminal doesn't yield much more than how to find the serial ports using Terminal.
    Likewise, this Google search also yields little, and variants of that search of such weren't particularly help either.
    It appears your inquiry seems to be a somewhat esoteric topic.
    4. Apparently, ZTerm X is a bit long in the tooth and there's no Universal Binary for it. It sounds, however, like you've tried it running on your MBP under Rosetta, yes?
    5. In researching alternatives to ZTerm for you, I note the followng:• The comment from "Reverb" on this page suggests C-Kermit or Kermit as a free alternative.
    • This tip on Mac OS X Hints cites Minicom as another option.6. You may want to try your question on the Unix Discussion.
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X

  • How to use variables with

    I need to get the number of lines in internal table, which would
    be easy, using DESCRIBE TABLE itab LINES lines. But the problem
    is, that I get the name of this internal table in the field of
    another internal table, so I have to use the name of internal
    table as variable, but I don't know how to use variables with
    DESCRIBE TABLE (or if this is possible).

    Hi,
    REPORT ZPRUEBA782 .
    define two tables with diferent structures.
    data: begin of table1 occurs 0,
    registro type i,
    end of table1.
    data: begin of table2 occurs 0,
    registro type i,
    repid like sy-repid,
    end of table2.
    data: rows type i.
    start-of-selection.
    fill them with data
    do 1000 times.
    table1-registro = sy-tabix.
    append table1.
    enddo.
    do 1757 times.
    table2-registro = sy-tabix.
    table2-repid = sy-repid.
    append table2.
    enddo.
    call a form that receives as input the table and returns the number
    of rows as output.
    perform howmanyrows tables table2 changing rows.
    break-point. "evaluate the number of rows
    perform howmanyrows tables table1 changing rows.
    break-point. "evaluate the number of rows
    end-of-selection.
    form howmanyrows tables itable changing rows.
    rows = 0.
    loop at itable.
    add 1 to rows.
    endloop.
    endform.
    You can try it if you don't find a better solution.
    Cheers,
    Chaitanya.

  • How to Use Gmail With Apple's Mail?

    Answer:
    Now Itis not a Problem, Please go to this link and know how to solve this problem, Ihave configuir this in my mac pro. Have enjoy.
    http://picturemuseum.blogspot.com/2011/08/how-to-use-gmail-with-apple-mail.html
    http://mobilesuggestion.blogspot.com/2011/08/how-to-use-gmail-with-apples-mail.h tml

    I notice that it's possible to have sticky posts in these forums. See
    http://forum.java.sun.com/forum.jspa?forumID=534
    the Concurrency forum for an example. Posting a link to the FAQ in a sticky post might reduce the number of FAQs asked here by maybe 1%? Or posts like this one might do well as a sticky?

  • How to use Count with Date Parameters

    Hello,
    I am having issues using the Count() function in conjunction with date parameters.
    This is a Siebel report and in my report I have 2 date parameters(From Date, To Date). In a nutshell I am basically trying to count Opportunities that has a start date within the given date period. However I don't see a reasonable way to put my date parameters within the Count() function. The reason being is that I need to have a huge chunk of code to convert the dates into a common format that can be compared, and it won't even fit within the code block in my rtf template. I am not even sure how to put multiple conditional statements inside a Count() function since all the examples I have seen are very simple.
    Anyone have a suggestion on how to use Count() with date parameters?
    Thanks.

    Any chance you can get the date formats in the correct format from siebel?
    I don't know Siebel - so I can't help you with that. If you get the correct format it is just
    <?count(row[(FromDate>=date) and  (date<=ToDate))?>
    Otherwise the approach would probably need to use string function to get year/monthd/day from the date
    and store it into a varialbe and compare later the same way
    <?variable@incontext:from; ....?>
    <?variable@incontext:to; ...?>
    <?count(row[($from>=date) and  (date<=$to))?>
    Potentially you can use the date functions such as xdofx:to_date to do the conversion
    [http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12187/T421739T481158.htm]
    But I am not sure if they are available in your siebel implementation.
    Hope that helps

  • How to use javap with jar files ?

    how to use javap with jar files ?
    thanks

    As long as the jar is on the class path, your gold. So,
    javap -classpath myjar.jar mypackage.MyClass
    Chuck

  • Help me!! How to use JavaScript with JSP ??

    I am using JDeveloper and I created a screen in JSP which uses a bean for database connectivity and retriving info onto the page.
    The page has a ListBox where list items are populated from the database.My requirement is
    whenever the list is changed the page shuold be refreshed with the selected item info.
    I tried to use 'JavaScript' for triggering the event with 'onChange' event of the ListBox.But the event is not getting invoked. I think JavaScript is not working with JSP.
    Please help me with how to Use javaScript with JSP or any other alternative where I can meet my requirement.
    I have one more question...I have gone through the JSP samples in OTN and I am trying do download the sample 'Travel servlet' which show list of countries...etc
    I have also gone through the 'readme' but I don't know how to extract .jar file.
    I would be great if you could help me in this.
    Thanks!!
    Geeta
    null

    We have a similar need. We have used Cold Fusion to display data from Our Oracle Database. We have a simple SElect Box in HTML populated with the oracle data. When someone selects say the State of Pennsylvania. then we have an On change event that runs a Javascript to go get all the cities in Pennsylvania.
    Proble we are having is that inorder for the Javascript to work , we currently have to send all the valid data.
    Do you know of any way to dynamically query the the Oracle database in Javascript

  • How to use log4net with C# clients

    Hi,
    Can anybody please give an example of how to use log4net with C# clients? Foe java clients you can use the
    <logging-config>
    <destination>log4j</destination>
    How do we use it with C# clients? Any example will be appreciated.
    Thanks.
    -ali

    Ali,
    The following is an example on how to define a custom logger (including log4net) in tangosol-coherence-override.xml for coherence .NET client; you need Coherence .NET client 3.7.1 patch 1.
    <coherence xmlns="http://schemas.tangosol.com/coherence">
    <logging-config>
    <destination>common-logger</destination>
    <logger-name>log4net</logger-name>
    <severity-level>9</severity-level>
    <message-format>(thread={thread}): {text}</message-format>
    <character-limit>8192</character-limit>
    </logging-config>
    </coherence>
    You also need to configure log4net in app.config. Please see the following web page for more information:
    http://netcommon.sourceforge.net/docs/2.0.0/reference/html/ch01.html
    -Luk

  • How to use assert with wireless toolkit?

    Hi,
    I am trying to find out how to use assert with wireless toolkit. I have found that I need to pass "-source 1.4" to the java compiler. But I can't find any documentation on how to do it.
    I'm using J2ME Wireless Toolkit 2.2.
    thanks
    Ludde

    Here's a quote from an article on Java World at http://www.javaworld.com/javaworld/jw-11-2001/jw-1109-assert.html
    "To support the new assertion facility in J2SE 1.4, the Java platform adds the keyword assert to the language, an AssertionError class, and a few additional methods to java.lang.ClassLoader."
    So I really think it's part of 1.4.

  • How to use setSoTimeOut() with socket ??

    HI All!
    I eagerly need to know how to use setSoTimeOut() with socket (on server side).
    Actually the scenario is that My Server accepts connection and waits for connected client to send data to it. I WANT TO KEEP, IF CLIENT DOENS'T SENDS ANY DATA TO SERVER WITHIN 5 min. THEN SERVER MUST CLOSE THE CONNECTION, BUT IF SERVER RECEIVES STILL A BYTE FROM THE CLIENT WITHIN 5 mins., THE SERVER MUST RESET CHECKING TIME OUT FOR NEXT 5 MINUTES.
    How can i do that??
    Any help with example will be appreciated!!
    Thanx in advance

    you'd have to do something like this:
    (this is all assuming you want to read Strings from the socket. setSoTimeout works for any read() call to the InputStream associated with the Socket)
    ServerSocket ss = new ServerSocket(myPort);
    Socket s = ss.accept();
    s.setSoTimeout(5*60*1000); // 5 mins * 60 secs * 1000ms
    BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream()));
    boolean running = true;
    while(running)
    try
    String readIn = in.readLine();
    // do whatever you want with the data read
    catch(SocketTimeoutException)
    running = false;
    Now. That's what I think needs to be done. I don't have Java on the machine I'm currently on, so I can't test/verify it, but it goes something like that.
    Good luck,
    Radish21

  • How to use I18N with a custom validator?

    This is my custom validator:
        public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
            Pattern pat=Pattern.compile(".+@.+\\.[a-z]+");
            Matcher m= pat.matcher(value.toString());
            if(!m.find())
                FacesMessage message = new FacesMessage("Not a valid e-mail address");
                throw new ValidatorException(message);
        }Instead of providing the text "Not a valid e-mai address", I'd like to get the text out of my ApplicationResources property file.
    How can I do this?
    I know how to use it with the provided validators, but not with own custom ones
    Please help me out, thanks

    I found a solution for this problem, I don't know it's best practice but here it is :
        public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
            String errortext;
            Pattern pat=Pattern.compile(".+@.+\\.[a-z]+");
            Matcher m= pat.matcher(value.toString());
            if(!m.find())
                ResourceBundle bundle =
                ResourceBundle.getBundle("be.vdab.resources.ApplicationResources", context.getViewRoot().getLocale());
                errortext = bundle.getString("erroremail");
                FacesMessage message = new FacesMessage(errortext);
                throw new ValidatorException(message);
        }

  • How to use x264 with FCPX

    I used the automatic installer for x264.
    There were no instructions on how to use it with FCPX or compressor.
    Can someone offer a tip?
    Thanks
    10.6.8
    iMac 2009,1

    Youn can't use it in FCP, only with Compressor. In Compressor make a new QuickTime preset or duplicate an Apple preset and change the codec to x264.

  • How to use stylus with ipad2

    Just bought a stylus for taking notes but do not know how to use it with the ipad2? Some special apps required?
    Thanks!

    Take a look at Memo, Penultimate, and Draw Pad to name a few. Several in the app store.But you do need an app that will accept input using a stylus or your finger rather than the keyboard. Several art/drawing programs are available as well.

  • How to use Skype with FaceTime with iMac,iPad & iPhone?

    How to use Skype with FaceTime with iMac,iPad & iPhone?

    Skype does not interface with FaceTime. You cannot use one to contact a person who is using the other.

  • Need an example how to use SCAN_Start with a callback function

    I would appreciate if someone helps me with a working example of how to use SCAN_Start with a callback function. I need just a basic functionality: to specify a channel list (with gains probably), to start a data acquisition task and to receive data buffers utilizing a callback function. t this time whatever I was trying to do caused computer hangups, though it is supposed to be one of the most regular tasks to perform.
    Thank you in advance,
    Mike

    Hello Mike,
    Thank you for contacting National Instruments.
    Attached is an example project which uses a callback function to begin analog acquisition (AI) by calling SCAN_Start. This project acquires from the first 2 channels on your DAQ device. Make sure to modify the device number in the code to match the number of your card.
    Let me know if you have any further questions...
    Sincerely,
    Sean C.
    Applcications Engineer
    National Instruments
    Attachments:
    Acquire_multichannel_61xx.zip ‏11 KB

Maybe you are looking for

  • Authentication in Client/Server form Application

    Hi My client/server application is not using oracle authentiacation, I have maintained user table from that user is authenticated, but any user logins in a application it uses same oracle username/PWD which I currently hardcoded in a forms 6i (C/S ty

  • Flex and AIR

    After I upgraded to AIR 1.5, I had some issues with my project lauching. A search on the Internet turned up that I had to change the name space line of code in the .xml file. This line <application xmlns=" http://ns.adobe.com/air/application/1.5"> ne

  • Once more about "black" and "white" file lists.

    Hello everyone! I've got a task to find all unauthorized  executables on all workstations in domain. The good point is that workstations are identical to each other (both hard and soft), bad point is that I have to find the existence of this files on

  • Caching of adhoc queries=filesystem sometimes at 100%

    WLS_PRODUCT_VERSION=10.3.6.0 OS: Red Hat Linux 5 DB: 11.2.0.2.0 OBIEE: 11.1.1.6.2 Hello. When someone runs a silly query via OBIEE we sometimes see .TMP files that have ranged in silly sizes (up to 25GB!) We have been caught by this as the growth is

  • New user. how to make the screen lighter so I can see it easily

    I am new to firefox. An update was done to the computer and now the screen on my laptop is not lighted well enough to see. How can I fix this. I am sure it is simple if you will tell me what to do.