hi jack.

thank you for sending your parser class along. it looks extremely useful but it's not exactly what i'm looking for. what i need is some way of unit testing the "loading" of a class that handles XML. i could make this part of my functional test plan but my objective is to find out if i can unit test it.

my constructor takes a string that is the location of an XML file. i want to create a unit test case that will evaluate if a file location can be loaded in. how do i create a handler for when the XML has completely loaded without that handler being invoked as soon as the test is run?

thanks. -- matt.
----- Original Message ----- From: "Jack Doyle" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 12, 2007 4:42 PM
Subject: RE: [Flashcoders] asunit and a class that loads XML


You might want to check out my XMLParser class at
http://www.greensock.com/ActionScript/XMLParser. I think it does what you're
looking for. It's free. It works. It's served me well for at least a year.

Good luck.

Jack Doyle

-----Original Message-----
From: "Matthew Ganz" <[EMAIL PROTECTED]>
Subject: [Flashcoders] asunit and a class that loads XML
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"

hi.

i have a question on using asunit to test a class that loads XML.

i have a class that accepts a string in its constructor and i want to test
if it'll accept not just an http://myFileLocation.xml but also a file
location such as "/data/config.xml".

my question is how can i write my test with a handler for when the xml is
finished loading?

this is what i have right now:

class com.testsource.util.ConfigParserTest extends
com.asunit.framework.TestCase {
private var className:String = "com.testsource.util.ConfigParserTest";
private var configParser:ConfigParser;

public function setUp():Void {
trace("setUp: " + setUp());
configParser = new ConfigParser("data/config.xml");
 configParser.addEventListener("loadSuccess",
Delegate.create(this,testLoadFileLocation));
}

public function tearDown():Void {
trace("tearDown()");
delete configParser;
 }

public function testLoadFileLocation():Void{
 var size:Number = configParser.getLayerSetSize(); // this should return
the number 2.
 trace("size: " + size);
 assertEquals("example test", size, 2);
}
}

the problem here is that my test is run and testLoadFileLocation() is run
before my XML successfully loads. and by the time it does load, the
'configParser" object has been deleted by the tearDown() method.

so my traces come out looking like this:
setUp()
size: 0
tearDown()
size: undefined

any tips are greatly appreciated.

thanks. -- matt.

**************




_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to