5 Replies Latest reply on Jun 7, 2009 11:38 PM by RaniKumar

    unit tests with ant (FB4 beta)?

    progenitor01

      Since flexunit is integrated with FB4, I was wondering how to run unit tests with ant on FB4 (using 3.4 sdk). In my current ant build file, the <mxmlc> and <compc> tags both work but the tag <flexunit> does not seem to work anymore (it worked on FB3 with flexunit download). So is there anyway currently to run unit tests on FB4 using ant?

        • 1. Re: unit tests with ant (FB4 beta)?
          progenitor01 Level 1

          The error I'm getting is flexunit is not defined.

          • 2. Re: unit tests with ant (FB4 beta)?
            progenitor01 Level 1

            nvm I figured it out. On a side note, what's the command that FB4 use to create the FlexUnitApplication.swf when you right click and select execute FlexUnit tests

            • 3. Re: unit tests with ant (FB4 beta)?
              Jason San Jose Adobe Employee

              Just curious, but what did you figure out? Did you have another plugin or other Eclipse customization that was providing the Ant task?

               

              "Execute FlexUnit Tests" is performing the code generation internally. It's not using any SDK or 3rd party provided command (like Ant?). Did I understand the question correctly?

               

              Jason San Jose

              Quality Engineer, Flash Builder

              • 4. Re: unit tests with ant (FB4 beta)?
                progenitor01 Level 1

                So if I want to run a bunch of unit tests and output it to a file if there's an error using ant which tool should I use? Flash player debugger? Because what I'm trying to do is continuous integration on a server that continuously tests the code and emails the developer if one of the unit tests fail.

                • 5. Re: unit tests with ant (FB4 beta)?
                  RaniKumar Level 2

                  Hi,

                  Let us take your requirements as separate two requriements.

                   

                  1. Using the flexunit ant task - I think for this you needed a separate ant library to support this. So this may be missing in the ant available with FB. May be you can analyse this and add on your own and try out.

                   

                  2. Debuggin the results.

                  Now FlexBuilder has the feature inbuilt as part of the IDE which provides more featuers like , source naviagation, rerunnig , saving results loading results etc.FlexBuilder uses its own set up to show the results details in IDE.

                  Currently other than using the feature in FB, there is no way to debug the results of the tests. However if you would like to get the tests to be run by ant task, and analyse the results, the following can be used.

                   

                  Option 1 : Run outside FB, show and analyse results in FB

                  a. Use the FB, create some sample testCases in FB.

                  b. Use 'Execute FlexUnit tests' from the run,  or debug launcher

                  c. Use the option Save configuration. This will get the configuration as xml or mxml file. You can use this file template and generate your test cases (may be you will configure your tests in a testSuite class and always use that as the input to the application, so that application syntax never changes). If you run the mxml created swf  (whch you can do by the simple ant tasks which does not use the flexunit task ) out side FlexBuilder and if the FlexBuilder is open, you can still see the results in the FB and analyse the results. (You need the library which is used by the FB to use the classes. You can get the location of swc file by inspecting the library path of a project in which you have added the testCase or testSuite class using the FB IDE)

                   

                  Option2:Run outside FB and  Analyse the results in FB.

                  If you have the project for which you have run the tests, and you have the XML results of the run, you can still analyse the results in the FlexBuilder.

                  a. Ensure that the report is in the required syntax of FB. (we have tried to use the similar syntax as that of the JUnit resutl report)

                  b. Use FB, load your project, open the FlexUnit result view, use the open result option in the FB. This should load the XML in FB (we have only ensured to open the result files which were created using FB ,back in the result view. So if you are facing some issue in opening your XML, you can refer the required syntax by saving a sample run result from FB)

                   

                  Option 3: Run and analyse the results in FB.

                  a. Have the input setup mentioned to FB. (If you would like to integrate changes, have a suite class which will take care of this and mention in the Execute FlexUnit tests to use this suite class. But there is no way to specify to run the FB commands outside FB.)

                  b. So whenever you would like to anlyse the tests, you need to run your test in FB and then analyse the results shown in result view.

                   

                  Please let me know whether this is what you are looking for.

                   

                  Thanks,

                  Rani