Eweasel Integration

Warning.png Warning: This page is under development.

This page describes how eweasel integrated in Eiffel Studio 6.3

Main ideas and main classes

The main idea is using normal Eiffel classes to replace original Eweasel testing control/catalog files. It means, in 6.3, we will write Eweasel testing control/catalog files in normal Eiffel classes instead of writing the eweasel instructions in plain text files.

First, what testing control file looks like in 6.3

class
	EWEASEL_TEST_CONTROL_SAMPLE
 
inherit
	EW_TEST_CONTROL_INSTRUCTIONS
		redefine
			make
		end
 
create
	make
 
feature {NONE} -- Initialization
 
	make is
			-- Creation method
		do
			Precursor {EW_TEST_CONTROL_INSTRUCTIONS}
			test_name ("Your test name here")
			test_description ("Your test description here")
 
			copy_sub ("Ace", "$TEST", "Ace")
			copy_raw ("test.e", "$CLUSTER", "test.e")
 
			compile_melted
 
			execute_work ("NONE", "NONE", Void)
		end
 
end

In above example, we use:

   test_name ("Your test name here")
   test_description ("Your test description here")
   copy_sub ("Ace", "$TEST", "Ace")
   copy_raw ("test.e", "$CLUSTER", "test.e")
   compile_melted
   execute_work ("NONE", "NONE", Void)

to replace the old testing instructions which are written in normal plain text file:

   test_name Your test name here
   test_description Your test description here
   copy_sub Ace $TEST Ace
   copy_raw test.e $CLUSTER test.e
   compile_melted
   execute_work

Second, what's test catalog file looks like in 6.3

class
	EWEASEL_TEST_CATALOG_SAMPLE
 
inherit
	EW_TEST_CATALOG_INSTRUCTIONS
 
create
	make
 
feature -- Command
 
	prepare is
			-- The functionality similiar to orignal {TEST_CATALOG_FILE}.parse_line
		do
			source_path ("C:\eweasel\tests")
 
			test ("array-is-equal", "array001", "tcf pass array", create {EWEASEL_TEST_CONTROL_SAMPLE}.make)
			test ("array-is-equal", "array001", "tcf pass array", create {EWEASEL_TEST_CONTROL_SAMPLE}.make)
 
		end
 
end

In the example above, we use:

   source_path ("C:\eweasel\tests")
   test ("array-is-equal", "array001", "tcf pass array", create {EWEASEL_TEST_CONTROL_SAMPLE}.make)
   test ("array-is-equal", "array001", "tcf pass array", create {EWEASEL_TEST_CONTROL_SAMPLE}.make)

to replace the old testing catalog instructions which written in normal plain text file:

   source_path C:\eweasel\tests
   test array-is-equal array001 tcf pass time
   test array-is-equal array001 tcf pass time

Third, how to start Eweasel testing in 6.3

class
	EWEASEL_TEST_SAMPLE
 
create
	make
 
feature {NONE} -- Initialization
 
	make is
			-- Creation method
		do
			start_test_sample
		end
 
