我可以圍繞 NUnit、MbUnit、xUnit 或其他測試框架創建一個包裝器嗎? (Can I create a wrapper around NUnit, MbUnit, xUnit or other testing framework?)


問題描述

我可以圍繞 NUnit、MbUnit、xUnit 或其他測試框架創建一個包裝器嗎? (Can I create a wrapper around NUnit, MbUnit, xUnit or other testing framework?)

How can I create a wrapper around a testing framework? We still doesn't know which testing framework are going to use, but I need to start writing unit tests. With this question I want to know how can I switch from NUnit to mbUnit, xUnit or even MSTest.


參考解法

方法 1:

You could create a wrapper - but I think you can utilise your time much better. I'd say pick the simplest one (My personal favourite would be the war-horse NUnit) that fits your needs - the newer frameworks add functionality that help you write more complex test fixtures. However I value simplicity over "flexibility". In the future, if you find yourself wanting that "cool feature X in Y testing framework", you could either write that particular test fixture using Y. (you could also migrate the entire test fixture to use Y for consistency - but time is always scarce) - Switch between 2 unit testing framework is usually monotonous work (rename attributes) however some might be more work (disclaimer: no flying time with MbUnit)

Your comment however worries me a bit.

  1. Why is the customer deciding the testing framework that you'd use for development - it should be a choice of the development team. The customer wouldn't want you to define product requirements - would he/she ? The quality of tests doesn't depend on the framework used so I don't see how this affects the customer.

方法 2:

You could use an existing wrapper that allows you to run multiple unit test frameworks, so even if you switch frameworks you can still use the old unit tests. For the unit test frameworks you listed, I would recommend taking a look at Gallio. 

From http://www.gallio.org/...

  

At present Gallio can run tests from MbUnit versions 2 and 3, MSTest, NBehave, NUnit, xUnit.Net, csUnit, and RSpec.  Gallio provides tool support and integration with AutoCAD, CCNet, MSBuild, NAnt, NCover, Pex, Powershell, Resharper, TestDriven.Net, TypeMock, and Visual Studio Team System.

(by rcarrillopadronGishuuser386985)

參考文件

  1. Can I create a wrapper around NUnit, MbUnit, xUnit or other testing framework? (CC BY-SA 3.0/4.0)

#mbunit #mstest #nunit #xunit #wrapper






相關問題

我可以圍繞 NUnit、MbUnit、xUnit 或其他測試框架創建一個包裝器嗎? (Can I create a wrapper around NUnit, MbUnit, xUnit or other testing framework?)

MbUnit / Gallio 上的 FixtureSetup 未運行 (FixtureSetup on MbUnit / Gallio doesn't run)

我可以使用我的 WatiN 測試來進行壓力測試嗎? (Can i use my WatiN tests to stresstest?)

Debug Unit Test bằng cách sử dụng Resharper 7 cho MBUnit ném ra một ngoại lệ (Debug Unit Tests using Resharper 7 for MBUnit throws an exception)

TestDriven.NET沒有運行我的MbUnit的SetUp方法 (TestDriven.NET is not running my SetUp methods for MbUnit)

Gallio用戶,您使用此工具有哪些優缺點? (Users of Gallio, what Advantages and Disadvantages have you experienced using this Tool?)

你知道任何關於 MBUnit 的教程嗎? (do you know any tutorial for MBUnit?)

MbUnit:比較雙打最優雅的方式? (MbUnit: The most elegant way to compare doubles?)

如何將 MBUnit 測試添加到 CruiseControl.Net 配置文件 (how to add MBUnit test to CruiseControl.Net config file)

MbUnit 回滾 (MbUnit Rollback)

使用 MbUnit3 的 [Rollback] 對 NHibernate 與 SQLite 的交互進行單元測試 (Using MbUnit3's [Rollback] for unit testing NHibernate interactions with SQLite)

MbUnit.framework.dll 可並行化屬性 (MbUnit.framework.dll Parallelizable attribute)







留言討論