Follow @RoyOsherove on Twitter

Unit Test Tip: Encode test data as part of your test xml comments

What a cool idea, and simple too.

You can encode various test data as XML comments on your test, and then use them in your test by parsing the XML file generated by the compiler. More details here.

Lars Thurop wrote the CommentReader which can enable a test that looks like this:


        /// <sample>
        ///        create table Orders ( id int, customer int );
        /// </sample>
        public void TestNonXmlComment()
            string content = CommentReader.GetElement("sample");
            Assert.AreEqual(@"create table Orders ( id int, customer int );",

Implementing Unit Test MetaData using XtUnit custom attributes

ThreadTester with new Ability: StopWhenTrue() and thread polling