[Mono-list] NUnit on Linux - first steps

Martin Baulig martin@widget.gnome.org
Tue, 26 Feb 2002 20:11:19 -0500


Hi guys,

there's now basic support to run the NUnit tests on Linux.

The build in class/corlib/Test now creates an additional executable
called RunTests.exe which you can run either on Windows or on Linux
with the mono runtime.

To add/edit which tests you want to run, do the following:

* edit class/corlib/Test/MartinTests.cs and
  class/corlib/Test/System/MartinTests.cs (you can also use AllTests.cs,
  but not all of the tests work on Linux yet).

* run ./scan-tests.pl MartinTests.cs > TheTests.cs

  This recreates the file TheTests.cs which contains all the tests.

  NOTE: You also need to re-run scan-tests.pl if you added/removed any
        test method in any of the tests.

* run NAnt - it'll regenerate the RunTests.exe

* run RunTests.exe and have fun :-)

The following tests are currently work on Linux (I haven't tried much
of the others):

	BooleanTest
	StringTest
	TimeSpanTest
	DateTimeTest
	TimeZoneTest

How it works:

NUnit currently works on Linux if you call all your tests statically. To
do this you must override the RunTest() method in your testcase. To avoid
editing all the test files and manually listing all test methods there,
I wrote a small perl script which extracts the names of all the tests and
creates a new file TheTest.cs which contains overloaded classes for all the
tests - so everything is done in this automatically generated TheTest.cs.