|
From: Cary N. <ca...@do...> - 2005-09-06 17:41:12
|
Hi, Just started digging in to using the ASUnit component. I'm afraid I am quiet new to the Junit testing philosophy and are eager to learn as much as I can. I have tried inserting the unit testing framework in to an existing project and have run in to this: >> Any class that extends Assert should have an instance member named [className] because there is no reflection in AS 2.0 >> This member should be defined as follows: private var className:String = [com.package.package.ClassName]; >> Any class that extends Assert should have an instance member named [className] because there is no reflection in AS 2.0 >> This member should be defined as follows: private var className:String = [com.package.package.ClassName]; The system runs well and my initial test work, but, I'm not sure what the above means, I get what reflection means, but 'extends assert' seems to escape me. I am downloading the asunit source now to investigate further, but any insight would be welcomed. regards, Cary. |
|
From: Don P. <dpe...@cr...> - 2005-09-06 18:06:16
|
I might be able to help you on this one. I wasn't aware that it was actually a requirement, but every TestCase I build defines a private string called "className", which is the class that I'm actually testing. I was under the impression that this was a convenience thing, so that when a test failed that ASUnit would know what display what class I was testing. Apparently this is actually required, and probably rightly so. So to reiterate, if I'm testing the class: com.mycompany.MyClass My TestCase would have the following line: private var className:String = "com.mycompany.Myclass"; Hope that helps. Don Petersen On Tue, 2005-09-06 at 13:41 -0400, Cary Newfeldt wrote: > Hi, > > Just started digging in to using the ASUnit component. I'm afraid I am > quiet new to the Junit testing philosophy and are eager to learn as > much as I can. > > I have tried inserting the unit testing framework in to an existing > project and have run in to this: > > >> Any class that extends Assert should have an instance member named > [className] because there is no reflection in AS 2.0 > >> This member should be defined as follows: private var > className:String = [com.package.package.ClassName]; > >> Any class that extends Assert should have an instance member named > [className] because there is no reflection in AS 2.0 > >> This member should be defined as follows: private var > className:String = [com.package.package.ClassName]; > > The system runs well and my initial test work, but, I'm not sure what > the above means, I get what reflection means, but 'extends assert' > seems to escape me. I am downloading the asunit source now to > investigate further, but any insight would be welcomed. > > regards, > > Cary. |
|
From: Cary N. <ca...@do...> - 2005-09-06 19:30:38
|
Hi Don,
The private variable is present in all the test files, and is pointing
at the actual test not the class it is testing. I'm not sure if this is
the problem, but the stub code produced when selecting the 'Create
Class' command does the same thing, and I get no such messages.
This is the format I have: (using your example below)
com.mycompany.MyClassTest
private var className:String = "com.mycompany.MyclassTest";
I referenced the complete chain from the folder 'com' down with the stub
code created in the 'example' documentation on the website and
everything is in order. So, no luck, I am still receiving the same
output message. At this point I'm not sure if it is an error. As I
mentioned before the tests seem to work, but I am curious as to why the
output message is, what it is.
I must be missing something. Some more examples and documentation for us
'Flash minded' folk would be nice ;) I will keep plugging away.
thanks for your time,
c
Don Petersen wrote:
>I might be able to help you on this one.
>
>I wasn't aware that it was actually a requirement, but every TestCase I
>build defines a private string called "className", which is the class
>that I'm actually testing. I was under the impression that this was a
>convenience thing, so that when a test failed that ASUnit would know
>what display what class I was testing. Apparently this is actually
>required, and probably rightly so.
>
>So to reiterate, if I'm testing the class:
>com.mycompany.MyClass
>
>My TestCase would have the following line:
>
>private var className:String = "com.mycompany.Myclass";
>
>Hope that helps.
>
>Don Petersen
>
>On Tue, 2005-09-06 at 13:41 -0400, Cary Newfeldt wrote:
>
>
>>Hi,
>>
>>Just started digging in to using the ASUnit component. I'm afraid I am
>>quiet new to the Junit testing philosophy and are eager to learn as
>>much as I can.
>>
>>I have tried inserting the unit testing framework in to an existing
>>project and have run in to this:
>>
>>
>>
>>>>Any class that extends Assert should have an instance member named
>>>>
>>>>
>>[className] because there is no reflection in AS 2.0
>>
>>
>>>>This member should be defined as follows: private var
>>>>
>>>>
>>className:String = [com.package.package.ClassName];
>>
>>
>>>>Any class that extends Assert should have an instance member named
>>>>
>>>>
>>[className] because there is no reflection in AS 2.0
>>
>>
>>>>This member should be defined as follows: private var
>>>>
>>>>
>>className:String = [com.package.package.ClassName];
>>
>>The system runs well and my initial test work, but, I'm not sure what
>>the above means, I get what reflection means, but 'extends assert'
>>seems to escape me. I am downloading the asunit source now to
>>investigate further, but any insight would be welcomed.
>>
>>regards,
>>
>>Cary.
>>
>>
>
>
>-------------------------------------------------------
>SF.Net email is Sponsored by the Better Software Conference & EXPO
>September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
>Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
>Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
>_______________________________________________
>Asunit-users mailing list
>Asu...@li...
>https://lists.sourceforge.net/lists/listinfo/asunit-users
>
>
>
>
|
|
From: Luke B. <lb...@gm...> - 2005-09-07 20:37:22
|
First Off, Thanks Don for answering this! You are absolutely correct. Any class that extends TestCase should have a member named "className" that= =20 identifies it's fully qualified name as a string. As Don mentioend, this is a requirement because we don't have an efficient= =20 means of Reflection in ActionScript and we wanted the test failure output t= o=20 be at least somewhat meaningful... It wouldn't really be very helpful if we= =20 showed test failures without identifying where they were. ;-) We added the feature to the Create Class templates in order to avoid=20 burdening ourselves with the extra effort of keeping those strings accurate= . Cary,=20 It seems that you must have a couple of classes (it looks like 4 to be=20 precise) in your project that: a) Have a name ending with the string "Test.as <http://Test.as>" b) Extend TestCase=20 and c) Don't include (or assign a value to) this member. If you double check your source code, you should be able to find them. If= =20 you do a search for the string "extends TestCase" you *should* be able to= =20 find them. Please let us know if that doesn't fix the problem. Thanks, Luke Bayes www.asunit.com <http://www.asunit.com> |