setup

15 views
Skip to first unread message

finty

unread,
May 31, 2011, 11:11:59 AM5/31/11
to utest
I'm a unit test newbie and was wondering if utest allows for inline
unit tests when the class in question already has a method defined
called setup(arg1, arg2) for example.

franco.p...@gmail.com

unread,
May 31, 2011, 11:15:35 AM5/31/11
to ut...@googlegroups.com
I am not sure I understand your question. If you have a setup() method in your class or on a parent class it will be automatically invoked before each test method. Note that the setup method cannot have arguments.

finty

unread,
May 31, 2011, 11:29:17 AM5/31/11
to utest
thanks for the fast reply Franco. what I mean is that the class
already has a method called setup and it has 2 arguments. i forgot
that utest also uses a method called setup and I don't really want to
rename it. I can get it to run if I make them optional I guess setup(?
arg1, ?arg2) but would prefer not to. Should I just rename it?

On May 31, 4:15 pm, "franco.pontice...@gmail.com"

Franco Ponticelli

unread,
May 31, 2011, 11:36:11 AM5/31/11
to ut...@googlegroups.com
utest is your friend ;) ... when you make runner.addCase(myclass) the second optional argument is the name of the setup function ... so you can do:

runner.addCase(myclass, "myTestSetup")

You can also redefine the teardown, the test case prefix or pass a pattern to match your test cases.

Franco

--
You received this message because you are subscribed to the Google Groups "utest" group.
To post to this group, send email to ut...@googlegroups.com.
To unsubscribe from this group, send email to utest+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/utest?hl=en.


finty

unread,
May 31, 2011, 11:41:57 AM5/31/11
to utest
that's great :-)

thanks for the help Franco

On May 31, 4:36 pm, Franco Ponticelli <franco.pontice...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages