Code Monkey home page Code Monkey logo

asunit's People

Contributors

alimills avatar basti1302 avatar kristoferjoseph avatar lukebayes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asunit's Issues

Error if you inadvertently add test to itself

I found that I had inadvertently added a test suite to itself today, but got an error that wasn't terribly helpful in working out what I had done. It would be good if ASUnit handled this without going to a recursion stack overflow.

(I'll do it myself if I remember, but wanted to add the issue here in case I forgot)

Cheers,

Alec

CS 4 error

Using the CS4 IDE will produce an error with an out-of-the-box asunit as25:

Time: 2.414
There was 1 error:
0) asunit.framework.TestCaseTest.testCustomConstructor4
TestCase.timeout (1000ms) exceeded on an asynchronous operation.

FAILURES!!!
Tests run: 45, Failures: 0, Errors: 1

Interestingly enough, running the swf /bin/AsUnitRunner.swf produces no errors at all.

I believe that this issue is attributable to the Flash IDE, not AS25.

A TestSuite that contains no tests will cause the TestRunner to stop functioning

If you create an empty TestSuite then when the TestRunner hits it the TestRunner stops, but doesn't report why it has stopped. No test failures are reported, and there is no obvious reason where the problem arises.

I've blogged about this error in more detail here:
http://alecmce.com/as3/asunit-gotcha-empty-testsuite-bug

I've provided a proposed solution here:
http://github.com/alecmce/asunit/commit/b200e11dbb313db92ada51225bb844c4e942ea6b

Regards,

Alec McEachran

Does this work with FP 11+?

I see this repo hasn't been maintained for several years. I'm wondering if I would be safe to try this with Flash Player 11? Could be useful for the legacy programmers. ๐Ÿ˜ญ

addAsync result doesn't preserve 'has 0 arguments' (.length == 0)

The result of the addAsync method is a function whose length is not 0, even if the input argument is 0. If a tested method expects a callback to take 0 arguments, and checks this fact, the addAsync method prevents the test from succeeding and has to be worked around:

    private function testableAwaitCallback(func : Function) : Function {
        var x:Function = this.addAsync(func);
        if (func.length > 0) return x;
        return function():* { return x(); };
    }

Reference Error when addAsync() called from within setUp()

I'm trying to integrate ASMock with AsUnit. Here is the folowing code in setUp() method:
repository = new MockRepository();
var prepareDispatcher:IEventDispatcher = _repository.prepare([MovieClip]);
prepareDispatcher.addEventListener(Event.COMPLETE, addAsync());

If there is only one test method in test case - everything's going right. If there are 2 or more, ReferenceError occurs at line "thismethodName;" in runMethod() in TestCase (methodName is null). Am I doing wrong?

Compile errors in AsynchronousHTTPServiceTestCase

Three compile errors occur in AsynchronousHTTPServiceTestCase:
completeHandler, ioErrorHandler and securityErrorHandler are not found.

Changing the superclass to AsynchronousTestCase resolves the issue (currently TestCase).

I am having troubles with Git thinking all my files are changed when they're not, otherwise I would do the fix myself.

Resizing the player window after testing has finished throws an unhandled exception

After the tests have completed successfully and the test runner has been removed from the stage so the project can run, resizing the flash player's window throws an exception:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at asunit.textui::TestRunner/resizeHandler()[as3\src\asunit\textui\TestRunner.as:84]

The code I'm using to run the tests:

    public function Main() {
        var testing:Task = AllTests.RunShowAsync(this.stage);
        testing.Await(function():void {
            if (!testing.IsFaulted()) init();
        });
    }

package UnitTests {
import asunit.framework.TestResult;
import asunit.framework.TestSuite;
import asunit.textui.TestRunner;
import Async.Task;
import Async.TaskSource;
import Async.TaskUtil;
import flash.display.Stage;
import flash.errors.IllegalOperationError;

public class AllTests extends TestSuite {
    private static var HACKY_LAST_INSTANCE:AllTests;
    public function AllTests() {
        super();

        addTest(new TestAsync());
        //... omitted ...

        HACKY_LAST_INSTANCE = this;
    }
    public static function RunShowAsync(stage : Stage) :Task {
        var r:TaskSource = new TaskSource();
        var testRunner:TestRunner = new TestRunner();
        stage.addChild(testRunner);
        var testResult:TestResult = testRunner.start(AllTests, null, TestRunner.SHOW_TRACE);
        var allTests:AllTests = HACKY_LAST_INSTANCE;

        var queryResultLooper:Function = function():void {
            if (!allTests.getIsComplete()) {
                TaskUtil.Delay(100).Await(queryResultLooper);
                return;
            }
            if (testResult.failureCount() > 0 || testResult.errorCount() > 0) {
                r.SetFault(new IllegalOperationError("Test Failures"));
            } else {
                r.SetResult(null);
                stage.removeChild(testRunner);      
            }
        }
        queryResultLooper();

        return r;
    }
}
}

assertEqualsArraysIgnoringOrder

The assertEqualsArraysIgnoringOrder does not actually require that all the elements of the two arrays are the equal. What it really does is check that the arrays are the same length and that the expected array is a subset of the actual array.

For example, this assertion should fail, but it passes:
assertEqualsArraysIgnoringOrder([1,1,1], [1,2,3]);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.