X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=web%2Ftesting;h=f86968cc4dbadb0e6266f2ee2d6e33fb536ef57c;hb=9d93ddc5daf9a96e7fcd5d9ef7fac0ddba68feb9;hp=c76a9b5f1d8c819cf63d117d7d34149fc01b3a0e;hpb=38d88c75fba266de2d8e32e2d74c377ace1e6c24;p=mono.git diff --git a/web/testing b/web/testing index c76a9b5f1d8..f86968cc4db 100644 --- a/web/testing +++ b/web/testing @@ -24,7 +24,7 @@ mcs/class/doc/TemplateTest.cs Save a copy of this file in the appropriate test subdirecty - (see below), and replace all the [text] markers with + (see below), and replace all the {text} markers with appropriate code. Comments in the template are there to guide you. You should also look at existing tests to see how other people have written them. @@ -41,29 +41,22 @@ the appropriate sub-directory under Test for the class you are testing. - Once your test class is complete, you need to add it to the - AllTests.cs file in the same directory as your new test. Add a - call to "suite.AddTest()" passing the name of your new test - class's suite property as the parameter. You will see - examples in the AllTests.cs file, so just copy and paste - inside there. - Once all of that is done, you can do a 'make test' from the top mcs directory. Your test class will be automagically included in the build and the tests will be run along with all the others. * Tips on writing Unit tests. - You should look at the NUnit documentation, as it is a - fantastic product, and includes fantastic documentation, but - here are some tips for those of you who are already reading + You should look at the NUnit documentation, + as it is a fantastic product, and includes fantastic documentation, + but here are some tips for those of you who are already reading this web page. ** Provide an unique error message for Assert() Include an unique message for each Assert() so that when the assert - fails, it is trivial to locate the failing one. Otherwise, it may be + fails, it is trivial to locate it in the source. Otherwise, it may be difficult to determine which part of the test is failing. A good way to ensure unique messages is to use something like #A01, #A02 etc. @@ -104,43 +97,10 @@ AssertEquals ("A01", myTicks[0], t1.Ticks); -** Constructors - - When writing your testcase, please make sure to provide a constructor - which takes no arguments: - -
-        public class DateTimeTest : TestCase
-        {
-
-                public DateTimeTest() : base ("[MonoTests.System.DateTimeTest]") {}
-                public DateTimeTest (string name): base(name) {}
-
-        	public static ITest Suite
-                {
-                        get {
-                                TestSuite suite = new TestSuite ();
-        			return suite;
-        		}
-        	}
-        }
-	
- -** Namespace - - Please keep the namespace within each test directory consistent - all - tests which are referenced in the same AllTests.cs must be in the same - namespace. Of course you can use subnamespaces as you like - - especially for subdirectories of your testsuite. - - For instance, if your AllTests.cs is in namespace "MonoTests" and you - have a subdirectory called "System", you can put all the tests in that - dir into namespace "MonoTests.System". - ** Test your test with the Microsoft runtime If possible, try to run your testsuite with the Microsoft runtime on - Windows and make sure all tests in it pass. This is especially + .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 .... @@ -151,9 +111,10 @@ 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 list - - we'll forward this to the Microsoft people from time to time to help - them fix their documentation and runtime. + 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.