Question
Handling ActionScript errors on Assert
Hello, I have a question that I can't seem to find an answer to anywhere online. In the old Google discussion group, someone asked the question regarding the problem I'm having. But no solution was ever posted.
I'm testing a method to make sure that a bad assertion shows up on the failed test list. However, when I run my TestRunner, I get an ActionScript pop-up instead of a failed test case. I'm just not sure how to suppress that error pop-up and show that a test case has failed. Any help would be greatly appreciated.
Here's a look at the code I'm running:
public function testGetDepartment():void {
var service:HTTPService = new HTTPService();
service.url = "getDepartmentByID.xml";
service.method = "GET";
service.resultFormat = "e4x";
service.addEventListener(ResultEvent.RESULT,
function(event:ResultEvent):void {
//Takes the XML response and "maps" it to a Dept. VO
var dept:Department = DepartmentMapper.getDepartment(event);
//This assertion works fine.
//assertEquals("Department Id is 45", 45, dept.deptId);
//This assertion is wrong and I want to fail.
assertEquals("Department Id is 45", 44, dept.deptId);
});
service.send();
}
I'm testing a method to make sure that a bad assertion shows up on the failed test list. However, when I run my TestRunner, I get an ActionScript pop-up instead of a failed test case. I'm just not sure how to suppress that error pop-up and show that a test case has failed. Any help would be greatly appreciated.
Here's a look at the code I'm running:
public function testGetDepartment():void {
var service:HTTPService = new HTTPService();
service.url = "getDepartmentByID.xml";
service.method = "GET";
service.resultFormat = "e4x";
service.addEventListener(ResultEvent.RESULT,
function(event:ResultEvent):void {
//Takes the XML response and "maps" it to a Dept. VO
var dept:Department = DepartmentMapper.getDepartment(event);
//This assertion works fine.
//assertEquals("Department Id is 45", 45, dept.deptId);
//This assertion is wrong and I want to fail.
assertEquals("Department Id is 45", 44, dept.deptId);
});
service.send();
}
