RequiredAddin特性用於提示一個程序集須要特殊的插件才能保證功能正常。若是沒有安裝插件,整個程序集會被標記爲未運行。多線程
Note:在Alpha-3版本,這個特性能夠運用於類或方法。但這是受限制的,主要有2個緣由:less
一、如因爲遺漏了插件,那麼這個方法或者類不被承認爲一個測試,NUnit一直都不會處理它。測試
二、若是這個方法或者類又不一樣的插件處理,插件肯能沒法識別這個特性ui
在下個版本中這個特性可能會被限制於程序集。this
[assembly: RequiredAddin("MyTestFixtureAddin")] [assembly: RequiredAddin("MyTestAddin")] [assembly: RequiredAddin("MyDecoratorAddin")] ... namespace NUnit.Tests { using System; using NUnit.Framework; [MyTestFixture] public class MyTests { [MyTest] public void SomeTest() { ... } } [TestFixture, MyDecorator] public class MoreTests { [Test, MyDecorator] public void AnotherTest() { ... } } }
RequiresMTA特性能夠應用與測試方法、類或者程序集,用於指定這些測試應該在多線程環境下運行。若是父類測試沒有在多線程中運行那麼它會建立一個新的進程。spa
Note:在測試方法你也能夠使用RequiresMTA特性。儘管運行時只在執行程序集入口確認,許多用戶但願在測試上工做,因此咱們把它看成同義詞。插件
// An MTA thread will be created and used to run // all the tests in the assembly [assembly:RequiresMTA] ... // TestFixture requiring a separate thread [TestFixture, RequiresMTA] public class FixtureRequiringMTA { // An MTA thread will be created and all // tests in the fixture will run on it // unless the containing assembly is // already running on an MTA Thread } [TestFixture] public class AnotherFixture { [Test, RequiresMTA] public void TestRequiringMTA() { // A separate thread will be created for this test // unless the containing fixture is already running // in the MTA. } }