Re: Pass Command Line Parameter to getest test case
Eric Bezault <ericb-D6Qt/9opevxWk0Htik3J/[email protected]>
| Newsgroups | gmane.comp.lang.eiffel.gobo.general |
|---|---|
| Organization | Gobo |
| Message-ID | <[email protected]> |
Brian Heilig wrote:
> I'd like to pass a command-line argument to one of my test classes.
> There are two reasons for this:
>
> 1. The test is every so slightly different if it is running on
> Windows or on Unix. The test is very large and I don't want to
> duplicate it for a small change.
You can use:
inherit
KL_ShARED_OPERATING_SYSTEM
if operating_system.is_windows then ...
if operating_system.is_unix then ...
> 2. The test requires the tester to add a loopback plug to the
> corresponding serial device. It would be nice if the tester could
> specify which device he connected the plug to.
>
> How would you do this?
>
> I can, for example, define an environment variable:
>
> geant test -Ddevice=COM1
In fact I do something like that in ET_TEST_AST_PRINTER
(in $GOBO/test/tools). getest can be given the following variable:
getest -Dfull_test ...
and then in ET_TEST_AST_PRINTER you can find:
a_full_test := variables.has ("full_test")
In order for geant to pass the variable "full_test" to getest,
I had to change $GOBO/misc/test.eant and add:
<define name="full_test" value="true" if="${full_test}"/>
in the <getest> task of the "test" target. You could do the same
with the variable "device" and values such as "COM1". However,
having to edit $GOBO/misc/test.eant is not very nice. I don't
know how we can try to avoid that.
> Is there another way?
Not currently.
> I've also thought of having two test classes, one for Unix and one
> for Windows. These would inherit most of their functionality from a
> common ancestor. But then, would getest be able to find the test
> routines inherited from the ancestor? Or would I have to put test_*
> stubs in the two test classes?
getest does not traverse the ancestor classes to find test routines.
I wrote a tool at work, based on the code of getest, which does
that (and even more), but getest is pretty rudimentary.
--
Eric Bezault
mailto:ericb-D6Qt/9opevxWk0Htik3J/[email protected]
http://www.gobosoft.com
To Post a message, send it to: [email protected]
To Unsubscribe, send a blank message to: [email protected]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/gobo-eiffel/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/