NUnit TestCase with Generics

NUnit test methods actually can be generic as long as the generic type arguments can be inferred from parameters: [TestCase(42)] [TestCase(“string”)] [TestCase(double.Epsilon)] public void GenericTest<T>(T instance) { Console.WriteLine(instance); } If the generic arguments cannot be inferred, the test runner will not have a clue how to resolve type arguments: [TestCase(42)] [TestCase(“string”)] [TestCase(double.Epsilon)] public void GenericTest<T>(object … Read more

Test cases in inner classes with JUnit

You should annontate your class with @RunWith(Enclosed.class), and like others said, declare the inner classes as static: @RunWith(Enclosed.class) public class DogTests { public static class BarkTests { @Test public void quietBark_IsAtLeastAudible() { } @Test public void loudBark_ScaresAveragePerson() { } } public static class EatTests { @Test public void normalFood_IsEaten() { } @Test public void badFood_ThrowsFit() … Read more

Does MSTest have an equivalent to NUnit’s TestCase?

Microsoft recently announced “MSTest V2” (see blog-article). This allows you to consistently (desktop, UWP, …) use the DataRow-attribute! [TestClass] public class StringFormatUtilsTest { [DataTestMethod] [DataRow(“tttt”, “”)] [DataRow(“”, “”)] [DataRow(“t3a4b5”, “345”)] [DataRow(“3&amp;amp;5*”, “35”)] [DataRow(“123”, “123”)] public void StripNonNumeric(string before, string expected) { string actual = FormatUtils.StripNonNumeric(before); Assert.AreEqual(expected, actual); } } Again, Visual Studio Express’ Test Explorer … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)