X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=web%2Ftesting;h=ab60d7fe4d3f88aef1074b23f49c955a094f9b45;hb=50beb484c091b7eb9fdd4cba436757c12f316b8d;hp=06a616f230490cc364c47ccdd4c9a992b85752a6;hpb=ab7465ea46961ce33b982d9bea33a7a462a78072;p=mono.git diff --git a/web/testing b/web/testing index 06a616f2304..ab60d7fe4d3 100644 --- a/web/testing +++ b/web/testing @@ -1,21 +1,168 @@ * Testing + Daily test results. + Testing is an important part of the Mono project: every one of its three major components has a test suite tailored for its needs. This is very helpful, because in the course of developing the software it is very common to introduce bugs in existing code. A test suite helps us fix the bugs as soon as they are introduced. -** Class Library Tests + There are various kinds of tests in Mono: +
+ + AssertEquals("array match", compare[0], i1[0]); + AssertEquals("array match", compare[1], i1[1]); + AssertEquals("array match", compare[2], i1[2]); + AssertEquals("array match", compare[3], i1[3]); ++ + Excellent: +
+ AssertEquals("#A01", compare[0], i1[0]); + AssertEquals("#A02", compare[1], i1[1]); + AssertEquals("#A03", compare[2], i1[2]); + AssertEquals("#A04", compare[3], i1[3]); ++ + Once you used such a number in an Assert(), don't change it later on - + people might use it it identify the test in bug reports or in mailing + lists. + +** Use AssertEquals() to compare things, not Assert(). + + Do not compare two values with Assert() - if the test fails, + people have no idea what went wrong while AssertEquals() + reports the failed value. + + Ok: +
+ Assert ("A01", myTicks[0] == t1.Ticks); ++ + Excellent: +
+ AssertEquals ("A01", myTicks[0], t1.Ticks); ++ +** Test your test with the Microsoft runtime + + If possible, try to run your testsuite with the Microsoft runtime on + .NET on Windows and make sure all tests in it pass. This is especially + important if you're writing a totally new testcase - without this + check you can never be sure that your testcase contains no bugs .... + + Don't worry if you're writing your test on Linux, other people can + test it for you on Windows. + + Sometimes you may discover that a test doesn't show the expected + result when run with the Microsoft runtime - either because there is a + bug in their runtime or something is misleading or wrong in their + documentation. In this case, please put a detailed description of the + problem to mcs/class/doc/API-notes and do also report it to the + mailing list - we'll forward this to the + Microsoft people from time to time to help them fix their documentation + and runtime. + +** Unit tests. Why do unit testing? It becomes simple to run automated tests for the whole library. Unit tests are a safety net - you can @@ -25,7 +172,102 @@ be written to demonstrate the bug and its fix. Then, if you ever reintroduce the bug, you will know immediately. For more info, read + href="http://junit.sourceforge.net/doc/testinfected/testing.htm"> JUnit Test Infected: Programmers Love Writing Tests. +** Getting Started + + We welcome all contributions to the Class Libary Test Suite. + + There is information to help you get started in CVS at + mcs/class/doc/NUnitGuidelines. Once you have written your test, please + post it to mono-list. + + Someone will make sure to add the file or apply the patch as + appropriate. If you plan to be an on-going contributor and + would like to get cvs account, email miguel. + + Normally, after you send a couple of well-written new files + and/or patches to the list, you will be given cvs access. + + +* Compiler tests + + Mono ships with three compilers: C#, VB.NET and JScript. The + tests are ran by running the makefile target `make + run-test-local' in the appropriate directory. + + The C# compilation tests live in mcs/tests, and the C# error + tests live in mcs/errors. + + The VB.NET compilation tests live in mcs/btests. + + +* Runtime Tests + + These tests verify the virtual machine, to run these tests, do: + +
+ cd mono/mono/tests + make test ++ + +* ASP.NET tests + + XSP, the Mono ASP.NET server has tests for ASP.NET pages. It uses + NUnitAsp. Right now + it only has standalone tests, ie., tests that do not need their own + global.asax or web.config files. + + If you want to run them, get the xsp CVS module and install it. Then: +
+ cd xsp/nunit-tests + make + cd standalone + xsp ++ + And from another terminal: +
+ cd xsp/nunit-tests/standalone + nunit-console standalone-tests.dll ++ + +* Web Services tests + + The Test directory for the System.Web.Services assembly contains a + standalone test suite for testing web services. It tests: + +
+ cd mcs/class/System.Web.Services/Test/standalone + xsp --root server ++ + And from another terminal: +
+ cd mcs/class/System.Web.Services/Test/standalone + make + nunit-console testclient.dll ++ + This will download the wsdl documents, generate the proxies, build a dll with + the proxies, and build the nunit tests. Then you can use nunit-console or + gnunit to run the tests (the nunit dll is testclient.dll). + + Read the README file in mcs/class/System.Web.Services/Test/standalone for + more info.