Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8982697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:38:41+00:00 2026-06-15T20:38:41+00:00

I just start to study Unit Testing (using FlexUnit). I still have not sure

  • 0

I just start to study Unit Testing (using FlexUnit). I still have not sure how to use them.

I created a new flex project, and created a class named Car. Then, I created a TestCase class, for Car class.

This is the default template that FlexBuilder gave to me, and I put some traces.

package flexUnitTests
{
    import flexunit.framework.Assert;

    public class CarTest
    {       
        [Before]
        public function setUp():void
        {
            trace('before test function');
        }

        [After]
        public function tearDown():void
        {
            trace('after test function');
        }

        [BeforeClass]
        public static function setUpBeforeClass():void
        {
            trace('before test class');
        }

        [AfterClass]
        public static function tearDownAfterClass():void
        {
            trace('after test class');
        }

        [Test]
        public function testCar():void
        {
            trace('the test function');

            var c:Car = new Car("gol");

            Assert.assertTrue("Is car name valid:", c.name != "gol");
        }
    }
}

I can’t understand why I have so many methods to run before or after a test function. Why not just use them within a simple funcion, like:

        [Test]
        public function testCar():void
        {
            trace('before test class');
            trace('before test function');

            trace('the test function');

            var c:Car = new Car("gol");

            Assert.assertTrue("Is car name valid:", c.name != "gol");

            trace('after test function');
            trace('after test class');
        }

A second question I want to add is, these tests test each class individualy, (like shown when instancianting Car class) or a I can test my whole application once by instanciating the main class? The problem is how to simulate the whole userflow of the application (user clicks here, send a request to server there, etc, etc). I should write a whole flow one by one in a test method? :O

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:38:43+00:00Added an answer on June 15, 2026 at 8:38 pm

    I can’t understand why I have so many methods to run before or after a test function.

    You don’t have to implement all these methods. FB generated all these stubs for you, but you might as well leave them out.

    That said, you can have more than one test function inside a test class. You usually test every public function of a class. You may even have multiple tests per function, using different sets of corner-case arguments.
    e.g. in your example you only test the constructor, but you might have a test for:

    • car.turnLeft(32) (in degrees)
    • or see what happens when car.turnLeft(0)
    • or car.turnLeft(190) (you’re getting on the terrain of car.turnRight here)
    • or car.turnLeft(-12) (negative turnLeft?)

    The before/after methods can be used to write some code that you want executed before/after every test in the class, so that you don’t have to repeat this in each test function.

    these tests test each class individualy

    It is a unit test isn’t it?

    Can I test my whole application once by instanciating the main class?

    That’s not what unit tests are for: they only test classes. There are other kinds of testing tools to test (parts of) applications:

    • behavioural test tools: in which you write scenario’s that contain a typical execution sequences and assert that the outcome of such sequences is correct. I believe Cucumber can test Flex apps in this way (but not entirely sure)
    • UI test tools: in which you record scenario’s of users clicking around in your application. These scenario’s can then be played back to test whether the application keeps running as expected. FlexMonkey is one such solution for Flex apps, but it seems the owners have changed direction with the product.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hello i have just start using Raphael but i'm very confused in the following
I'm not sure exactly how to explain this, so I'll just start with an
Just start to using Xcode. I made an IBOutlet from UIButton to have a
I just start study DI (I'm working on WPF/Silverlight but I have a plan
Hi When i wanna start a new project, I have enough details to just
We just start testing Play!Framework and akka, for use it in our future projects.
I just start learning to write web services yesterday, kinda fascinating. I created an
I am setting up the development environment for my start-up just now. I use
I just start a project where I need to have a WCF services that
I just start working on a project which I have to upgrade and upload

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.