Closed ghost closed 14 years ago
Instance variables marked with [Mock]
must be public for the runner to see them:
[Mock(type="strict")]
private var loginModelMock:LoginModel;
wont work, change it to:
[Mock(type="strict")]
public var loginModelMock:LoginModel;
and you should be good to go.
Doh! That was it.
PS. What does this line do:
import mockolate.runner.MockolateRunner; MockolateRunner;
I have seen the import, but the extra MockolateRunner; after the import? If it is not there, the test fails with errors
Thanks Des
It is just a compact way of writing an import and referencing the class to ensure it gets compiled into the application.
Other ways of doing it include:
import mockolate.runner.MockolateRunner;
MockolateRunner;
or
import mockolate.runner.MockolateRunner;
public var refs:Array = [MockolateRunner];
Drew
Thought I'd try this approach to log our conversations. I tried the new notation you presented around the runner, but I must be doing something wrong?
Original code that works
}
New code that fails
import mockolate.runner.MockolateRunner; MockolateRunner;
}
Fails with assert not null. This is the fail stacktrace
LoginModel Mock available - object was null: null at flexunit.framework::Assert$/failWithUserMessage(Assert.as:591) at flexunit.framework::Assert$/failNull(Assert.as:533) at flexunit.framework::Assert$/assertNotNull(Assert.as:311) **[ at com.wl.sfx.unit.presentor::LoginPresentorTests/testLogin(LoginPresentorTests.as:81) ] at Function/http://adobe.com/AS3/2006/builtin::apply at flex.lang.reflect::Method/apply(Method.as:208) at ReflectiveCallable/run(FrameworkMethod.as:297) at org.flexunit.runners.model::FrameworkMethod/applyExplosivelyAsync(FrameworkMethod.as:171) at org.flexunit.runners.model::FrameworkMethod/invokeExplosivelyAsync(FrameworkMethod.as:186) at org.flexunit.internals.runners.statements::InvokeMethod/evaluate(InvokeMethod.as:77) at org.flexunit.internals.runners.statements::ExpectAsync/evaluate(ExpectAsync.as:544) at org.flexunit.internals.runners.statements::StackAndFrameManagement/evaluate(StackAndFrameManagement.as:129) at org.flexunit.internals.runners.statements::StatementSequencer/executeStep(StatementSequencer.as:97) at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete(StatementSequencer.as:134) at org.flexunit.token::AsyncTestToken/sendResult(AsyncTestToken.as:118) at org.flexunit.internals.runners.statements::AsyncStatementBase/sendComplete(AsyncStatementBase.as:76) at org.flexunit.internals.runners.statements::StatementSequencer/sendComplete(StatementSequencer.as:165) at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete(StatementSequencer.as:138) at org.flexunit.token::AsyncTestToken/sendResult(AsyncTestToken.as:118) at org.flexunit.internals.runners.statements::InvokeMethod/handleMethodExecuteComplete(InvokeMethod.as:89) at org.flexunit.token::AsyncTestToken/sendResult(AsyncTestToken.as:118) at org.flexunit.runners.model::FrameworkMethod/applyExplosivelyAsync(FrameworkMethod.as:173) at org.flexunit.runners.model::FrameworkMethod/invokeExplosivelyAsync(FrameworkMethod.as:186) at org.flexunit.internals.runners.statements::InvokeMethod/evaluate(InvokeMethod.as:77) at org.flexunit.internals.runners.statements::SequencerWithDecoration/executeStep(SequencerWithDecoration.as:104) at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete(StatementSequencer.as:134) at org.flexunit.internals.runners.statements::StatementSequencer/evaluate(StatementSequencer.as:108) at org.flexunit.internals.runners.statements::StatementSequencer/executeStep(StatementSequencer.as:97) at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete(StatementSequencer.as:134) at org.flexunit.token::AsyncTestToken/sendResult(AsyncTestToken.as:118) at mockolate.runner::Inject/evaluate(Inject.as:35) at org.flexunit.internals.runners.statements::StatementSequencer/executeStep(StatementSequencer.as:97) at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete(StatementSequencer.as:134) at org.flexunit.internals.runners.statements::StatementSequencer/evaluate(StatementSequencer.as:108) at org.flexunit.runners::BlockFlexUnit4ClassRunner/runChild(BlockFlexUnit4ClassRunner.as:130) at org.flexunit.internals.runners::ChildRunnerSequencer/executeStep(ChildRunnerSequencer.as:82) at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete(StatementSequencer.as:134) at org.flexunit.internals.runners.statements::StatementSequencer/evaluate(StatementSequencer.as:108) at org.flexunit.internals.runners.statements::StatementSequencer/executeStep(StatementSequencer.as:97) at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete(StatementSequencer.as:134) at org.flexunit.token::AsyncTestToken/sendResult(AsyncTestToken.as:118) at org.flexunit.internals.runners.statements::AsyncStatementBase/sendComplete(AsyncStatementBase.as:76) at org.flexunit.internals.runners.statements::StatementSequencer/sendComplete(StatementSequencer.as:165) at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete(StatementSequencer.as:138) at org.flexunit.token::AsyncTestToken/sendResult(AsyncTestToken.as:118) at org.flexunit.internals.runners.statements::AsyncStatementBase/sendComplete(AsyncStatementBase.as:76) at org.flexunit.internals.runners.statements::StatementSequencer/sendComplete(StatementSequencer.as:165) at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete(StatementSequencer.as:138) at org.flexunit.token::AsyncTestToken/sendResult(AsyncTestToken.as:118) at org.flexunit.internals.runners.statements::InvokeMethod/handleMethodExecuteComplete(InvokeMethod.as:89) at org.flexunit.token::AsyncTestToken/sendResult(AsyncTestToken.as:118) at org.flexunit.runners.model::FrameworkMethod/applyExplosivelyAsync(FrameworkMethod.as:173) at org.flexunit.runners.model::FrameworkMethod/invokeExplosivelyAsync(FrameworkMethod.as:186) at org.flexunit.internals.runners.statements::InvokeMethod/evaluate(InvokeMethod.as:77) at org.flexunit.internals.runners.statements::SequencerWithDecoration/executeStep(SequencerWithDecoration.as:104) at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete(StatementSequencer.as:134) at org.flexunit.internals.runners.statements::StatementSequencer/evaluate(StatementSequencer.as:108) at org.flexunit.internals.runners.statements::StatementSequencer/executeStep(StatementSequencer.as:97) at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete(StatementSequencer.as:134) at org.flexunit.token::AsyncTestToken/sendResult(AsyncTestToken.as:118) at mockolate.runner::Prepare/evaluate(Prepare.as:31) at org.flexunit.internals.runners.statements::StatementSequencer/executeStep(StatementSequencer.as:97) at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete(StatementSequencer.as:134) at org.flexunit.internals.runners.statements::StatementSequencer/evaluate(StatementSequencer.as:108)
Thanks Des