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怎么测试