Error in assertEquals
Hi Everyone,
I tried a simple example with timer event and once it gets complete , i call a function to check my assert. There is a for loop which checks for all the assert, but i get an error in that loop if any of my assert is not true. Can anybody help out. My sample code i am pasting
this is my test method in my class.
public function testTimer2():void {
_timer = new Timer(1000, 2);
_timer.addEventListener(TimerEvent.TIMER, incrementCount, false, 0, true);
_timer.addEventListener(TimerEvent.TIMER_COMPLETE, addAsync(verifyCount, 2500, 2), false, 0, true);
_timer.start();
}
this function is getting called twice
private function incrementCount(timerEvent:TimerEvent):void {
_timerCount++;
trace("increment count");
}
After the final timer event completes i am checking all my test cases in this function.
private function verifyCount(timerEvent:TimerEvent, expectedCount:int):void {
trace("verify count");
for(var i:int = 0 ; i<2; i++)
{
assertEquals("verfiy count",expectedCount, _timerCount);
assertEquals("temp", 0 , 1);
}
}
this function throws an error in the for loop for first time and dont execute the loop for the second time , but i dont know the reason. It says expected 0 but 1. I know my test result is not true but it throws an exception.
Thanks in advance