feature {NONE} -- Implementation
 
	start_test_sample is
			-- Start eweasel testing
		local
			l_eweasel_63: EW_EWEASEL_MT
			l_list: ARRAYED_LIST [EW_TEST_CATALOG_INSTRUCTIONS]
			l_catalog_adapter: EWEASEL_TEST_CATALOG_SAMPLE
		do
			create l_eweasel_63.make_empty
 
			l_eweasel_63.init ("c:\eweasel\control\init")
			l_eweasel_63.output_arg ("c:\test_output")
			l_eweasel_63.define ("ISE_EIFFEL", "c:\PROGRA~1\EIFFEL~1\EIFFEL~1.3GP")
			l_eweasel_63.define ("ISE_PLATFORM", "windows")
			l_eweasel_63.define ("EWEASEL", "c:\eweasel")
			l_eweasel_63.define ("INCLUDE", "c:\eweasel\control")
			l_eweasel_63.define ("EWEASEL_PLATFORM", "WINDOWS")
			l_eweasel_63.define ("WINDOWS", "1")
			l_eweasel_63.define ("PLATFORM_TYPE", "WINDOWS")
 
			l_eweasel_63.define_file ("EWEASEL_COMPILE", <<"$ISE_EIFFEL", "studio", "spec", "$ISE_PLATFORM", "bin", "ec.exe">>)
			l_eweasel_63.define_file ("EWEASEL_EXECUTE", <<"$EWEASEL", "bin", "eiffel_execute.bat">>)
			l_eweasel_63.define_file ("EWEASEL_FREEZE", <<"$ISE_EIFFEL", "studio", "spec", "$ISE_PLATFORM", "bin", "finish_freezing.exe">>)
 
			create l_catalog_adapter.make
			l_catalog_adapter.prepare
 
			create l_list.make (5)
			l_list.extend (catalog_adapter)
			l_eweasel_63.execute_with (l_list)
		end
 
 
end

The feature `start_test_sample' replaced original `eweasel' executable command line. For example, on Windows, the command line is:

   eweasel.exe -init c:\eweasel\control\init -output c:\test_output -define ISE_EIFFEL c:\PROGRA~1\EIFFEL~1\EIFFEL~1.3GP -define 
   ISE_PLATFORM windows -define EWEASEL c:\eweasel -define INCLUDE c:\eweasel\control -define EWEASEL_PLATFORM WINDOWS -define WINDOWS 1 
   -define PLATFORM_TYPE WINDOWS ......

How it works

Actually most of eweasel integration classes work as adapters.

{EW_TEST_CONTROL_INSTRUCTIONS}

End users should inherit class {EW_TEST_CONTROL_INSTRUCTIONS} to write new eweasel testing control file. The {EW_TEST_CONTROL_INSTRUCTIONS} have all the testing control instructions which old eweasel has. Such as: copy_raw, copy_sub, copy_bin, compile_melted, compile_frozen, c_compile_work, c_compile_final...

Each instruction feature of this class prepare a correspond {TEST_INSTRUCTION} descendant. And it will fill the {TEST_INSTRUCTION} object into a linked list. The linked list will be used by eweasel testing suite class {EW_NAMED_EIFFEL_TEST} later.

{EW_TEST_CATALOG_INSTRUCTIONS}

Similar to {EW_TEST_CONTROL_INSTRUCTIONS}, end users should inherit class {EW_TEST_CATALOG_INSTRUCTIONS} to write new eweasel testing catalog file. The {EW_TEST_CATALOG_INSTRUCTIONS} have all the testing catalog instructions which old eweasel has. The three instruction features in this class are catalog_if (original name is `if'), source_path and test.

The catalog instruction feature will prepare a correspond {CATALOG_INSTRUCTION} descendant. Then it will execute (call {CATALOG_INSTRUCTION}.execute) the catalog instruction immediately just like what old eweasel does in {TEST_CATALOG_FILE}.parse_line.

{EW_EWEASEL_MT}

The propose of {EW_EWEASEL_MT} is staring eweasel testing and letting end users specifying various parameters, such as: define, keep_all, clean, init, catalog, output_arg...

Classes will not seen by end users

{EW_TEST_CONTROL_FILE} which inherit old {TEST_CONTROL_FILE}

{EW_TEST_CATALOG_FILE} which inherit old {TEST_CATALOG_FILE}

{EW_TEST_INST} which inherit old {TEST_INST}

Because old eweasel rely on plain text files to have testing instructions, but the new 6.3 eweasel will using normal Eiffel classes directly. These classes are mainly adapt this issue, so the 6.3 eweasel can work.

Testing control file converter

Tha main idea of the testing control file converter is: parsing old testing control/catalog files then generate Eiffel classes files which can be used by the new eweasel 6.3.