7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

NUnitでTestCaseSourceを複数指定する方法

Posted at

testcaseを大量に書くときにTestCaseSourceを使用して別ファイルにTestCaseを書くが、
そのTestCaseも複数指定したいときの方法がよくわからなかったので、試した。
以下の記法で実行できる。

    public class TestSuite2
    {
        public static Object[] one =
        {
            new object[]{"100"},
            new object[]{"101"},
        };
        public static Object[] two =
        {
            new object[]{"200"},
            new object[]{"201"},
        };
    }

    [TestFixture]
    public class Class1
    {
        [Category("list")]
        [Test, TestCaseSource(typeof(TestSuite2), "one"), TestCaseSource(typeof(TestSuite2), "two")]
        public void testCaseSource(string suite)
        {
             // test code
        }
    }
7
6
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?