4 Replies Latest reply on Jul 22, 2010 7:59 AM by UIView

    Does FlexUnit4 Cache Tests? Tests Are Not Updating

    UIView

      Hi.

       

      I'm running FlexUnit4 within a Flash Builder 4 project (using Flex 3.5). The application I am testing is pure AS3. To sum it up, FlexUnit seems to be running "old" tests. If I create a Class Test, testing one function and run it with the default Assert.fail(); the test will fail. Now if I change that to Assert.assertTrue(true) and run it, the test fails and the stack trace states that I am still calling Assert.fail().

       

      Another example would be that I manually change the function name of the  test. If I refresh and choose the new function test to run, FlexUnit still  reports the prior function name as what was tested.

       

      Can someone explain what's going on and how to correct this?

       

      Thanks.

        • 1. Re: Does FlexUnit4 Cache Tests? Tests Are Not Updating
          UIView Level 1

          Let me add a VERY important piece of information. This strange behavior ONLY happens when I import the class that I want to test and declare a variable of it. Just declaring, not even using the variable in any test. As soon as I comment it out the tests properly update and pass/fail as they should.  What gives?

           

          Thanks.

          Chris

          • 2. Re: Does FlexUnit4 Cache Tests? Tests Are Not Updating
            mlabriola Level 4

            FlexUnit does not have any type of cache. It only exists in browser memory so one run doesn't have any information about the previous.

             

            The only thing that can be happening is that FlashBuilder is not rebuilding the SWF with your tests in it. Are you using the FlashBuilder FlexUnit Panel? The reason I ask is that when you do this Adobe creates a few classes on your behalf.. FlexUnitApplication.as and FlexUnitCompilerApplication.as which could be getting cached.

             

            I would suggest a full clean. Perhaps consider manually deleting things from bin-debug too. Also, you may (and yes, this sounds dumb) want to delete the html-template directory. When you do so, Flash Builder will throw errors and you will need to right click on the error and indicate that you wish to rebuild the template. I have found situations where the browser seems to be caching the HTML generated and SWF and pretty much no matter what I do it won't give it up. This helps.

             

            Those are my first thoughts but I can assure you FlexUnit itself has no ability to cache across runs.

             

            Mike

            • 3. Re: Does FlexUnit4 Cache Tests? Tests Are Not Updating
              mlabriola Level 4

              Chris,

               

              No idea. Only thing I can think of is that the app isn't building when you believe it is and somewhere there is an error. Make sure you look at the date and time stamp of the FlexUnitApplication.swf (or whatever your runner swf is if you are not using that feature of flash builder)

               

              Make sure it is really changing when you believe it is.

               

              Mike

              • 4. Re: Does FlexUnit4 Cache Tests? Tests Are Not Updating
                UIView Level 1

                Mike,

                 

                You may be correct on the SWF not building because of errors. My expectation I guess was that if there was an error and the new application SWF didn't get built that I would have seen some type of error stating so. I'll post back once I dig in a little further.

                 

                Thanks!