Re: getest: Test generation and inheritance

Eric Bezault <ericb-D6Qt/9opevxWk0Htik3J/[email protected]> Wed, 15 Oct 2008 12:59:04 +0200
Newsgroups gmane.comp.lang.eiffel.gobo.general
Message-ID <[email protected]>
pletanoux wrote:
> Hi there,
> 
> Is there a way to have the test features of a test class's ancestor be
> generated for the heir?
> 
> Ie:
> 
> ----------------------------------------------------------
> deferred class
> 	TEST_ANCESTOR
> 
> inherit
> 	TS_TEST_CASE
> 
> feature
> 
> 	test_ancestor_procedure is
> 		do
> 		end
> 
> end -- class TEST_ANCESTOR
> 
> 
> ----------------------------------------------------------
> class
> 	TEST_HEIR
> 
> inherit
> 	TEST_ANCESTOR
> 
> create
> 	make_default
> 
> feature
> 
> 	test_heir_procedure is
> 		do
> 		end
> 
> end -- class TEST_HEIR
> 
> ----------------------------------------------------------
> 
> After invoking getest -g i get the following:
> 
> 	build_suite is
> 			-- Add to `suite' the test cases that need to executed.
> 		local
> 			l_test1: TEST_ANCESTOR
> 			l_test2: TEST_HEIR
> 		do
> 			create l_test1.make_default
> 			l_test1.set_test ("TEST_ANCESTOR.test_ancestor_procedure", agent
> l_test1.test_ancestor_procedure)
> 			put_test (l_test1)
> 			create l_test2.make_default
> 			l_test2.set_test ("TEST_HEIR.test_heir_procedure", agent
> l_test2.test_heir_procedure)
> 			put_test (l_test2)
> 		end
> 
> What i miss is:
> 
> 			create l_test2.make_default
> 			l_test2.set_test ("TEST_HEIR.test_ancestor_procedure", agent
> l_test2.test_ancestor_procedure)
> 			put_test (l_test2)
> 
> 
> Is there a way to get that generated?

The current implementation of getest only parses the test classes.
It does not analyze the whole class inheritance. It would need
a full Ace/Xace/ECF file for that, not just a directory. So it
does not know about the inherited features.

It's possible to write to implement an extension of getest that
does that. I did so in a proprietary tool similar to EiffelStudio.
But as it is, the version of getest provided in the Gobo package
does not allow that. The awkward workaround is to write:

class
	TEST_HEIR

inherit
	TEST_ANCESTOR
		redefine
			test_ancestor_procedure
		end

create
	make_default

feature

	test_heir_procedure is
		do
		end

	test_ancestor_procedure is
		do
			Precursor
		end

end

-- 
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]! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/gobo-eiffel/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/gobo-eiffel/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> 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/