Difference between revisions of "Writing a new eweasel test"

 
(Example of tcf)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Testing]]
+
[[Category:Eweasel]]
 +
Creating a new eweasel test is a very simple procedure which is described below.
 +
 
 +
=Choosing the category=
 +
Here are the major categories of test:
 +
*syntax
 +
*incr
 +
*melt
 +
*freeze
 +
*finalize
 +
*exec
 +
*ccomp
 +
*term
 +
*fixed
 +
 
 +
When creating a new test, choose the most appropriate category and append the incremented value for the last counter value for each category.
 +
 
 +
=Writing the TCF file=
 +
A tcf would look like:
 +
<code>
 +
--| Copyright (c) 1993-2006 University of Southern California and contributors.
 +
--| All rights reserved.
 +
--| Your use of this work is governed under the terms of the GNU General
 +
--| Public License version 2.
 +
 
 +
-- This is a test control file
 +
 
 +
test_name power-operator
 +
test_description The power operator (infix "^") with INTEGERs, REALs and DOUBLEs
 +
 
 +
copy_sub Ace $TEST Ace
 +
copy_raw test.e $CLUSTER test.e
 +
compile_melted
 +
compile_result ok
 +
 
 +
execute_work NONE exec_output1
 +
execute_result ok
 +
compare exec_output1 output
 +
 
 +
test_end
 +
</code>
 +
This simply copy the Ace and test.e file over the test directory, compiles the project, execute the workbench executable and compare the output `exec_output1' with the stored output `output'.
 +
 
 +
=Writing the ECF file=
 +
Usually its content would look like and for historical reason it has to be called Ace:
 +
<code>[xml,N]
 +
<?xml version="1.0" encoding="ISO-8859-1"?><system xmlns="http://www.eiffel.com/developers/xml/configuration-1-0-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-0-0 http://www.eiffel.com/developers/xml/configuration-1-0-0.xsd" name="test" uuid="D4B33796-B5BB-4a70-9646-147CE70640E7">
 +
<target name="test">
 +
<root cluster="root_cluster" class="test" feature="make"/>
 +
<option warning="true">
 +
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
 +
<warning name="syntax" enabled="false"/></option>
 +
<precompile name="precompile" location="$PRECOMPILED_BASE"/>
 +
$EWEASEL_DOTNET_SETTING
 +
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
 +
<cluster name="root_cluster" location="$CLUSTER\"/>
 +
</target>
 +
</system>
 +
</code>
 +
 
 +
=Writing the Eiffel classes=
 +
The classes that make the test.
 +
 
 +
=Writing the output file(s)=
 +
They contain the actual output of the program plus '''Execution completed''' when we expect a successful run, or '''Execution failed''' when we expect a failure.

Latest revision as of 12:03, 2 December 2006

Creating a new eweasel test is a very simple procedure which is described below.

Choosing the category

Here are the major categories of test:

  • syntax
  • incr
  • melt
  • freeze
  • finalize
  • exec
  • ccomp
  • term
  • fixed

When creating a new test, choose the most appropriate category and append the incremented value for the last counter value for each category.

Writing the TCF file

A tcf would look like:

--| Copyright (c) 1993-2006 University of Southern California and contributors.
--| All rights reserved.
--| Your use of this work is governed under the terms of the GNU General
--| Public License version 2.
 
-- This is a test control file
 
test_name 	power-operator
test_description The power operator (infix "^") with INTEGERs, REALs and DOUBLEs
 
copy_sub 	Ace $TEST Ace
copy_raw 	test.e $CLUSTER test.e
compile_melted
compile_result 	ok
 
execute_work 	NONE 	exec_output1
execute_result 	ok
compare		exec_output1 output
 
test_end

This simply copy the Ace and test.e file over the test directory, compiles the project, execute the workbench executable and compare the output `exec_output1' with the stored output `output'.

Writing the ECF file

Usually its content would look like and for historical reason it has to be called Ace:

<?xml version="1.0" encoding="ISO-8859-1"?><system xmlns="http://www.eiffel.com/developers/xml/configuration-1-0-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-0-0 http://www.eiffel.com/developers/xml/configuration-1-0-0.xsd" name="test" uuid="D4B33796-B5BB-4a70-9646-147CE70640E7">
	<target name="test">
		<root cluster="root_cluster" class="test" feature="make"/>
		<option warning="true">
			<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
		<warning name="syntax" enabled="false"/></option>
		<precompile name="precompile" location="$PRECOMPILED_BASE"/>
		$EWEASEL_DOTNET_SETTING
		<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
		<cluster name="root_cluster" location="$CLUSTER\"/>
	</target>
</system>

Writing the Eiffel classes

The classes that make the test.

Writing the output file(s)

They contain the actual output of the program plus Execution completed when we expect a successful run, or Execution failed when we expect a failure.