ESpec Unit Testing Library

We will be using the ESPEC unit testing framework (a library developed at York University and now part of the EiffelStudio distribution).

On the Prism/Linux workstations and the VM, the ESpec Library is present by default (when creating a new project). If it is your own install, then you need to add the library.

Add ESpec library

(To add other libraries, or to add the ESPEC library that comes with your version of eiffelStudio, see here)

The ECF file will thus have the following line in it:

<library name="espec" 
location="$ISE_LIBRARY\contrib\library\testing\framework
\espec\library\espec-safe.ecf"/>

Change the code in class HELLO_WORLD to the following, in order to test if the ESpec library is working. In the tool bar, select the HELLO_WORLD class and change the class the code below:

class HELLO_WORLD inherit
	ES_TEST
create
	make
 
feature {NONE} -- Initialization
 
	make
			-- Run tests
		do
			add_boolean_case (agent t0)
			--show_errors
			show_browser
			run_espec
		end
feature -- tests
	t0: BOOLEAN
		do
			comment("t0: succeed?")
			Result := false
		end
 
end

To run the tests:

The test will succeed if you have Result := true (and you will get a green bar).