nunit怎么测试_NUnit / Watir / Ruby测试集成

nunit怎么测试

nunit怎么测试

took my NUnit/Watir integration POC and ran screaming down the street with it and has released his code on CodeProject. There are also some other integration projects in a similar vein going on that I'll post about later.

带走了我的NUnit / Watir集成POC,在大街上大喊大叫,在CodeProject上发布了他的代码。 还有一些其他类似的集成项目,我将在稍后发布。

Travis' solution is clever in it's use of attributes. It does everything automatically that I did manually with resource extraction. The easiest way to grok it is to look at a sample NUnit test you'd write:

Travis的解决方案巧妙地使用了属性。 它会自动执行我在资源提取中手动执行的所有操作。 最简单的方法是查看要编写的示例NUnit测试:

using System;

使用系统;

using NUnit.Framework;

使用NUnit.Framework;

using RTE = Foo.RubyTestExecutor;

使用RTE = Foo.RubyTestExecutor;

namespace Foo.Test

命名空间Foo.Test

{

{

    [TestFixture]

[TestFixture]

    public class RubyTestExecutor

公共类RubyTestExecutor

    {

{

        [Test(Description="Verifies you may run standard NUnit-only tests.")]

[Test(Description =“验证您可以运行仅NUnit的标准测试。”]]

        public void NUnitOnly_NoRubyAttrib()

公共无效NUnitOnly_NoRubyAttrib()

        {

{

            Assert.IsTrue(true, "This NUnit-only test should always pass.");

Assert.IsTrue( true ,“此仅NUnit的测试应始终通过。”);

        }

}

        [RubyTest("Foo.Test.Scripts.RubyTest.rb", "test_Valid")]

[RubyTest(“ Foo.Test.Scripts.RubyTest.rb”,“ test_Valid”)]

        [Test(Description="Verifies a valid Ruby test will execute.")]

[Test(Description =“验证是否将执行有效的Ruby测试。”)

        public void RubyTest_Valid()

公共无效RubyTest_Valid()

        {

{

            RTE.ExecuteTest();

RTE.ExecuteTest();

        }

}

        [WatirTest("Foo.Test.Scripts.WatirTest.rb", "test_Valid")]

[WatirTest(“ Foo.Test.Scripts.WatirTest.rb”,“ test_Valid”)]

        [Test(Description="Verifies a valid WATIR test will execute.")]

[Test(Description =“验证是否将执行有效的WATIR测试。”)

        public void WatirTest_Valid()

公共无效WatirTest_Valid()

        {

{

            RTE.ExecuteTest();

RTE.ExecuteTest();

        }

}

        [RubySupportFile("Foo.Test.Scripts.supportfile.txt",

[RubySupportFile(“ Foo.Test.Scripts.supportfile.txt”,

            "supportfile.txt")]

“ supportfile.txt”)]

        [RubySupportFile("Foo.Test.Scripts.SubFolder1.supportfile1.txt",

[RubySupportFile(“ Foo.Test.Scripts.SubFolder1.supportfile1.txt”,

            @"SubFolder1\supportfile1.txt")]

@“ SubFolder1 \ supportfile1.txt”)]

        [RubyTest("Foo.Test.Scripts.RubyTest.rb",

[RubyTest(“ Foo.Test.Scripts.RubyTest.rb”,

            "test_RubySupportFile")]

“ test_RubySupportFile”)]

        [Test(Description="Verifies Ruby support files can be extracted.")]

[Test(Description =“验证可以提取Ruby支持文件。”]]

        public void RubySupportFile_Valid()

公共无效RubySupportFile_Valid()

        {

{

            RTE.ExecuteTest();

RTE.ExecuteTest();

        }

}

    }

}

}

}

It's the ExecuteTest() of course that does all the heavy lifting by walking the call stack looking for Attributes and acting on them. Check out his article and get involved.

当然,是ExecuteTest()通过遍历调用堆栈以查找属性并对其执行操作来完成所有繁重的工作。 查看他的文章并参与

翻译自: https://www.hanselman.com/blog/nunitwatirruby-test-integration

nunit怎么测试

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值