2016-08-15 50 views
2

我正在使用NUnit 3並在使用測試套件時遇到問題。我看到這個Documentation page,但它是舊版本,我在新文檔中找不到任何東西。如何在NUnit 3中使用測試套件

這不起作用,因爲[Suite]無效。

[Suite] 
public static IEnumerable Suite 
{ 
    get 
    { 
    ArrayList suite = new ArrayList(); 
    suite.Add(typeof(OneTestCase)); 
    suite.Add(typeof(AssemblyTests)); 
    suite.Add(typeof(NoNamespaceTestFixture)); 
    return suite; 
    } 

回答

2

SuiteAttributehas been removed from NUnit 3(見屬性表)。

您應該改用擴展Test Selection Language在命令行轉輪來控制要運行,或者不同結構的試驗測試組。

+0

好的,謝謝:)! 但是這方面的所有東西[鏈接](https://github.com/nunit/docs/wiki/Test-Selection-Language)是用於控制檯/終端的,對吧?所以我不能像在我的問題中的舊例子那樣寫它? – Perazim

+1

正確。推理(我相信)是舊的方式太僵化,因爲它需要更改代碼來更改運行的測試。命令行可以提供相同的功能,但更容易更改。 –