为什么 NUnit 测试适配器在转换功能时给我 FileNotFound 异常?

Why does the NUnit Test Adapter give me FileNotFound Exception while converting features?

我使用的是 VisualStudio 2015。我已经安装了 NUnit3 (3.5)、NUnit3TestAdapter(3.6 还安装了 VS 扩展)、SpecFlow (2.1.0) 和相应的 Selenium 驱动程序 NuGet 包。

我有一个解决方案,其中包含两个项目。一个项目构建完美,并在其中发现功能测试。但是我的其他项目构建完美并且没有发现测试。如果我转到测试输出,我会收到以下 FileNotFound/Converting 错误:

------ Discover test started ------
NUnit Adapter 3.6.1.0: Test discovery starting
Exception System.IO.FileNotFoundException, Exception converting Calculations.Calculations.Feature.SendANewQuote.SendANewQuote("18-1980","150","Yearly","1337","RiskProfile","email@email.com",System.String[])
Could not find file 'PathToCalculations\bin\Config\Calculations.pdb'.

我在那个项目中的所有其他测试都是一样的。我的其他项目没有这个问题,但所有参考和包都是相同的。

我该如何修复这个错误,让 NUnit 测试适配器发挥它的魔力?

适配器或 VS 最近发生了变化,这意味着使用适配器时必须生成 pdb 文件。这里有一个未解决的问题需要调查:https://github.com/nunit/nunit3-vs-adapter/issues/276

听起来您可能没有为 'Calculations' 项目生成 pdb。您可以通过进入项目设置 > 构建 > 高级,然后从调试信息下拉列表中选择 fullpdb-only 来打开它。