[Adapdev-commits] Adapdev/src/Adapdev.UnitTest.TestRunner.Tests ZanebugFitTests.cs,NONE,1.1 Adapdev.
Status: Beta
Brought to you by:
intesar66
From: Sean M. <int...@us...> - 2005-11-28 23:40:33
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.TestRunner.Tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19786/src/Adapdev.UnitTest.TestRunner.Tests Modified Files: Adapdev.UnitTest.TestRunner.Tests.csproj AssemblyInfo.cs Added Files: ZanebugFitTests.cs Log Message: Updated TestDriven.NET integration Added TestDriven.NET FitTests Changed version number to 0.8.4 --- NEW FILE: ZanebugFitTests.cs --- using Adapdev.UnitTest; /// <assembly> /// <reference>lib\Adapdev.UnitTest.dll</reference> /// </assembly> namespace TestDriven.FitTests.ZanebugFitTests { using System; using Adapdev.UnitTest; using System.Diagnostics; using System.Threading; /// <test pass="2" /> [TestFixture] public class PassTests { /// <test pass="1" /> [Test] public void Test1() { Trace.WriteLine("Hello, World!"); } /// <test pass="1" /> [Test(Description = "Basic test")] public void Test2() { } } /// <test fail="1" /> [TestFixture] public class FailTests { /// <test fail="1" /> [Test] public void Test1() { Assert.Fail("Boom!"); } } // NOTE: This is different to NUnit where ignore="2" /// <test ignore="1" /> [TestFixture] public class IgnoreTests { // FIX: This test ends up being executed as an ad-hoc test. // Are tests makred as [Ignore] reported by Zanebug? /// <test fail="1" /> [Test, Ignore("Ignore Me")] public void Test1() { Assert.Fail("Boom!"); } /// <test ignore="1" /> [Test] public void Test2() { Assert.Ignore("Ignore Me!"); } } /// <test pass="2" /> [TestFixture] public class TestFixtureSetUpTests { int count; [TestFixtureSetUp] public void TestFixtureSetUp() { this.count++; } [Test] public void Test1() { Assert.AreEqual(1, this.count); } [Test] public void Test2() { Assert.AreEqual(1, this.count); } } /// <test pass="1" fail="1" /> [TestFixture] public class TestSetUpTests { int count; // Runs once at the beginning of each Test iteration [TestSetUp] public void TestSetUp() { this.count++; } [Test] public void Test1() { Assert.AreEqual(1, this.count); } [Test] public void Test2() { Assert.AreEqual(1, this.count); } } /// <test pass="1" fail="1" /> [TestFixture] public class SetUpTests { int count; // Runs once at the beginning of each Test iteration [SetUp] public void SetUp() { this.count++; } [Test] public void Test1() { Assert.AreEqual(1, this.count); } [Test] public void Test2() { Assert.AreEqual(1, this.count); } } /// <test pass="2" /> [TestFixture] public class TestSetUpSpecifiedTests { bool isSetUp; [TestSetUp("SpecifiedTest")] public void TestSetUp() { this.isSetUp = true; } [TearDown] public void TearDown() { this.isSetUp = false; } [Test] public void SpecifiedTest() { Assert.IsTrue(this.isSetUp); } [Test] public void Test2() { Assert.IsFalse(this.isSetUp); } } // NOTE: Why doesn't this work? /* /// <test pass="1" fail="1" /> [TestFixture] public class MaxMemTests { byte[] bytes; [Test(Description = "A Test who's total memory consumption should not exceed 200K")] [MaxKMemory(200)] public void MaxKMemory1() { } [Test(Description = "A Test who's total memory consumption should not exceed 200K")] [MaxKMemory(200)] public void MaxKMemory2() { this.bytes = new byte[300 * 1024]; } } */ /// <test pass="1" fail="1" /> [TestFixture] public class MinOperationsPerSecondTests { [Test(Description = "A Test that should be able to run at least 10X per second.")] [MinOperationsPerSecond(10)] public void MinOperationsPerSecondFail() { Thread.Sleep(1000); } [Test(Description = "A Test that should be able to run at least 10X per second.")] [MinOperationsPerSecond(10)] public void MinOperationsPerSecondPass() { } } /// <test pass="4" fail="1" /> [TestFixture] public class RepeatTests { int count; [Test(Description = "A Test that is repeated 5X")] [Repeat(5)] public void Repeat() { this.count++; Assert.IsTrue(this.count < 5); } } /// <test pass="2" fail="1" /> [TestFixture] public class RepeatWithDelayTests { DateTime start; [TestFixtureSetUp] public void TestFixtureSetUp() { this.start = DateTime.Now; } [Test(Description = "A Test that is repeated 5X")] [Repeat(3, 1000)] public void Repeat() { Assert.IsTrue((DateTime.Now - this.start) < TimeSpan.FromMilliseconds(2500)); } } // NOTE: Why is this not true? /* /// <test pass="1" fail="1" /> [TestFixture] public class TestTearDownTests { int count; [TestTearDown] public void TestTearDown() { this.count++; Assert.AreEqual(1, this.count); } [Test] public void Test1() { } [Test] public void Test2() { } } */ // NOTE: Why is this not true? /* /// <test pass="1" fail="1" /> [TestFixture] public class TearDownTests { int count; [TearDown] public void TearDown() { this.count++; Assert.AreEqual(1, this.count); } [Test] public void Test1() { } [Test] public void Test2() { } } */ // NOTE: Why doesn't this work? /* /// <test pass="1" fail="1" /> [TestFixture] public class TestTearDownSpecifiedTests { bool isSpecified; [TestTearDown("SpecifiedTest")] public void TestTearDown() { Assert.Fail("Fail on SpecifiedTest"); } [Test] public void SpecifiedTest() { this.isSpecified = true; } [Test] public void NotSpecifiedTest() { this.isSpecified = false; } } */ [TestFixture] public class ZanebugTest { // Runs only once, when the test assembly is dynamically loaded public ZanebugTest() { } // Runs once at the beginning of each TestFixture iteration [TestFixtureSetUp] public void TestFixtureSetUp() { Console.WriteLine("TestFixtureSetUp"); } // Runs once at the beginning of each Test iteration [TestSetUp] public void TestSetUp() { Console.WriteLine("TestSetUp"); } // Runs once at the beginning of each Test iteration [SetUp] public void SetUp() { Console.WriteLine("SetUp"); } // Runs once at the beginning of SimpleTest only [TestSetUp("SimpleTest")] public void SpecificTestSetUp() { Console.WriteLine("SpecificTestSetUp runs only for SimpleTest"); } // A Test [Test(Description = "Basic test")] public void SimpleTest() { Console.WriteLine("SimpleTest"); } // Runs once at the end of SimpleTest only [TestTearDown("SimpleTest")] public void SpecificTestTearDown() { Console.WriteLine("SpecificTestTearDown runs only for SimpleTest"); } // A Test with a Category [Test(Category = "Some Category", Description = "Demonstrates a Test that's assigned to a category")] public void TestWithCategory() { Console.WriteLine("Test with category"); } // A Test with a Description [Test(Description = "Demonstrates a Test that has a description")] public void TestWithDescription() { Console.WriteLine("Test with description"); } // A Test that is expecting a specific Exception // type to be thrown or any child class [Test(Description = "A Test that expects an Exception to be thrown.")] [ExpectedException(typeof(Exception))] public void ExpectedException() { Console.WriteLine("ExpectedException"); throw new Exception("This Exception is expected"); } // A Test that is expecting a specific Exception // type to be thrown with a specific message [Test(Description = "A Test that expects an Exception to be thrown with a specific message.")] [ExpectedException(typeof(Exception), "This Exception is expected")] public void ExpectedExceptionWithMessage() { Console.WriteLine("ExpectedException"); throw new Exception("This Exception is expected"); } // A Test that is expecting a specific Exception // type to be thrown with a specific message and fails [Test(Description = "A Test that expects an Exception to be thrown with a specific message and receives the wrong one.")] [ExpectedException(typeof(Exception), "This Exception is expected")] public void FailExpectedExceptionWithMessage() { Console.WriteLine("ExpectedException"); throw new Exception("This Exception is not expected"); } // A Test that is expecting a specific DivideByZeroException // type to be thrown or any child class [Test] [ExpectedException(typeof(Exception))] public void ExpectedDivideByZeroException() { Console.WriteLine("ExpectedException"); throw new DivideByZeroException("This Exception is expected."); } // A Test that will fail because the ExpectedException is not thrown [Test(Description = "A Test that expects an Exception to be thrown, but fails because one isn't.")] [ExpectedException(typeof(Exception))] public void FailExpectedException() { Console.WriteLine("ExpectedException"); } // A Test that will be ignored (not run) by default [Test(Description = "A Test that is ignored, with no reason provided.")] [Ignore] public void Ignore() { Console.WriteLine("Ignore"); } // A Test that will be ignored (not run) by default // and provides a reason [Test(Description = "A Test that is ignored, with a reason provided.")] [Ignore("Some reason")] public void IgnoreWithReason() { Console.WriteLine("Ignore with reason"); } // A Test that specifies the maximum amount of memory // that the Test can consume [Test(Description = "A Test who's total memory consumption should not exceed 200K")] [MaxKMemory(200)] public void MaxKMemory() { Console.WriteLine("MaxKMemory"); } [Test] public void AssertFail() { Assert.Fail("Boom!"); } // A Test that will fail if it can't be repeated // the min number of times in a second [Test(Description = "A Test that should be able to run at least 10X per second.")] [MinOperationsPerSecond(10)] public void MinOperationsPerSecond() { Console.WriteLine("MinOperationsPerSecond"); } // A Test that is repeated a set number of times [Test(Description = "A Test that is repeated 5X")] [Repeat(5)] public void Repeat() { Console.WriteLine("Repeat"); } // A Test that is repeated a set number of times // with a 3 second delay in between [Test(Description = "A Test that is repeated 5X, with a 3 second delay between each run.")] [Ignore] [Repeat(5, 3000)] public void RepeatWithDelay() { Console.WriteLine("Repeat with delay"); } // Runs once at the end of each Test iteration [TearDown] public void TearDown() { Console.WriteLine("TearDown"); } // Runs once at the end of each Test iteration [TestTearDown] public void TestTearDown() { Console.WriteLine("TestTearDown"); } // Runs once at the end of the TestFixture iteration [TestFixtureTearDown] public void TestFixtureTearDown() { Console.WriteLine("TestFixtureTearDown"); } } } Index: Adapdev.UnitTest.TestRunner.Tests.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.TestRunner.Tests/Adapdev.UnitTest.TestRunner.Tests.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Adapdev.UnitTest.TestRunner.Tests.csproj 16 Nov 2005 07:01:59 -0000 1.3 --- Adapdev.UnitTest.TestRunner.Tests.csproj 28 Nov 2005 23:40:24 -0000 1.4 *************** *** 120,123 **** --- 120,128 ---- /> <File + RelPath = "ZanebugFitTests.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "ZanebugTest.cs" SubType = "Code" Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.TestRunner.Tests/AssemblyInfo.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AssemblyInfo.cs 16 Nov 2005 07:01:59 -0000 1.3 --- AssemblyInfo.cs 28 Nov 2005 23:40:24 -0000 1.4 *************** *** 17,21 **** [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] ! [assembly: CustomTestRunner(typeof(AdapdevTestRunner))] --- 17,21 ---- [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] ! //[assembly: CustomTestRunner(typeof(AdapdevTestRunner))] |