Skip to main content
Participant
October 21, 2010
Question

Ho to run a TestSuite Using ASMock

  • October 21, 2010
  • 1 reply
  • 1128 views

Hi All,

As per the As mock we can run the Test using   the flex compiler option

-includes asmock.integration.flexunit.ASMockClassRunner

Bu we run the a test Suite using the same we get the below erroe

Error: No runnable methods

at org.flexunit.runners::BlockFlexUnit4ClassRunner/validateInstanceMethods(BlockFlexUnit4ClassRunner.as:221)

at org.flexunit.runners::BlockFlexUnit4ClassRunner/collectInitializationErrors(BlockFlexUnit4ClassRunner.as:207)

at org.flexunit.runners::ParentRunner/validate(ParentRunner.as:267)

at org.flexunit.runners::ParentRunner(ParentRunner.as:123)

at org.flexunit.runners::BlockFlexUnit4ClassRunner(BlockFlexUnit4ClassRunner.as:99)

at asmock.integration.flexunit::ASMockClassRunner

at org.flexunit.internals.builders::MetaDataBuilder/buildRunner(MetaDataBuilder.as:137)

at org.flexunit.internals.builders::MetaDataBuilder/runnerForClass(MetaDataBuilder.as:115)

at org.flexunit.runners.model::RunnerBuilderBase/safeRunnerForClass(RunnerBuilderBase.as:63)

at org.flexunit.internals.builders::AllDefaultPossibilitiesBuilder/runnerForClass(AllDefaultPossibilitiesBuilder.as:106)

at org.flexunit.runners.model::RunnerBuilderBase/safeRunnerForClass(RunnerBuilderBase.as:63)

at org.flexunit.runners.model::RunnerBuilderBase/localRunners(RunnerBuilderBase.as:119)

at org.flexunit.runners.model::RunnerBuilderBase/runners(RunnerBuilderBase.as:87)

at org.flexunit.runners::Suite(Suite.as:170)

at org.flexunit.runner::Request$/classes(Request.as:201)

at Function/http://adobe.com/AS3/2006/builtin::apply

at org.flexunit.runner::FlexUnitCore/runClasses(FlexUnitCore.as:191)

at Function/http://adobe.com/AS3/2006/builtin::apply

at org.flexunit.runner::FlexUnitCore/run(FlexUnitCore.as:171)

at flexunit.flexui::FlexUnit4TestRunner/run(FlexUnit4TestRunner.as:75)

at flexunit.flexui::FlexUnitTestRunnerUI/runWithFlexUnit4Runner(FlexUnitTestRunnerUI.mxml:148)

**[ at FlexUnitApplication/onCreationComplete(FlexUnitApplication.mxml:22) ]

**[ at FlexUnitApplication/___FlexUnitApplication_Application1_creationComplete(FlexUnitApplication.mxml:7) ]

at flash.events::EventDispatcher/dispatchEventFunction

at flash.events::EventDispatcher/dispatchEvent

at mx.core::UIComponent/dispatchEvent(UIComponent.as:12266)

at mx.core::UIComponent/set initialized(UIComponent.as:1577)

at mx.managers::LayoutManager/doPhasedInstantiation(LayoutManager.as:759)

at mx.managers::LayoutManager/doPhasedInstantiationCallback(LayoutManager.as:1072)

Tools used

Flext Unit 4

Flash Builder 4

Syntax of the AsMock Test suite is

[Mock("com.loginmodule.service.IUserService")]

[Suite]

[RunWith("asmock.integration.flexunit.ASMockClassRunner")]

public class ASMockSuite

{

public var temp1:LoginControllerASMockTest;

}

This topic has been closed for replies.

1 reply

Participating Frequently
October 21, 2010

Correct. This cannot work.

Suites are a collection of Test Cases.

Test Cases have tests.

You have tried to combine the two in a very incompatible way. You have told this suite (which is a collection of test cases, not tests) that it should be run with [RunWith("asmock.integration.flexunit.ASMockClassRunner")]

The ASMockRunner is looking for Tests to run. Your suite doesn't have any tests, so it throws an error indicating that there are no tests.

Your post asks how to run a suite using AsMock. You do NOT run a suite using AsMock. AsMock is for running tests, not suites.

Change the RunWith metata data on the suite back to the default [RunWith("org.flexunit.runners.Suite")]. Then open the LoginControllerASMockTest test case. On top of that file add your [RunWith("asmock.integration.flexunit.ASMockClassRunner")]

Mike