Hi All,
Im trying to write a testcase for my Loginproxy. My proxy has LoginServiceCallAMF method to call server API with the corresponding result and fault handler. This is working fine.
My Login Proxy extends FabricationProxy
{
public function LoginServiceCallAMF(username:String , password:String):void{
RemoteObject - Call the server method
}
public function resultAMF(data:Object):void{
sendNotification(LOGIN_SUCESS);
}
public function faultAMF(info:Object):void{
sendNotification(LOGIN_FAIL);
}
}
I got struck while coming into testing. I tried the Mock approach from Fabrication UnitTest source.
Created Mock for Login Proxy.
In the Login Proxy test case
override public function setUp():void {
key = methodName + "_setup";
_fabrication = new FabricationMock();
facade = FabricationFacadeMock.getInstance(key);
fabricationModel = new FabricationModel(key);
fabricationModel = FabricationModelMock.getInstance(key);
proxy = (new LoginProxyMock(key) as LoginProxy);
proxy.initializeNotifier(key);
facade.registerProxy(proxy);
}
public function LoginProxyEvent():void{
assertEquals('ConcordanceLoginProxy',facade.retrieveProxy(ConcordanceLoginProxy.NAME).getProxyName())
}
The result I’m getting for this test is
Error #1009: Cannot access a property or method of a null object reference.
I’m not sure that I’m in right track. Also I tried this in puremvc with the help of the sample provided here
http://www.hufkens.net/2009/07/testing-puremvc-code-with-flexunit/. This works perfect.
Could someone help me out to resolve this?
Thanks in advance.
jk