0

我面临一个奇怪的 FlexUnit 错误:

哇...被要求发送另一个完整的,我已经这样做了

当测试次数超过 27 时似乎会发生错误......?(测试永远不会完成)

测试示例:

[Test]
public function whenDoingThat_expectThatIsTrue():void{
      //blabla      
      assertTrue(...)
}

欢迎任何帮助!

这是一个例子:

core = new FlexUnitCore();
core.addListener(new TraceListener());
core.run(FooTest);


import org.flexunit.asserts.assertTrue;

public class FooTest {
    [Test]
    public function foo_test_1() : void {
        assertTrue(true);
    }
    [Test]
    public function foo_test_2() : void {
        assertTrue(true);
    }

    ...

    [Test]
    public function foo_test_28() : void {
        assertTrue(true);
    }
    //[Test]
    public function foo_test_29() : void {
        assertTrue(true);
    }
}

结果:

foo_test_9 .
foo_test_17 .
foo_test_3 .
foo_test_18 .
foo_test_4 .
foo_test_19 .
foo_test_5 .
foo_test_6 .
foo_test_20 .
foo_test_21 .
foo_test_7 .
foo_test_22 .
foo_test_8 .
foo_test_23 .
foo_test_2 .
foo_test_24 .
foo_test_10 .
foo_test_25 .
foo_test_11 .
foo_test_26 .
foo_test_12 .
foo_test_27 .
foo_test_13 .
foo_test_28 .
foo_test_14 .
foo_test_15 .
foo_test_1 .
foo_test_16 .
Whoa... been asked to send another complete and I already did that
4

1 回答 1

1

具有讽刺意味的是,考虑到实际问题实际上是 StackOverflow:

https://bugs.adobe.com/jira/browse/FXU-112

您可以使用错误中提到的解决方法,或者此行为已在 FlexUnit 4.1 beta 中修复,可在 flexunit.org 下载页面上找到。

很快就会发布 4.1 版本。

The problem is your machine is fast enough to get one extra test in before the framework forces it to wait until the next frame. Flash Player throws a Stack Overflow when that stack depth gets to deep and it is being caught in a try catch in an inopportune place, and subsequently tracing out the 'Whoa' statement.

In FlexUnit 4.x originally, we used a counter and an approximate frame length for this, which, on very rare occasions linked more to the machine than the tests, could allow this to occur. In 4.1 we actually monitor the frames as they go by which should permanently eliminate this problem.

Mike

于 2010-06-17T14:52:50.030 回答