Nunit-console runner 没有 运行 任何测试
Nunit-console runner not running any tests
所以我正在尝试 运行 由 TeamCity 触发的 powershell 脚本 运行 特定的单元测试,该单元测试基于每次 github 提交时更改的文件名.
我是这样从命令行运行安装它的:
C:\MyFolder\bin\NUnit.ConsoleRunner.3.4.1\tools\nunit3-console.exe "C:\MyFolder\Bin\UnitTesting.dll" --test="MyFolder.QuickTests.DaoTests.ProductDaoTests.ProductBasicTest"
但我一直收到这个消息,运行它从未运行进行过任何测试:
NUnit Console Runner 3.4.1
Copyright (C) 2016 Charlie Poole
Runtime Environment
OS Version: Microsoft Windows NT 10.0.14393.0
CLR Version: 4.0.30319.42000
Test Files
MyFolder\Bin\UnitTesting.dll
Test Filters
Test: MyFolder.QuickTests.DaoTests.ProductDaoTests.ProductBasicTest
Run Settings
WorkDirectory: C:\Users\Me
ImageRuntimeVersion: 4.0.30319
ImageTargetFrameworkName: .NETFramework,Version=v4.0
ImageRequiresX86: False
ImageRequiresDefaultAppDomainAssemblyResolver: False
NumberOfTestWorkers: 2
Test Run Summary
Overall result: Passed
Test Count: 0, Passed: 0, Failed: 0, Inconclusive: 0, Skipped: 0
Start time: 2016-10-17 20:28:43Z
End time: 2016-10-17 20:28:43Z
Duration: 0.303 seconds
Results (nunit3) saved as TestResult.xml
现在,当我 运行 它没有像这样的 --test 命令时:
C:\MyFolder\bin\NUnit.ConsoleRunner.3.4.1\tools\nunit3-console.exe "C:\MyFolder\Bin\UnitTesting.dll"
它 运行 我们拥有的每个单元测试,但我不想 运行 全部,我想 运行 特定的快速测试,并且只 运行 当我们转到 staging/production 服务器时,我们的开发人员不必在每次提交内容时都等待 15 到 20 分钟。
一些附加信息:
- 我为此使用的命名空间是
MyFolder.QuickTests.DaoTests.ProductDaoTests
我拨打的Class是:
ProductBasicTest
文件夹目录等部分名称已更改,因为它们是文件目录的 %teamcity% 占位符。
我做错了什么不能运行具体测试?
出于某种原因,我的 nunit-console 无法识别 /运行 命令或 /fixture 或 --test=.
编辑:
我升级到 3.5.0 后仍然遇到同样的问题,我无法使用 --test。
C:\MyFolder\bin\NUnit.ConsoleRunner.3.5.0\tools\nunit3-console.exe "C:\MyFolder\Bin\UnitTesting.dll" --test="MyFolder.QuickTests.DaoTests.ProductDaoTests.ProductBasicTest"
那是新位置,遇到同样的问题。
当我执行 --where for MyFolder 时,它使 Powershell 崩溃,但实际上 运行 什么也没发生。
当我执行 --explore 时,它与 --where 对 MyFolder 的作用相同,对 MyFolder.QuickTests 不执行任何操作。
编辑编辑:
感谢 Rob,我找到了文档 here 并查看了带有 --where "name=ProductBasicTest" 的 --where 函数,它将 运行 该测试套件中的所有文件!
感谢 Rob,我遇到的其中一个问题 运行 是它无法使用 QuickTests 正确识别我的命名空间。因此,每当我 运行 函数时,它都没有 运行 正确。
要解决此问题,您可以转到测试 xml 文件输出并查看 运行ning 测试使用的名称。
要运行这些单独的你可以运行它的名称与命令:
"nunit3-console.exe C:\PathToDll.dll --where "name = NameOfTest"
所以我正在尝试 运行 由 TeamCity 触发的 powershell 脚本 运行 特定的单元测试,该单元测试基于每次 github 提交时更改的文件名.
我是这样从命令行运行安装它的:
C:\MyFolder\bin\NUnit.ConsoleRunner.3.4.1\tools\nunit3-console.exe "C:\MyFolder\Bin\UnitTesting.dll" --test="MyFolder.QuickTests.DaoTests.ProductDaoTests.ProductBasicTest"
但我一直收到这个消息,运行它从未运行进行过任何测试:
NUnit Console Runner 3.4.1
Copyright (C) 2016 Charlie Poole
Runtime Environment
OS Version: Microsoft Windows NT 10.0.14393.0
CLR Version: 4.0.30319.42000
Test Files
MyFolder\Bin\UnitTesting.dll
Test Filters
Test: MyFolder.QuickTests.DaoTests.ProductDaoTests.ProductBasicTest
Run Settings
WorkDirectory: C:\Users\Me
ImageRuntimeVersion: 4.0.30319
ImageTargetFrameworkName: .NETFramework,Version=v4.0
ImageRequiresX86: False
ImageRequiresDefaultAppDomainAssemblyResolver: False
NumberOfTestWorkers: 2
Test Run Summary
Overall result: Passed
Test Count: 0, Passed: 0, Failed: 0, Inconclusive: 0, Skipped: 0
Start time: 2016-10-17 20:28:43Z
End time: 2016-10-17 20:28:43Z
Duration: 0.303 seconds
Results (nunit3) saved as TestResult.xml
现在,当我 运行 它没有像这样的 --test 命令时:
C:\MyFolder\bin\NUnit.ConsoleRunner.3.4.1\tools\nunit3-console.exe "C:\MyFolder\Bin\UnitTesting.dll"
它 运行 我们拥有的每个单元测试,但我不想 运行 全部,我想 运行 特定的快速测试,并且只 运行 当我们转到 staging/production 服务器时,我们的开发人员不必在每次提交内容时都等待 15 到 20 分钟。
一些附加信息: - 我为此使用的命名空间是
MyFolder.QuickTests.DaoTests.ProductDaoTests
我拨打的Class是:
ProductBasicTest
文件夹目录等部分名称已更改,因为它们是文件目录的 %teamcity% 占位符。
我做错了什么不能运行具体测试?
出于某种原因,我的 nunit-console 无法识别 /运行 命令或 /fixture 或 --test=.
编辑:
我升级到 3.5.0 后仍然遇到同样的问题,我无法使用 --test。
C:\MyFolder\bin\NUnit.ConsoleRunner.3.5.0\tools\nunit3-console.exe "C:\MyFolder\Bin\UnitTesting.dll" --test="MyFolder.QuickTests.DaoTests.ProductDaoTests.ProductBasicTest"
那是新位置,遇到同样的问题。
当我执行 --where for MyFolder 时,它使 Powershell 崩溃,但实际上 运行 什么也没发生。
当我执行 --explore 时,它与 --where 对 MyFolder 的作用相同,对 MyFolder.QuickTests 不执行任何操作。
编辑编辑:
感谢 Rob,我找到了文档 here 并查看了带有 --where "name=ProductBasicTest" 的 --where 函数,它将 运行 该测试套件中的所有文件!
感谢 Rob,我遇到的其中一个问题 运行 是它无法使用 QuickTests 正确识别我的命名空间。因此,每当我 运行 函数时,它都没有 运行 正确。
要解决此问题,您可以转到测试 xml 文件输出并查看 运行ning 测试使用的名称。
要运行这些单独的你可以运行它的名称与命令:
"nunit3-console.exe C:\PathToDll.dll --where "name = NameOfTest"