Title: Niklas Richardson, Prismix Ltd
 |
|
Hello Flexcoders,
I've started
using FlexUnit to test business logic in my business
delegates.
I would now like
to use FlexUnit to test my View Helpers and getter / setter
functions in the views themselves. Does anyone have
any examples of how one may run tests against their mxml
views?
For example, if
I want to test that a function getLabel():String placed in the root
of mx:Application in file 'index.mxml' returns the string 'myLabel',
how would I go about writing my test?
public function testGetLabelFromView() : Void
{
myViewToTest = mx.core.application.Application;//?? how do I get
access to this ??
assertEquals('should be
', 'myLabel'
,myViewToTest.getLabel());
}
I'm going to run
this test from a testing application, tests.mxml so
mx.core.application.Application refers to my testing application and
not the target application I wish to
test.
Do I need to
instantiate my target application in the tests themselves?
Like this:
public function testGetLabelFromView() : Void
{
myViewToTest = index;//do I call this as a class?
assertEquals('should be
', 'myLabel'
,myViewToTest.getLabel());
}
Any help would
be greatly appreciated.
Many
Thanks,
Allen | |
| |
| Allen
Manning, Technical Director
|
| Prismix
Ltd t: +44 (0)870 749 1100 f: +44
(0)870 749 1200 w: www.prismix.com
| |
Yahoo! Groups Links
|