1. <small id='Kuxgw'></small><noframes id='Kuxgw'>

      <bdo id='Kuxgw'></bdo><ul id='Kuxgw'></ul>
    1. <tfoot id='Kuxgw'></tfoot>

      <i id='Kuxgw'><tr id='Kuxgw'><dt id='Kuxgw'><q id='Kuxgw'><span id='Kuxgw'><b id='Kuxgw'><form id='Kuxgw'><ins id='Kuxgw'></ins><ul id='Kuxgw'></ul><sub id='Kuxgw'></sub></form><legend id='Kuxgw'></legend><bdo id='Kuxgw'><pre id='Kuxgw'><center id='Kuxgw'></center></pre></bdo></b><th id='Kuxgw'></th></span></q></dt></tr></i><div id='Kuxgw'><tfoot id='Kuxgw'></tfoot><dl id='Kuxgw'><fieldset id='Kuxgw'></fieldset></dl></div>

      <legend id='Kuxgw'><style id='Kuxgw'><dir id='Kuxgw'><q id='Kuxgw'></q></dir></style></legend>
    2. Xunit 单元测试不会运行

      时间:2023-09-15
        <tfoot id='3Qgwu'></tfoot>

        <small id='3Qgwu'></small><noframes id='3Qgwu'>

          <tbody id='3Qgwu'></tbody>

            <i id='3Qgwu'><tr id='3Qgwu'><dt id='3Qgwu'><q id='3Qgwu'><span id='3Qgwu'><b id='3Qgwu'><form id='3Qgwu'><ins id='3Qgwu'></ins><ul id='3Qgwu'></ul><sub id='3Qgwu'></sub></form><legend id='3Qgwu'></legend><bdo id='3Qgwu'><pre id='3Qgwu'><center id='3Qgwu'></center></pre></bdo></b><th id='3Qgwu'></th></span></q></dt></tr></i><div id='3Qgwu'><tfoot id='3Qgwu'></tfoot><dl id='3Qgwu'><fieldset id='3Qgwu'></fieldset></dl></div>
          • <legend id='3Qgwu'><style id='3Qgwu'><dir id='3Qgwu'><q id='3Qgwu'></q></dir></style></legend>
                <bdo id='3Qgwu'></bdo><ul id='3Qgwu'></ul>

                本文介绍了Xunit 单元测试不会运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我完全被这个问题所困扰.所以我的团队在服务测试项目中有一个单元测试项目.测试是在测试资源管理器窗格中发现的,但是当我尝试运行测试时,会出现以下错误:

                I am completely stuck on this issue. So my team has a unit test project in a services test project. The tests are discovered in the test explorer pane however when I try and run the tests I get these errors:

                '具有相同uri的多个测试适配器'executor://xunit/VsTestRunner2' 被发现.忽略适配器'Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner'.请卸载冲突的适配器以避免此警告'

                'Multiple test adapters with the same uri 'executor://xunit/VsTestRunner2' were found. Ignoring adapter 'Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner'. Please uninstall the conflicting adapter(s) to avoid this warning'

                '[xUnit.net 00:00:00.0251250] 跳过:(找不到依赖程序集 'Microsoft.Extensions.DependencyModel,版本=1.1.0')'

                '[xUnit.net 00:00:00.0251250] Skipping: (could not find dependent assembly 'Microsoft.Extensions.DependencyModel, Version=1.1.0')'

                'C: 中没有可用的测试.确保测试发现者执行人注册和平台&框架版本设置正确,然后重试.'

                'No test is available in C:. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.'

                上下文信息:

                • Xunit 2.2.0
                • Visual Studio 15.5.2
                • Windows 10 1709 内部版本:16299.125

                我的测试项目 project.json:

                My Test Projects project.json:

                {
                   "version": "1.0.0-*",
                   "testRunner": "xunit",
                    "dependencies": {
                       "dotnet-test-xunit": "2.2.0-preview2-build1029",
                       "Microsoft.AspNetCore.Mvc.ViewFeatures": "1.1.3",
                       "Microsoft.DiaSymReader": "1.0.8",
                       "Microsoft.DiaSymReader.Native": "1.4.1",
                       "Microsoft.Extensions.Logging.Abstractions": "1.1.2",
                       "Microsoft.Extensions.Testing.Abstractions": "1.0.0-preview2-003121",
                       "Newtonsoft.Json": "9.0.1",
                       "WebServices": "1.0.0-*",
                       "xunit": "2.2.0",
                       "xunit.abstractions": "2.0.1",
                       "xunit.assert": "2.2.0",
                       "xunit.core": "2.2.0",
                       "xunit.extensibility.core": "2.2.0",
                       "xunit.extensibility.execution": "2.2.0",
                       "xunit.runner.utility": "2.2.0"
                   },
                   "frameworks": {
                    "net461": {
                        "dependencies": {
                            "Microsoft.NETCore.Platforms": "1.1.0"
                        }
                    }
                }
                

                奇怪的是它对我的团队成员有用.但不是我.我们环境的不同之处在于:来自 Windows 和 Visual Studio 的最新更新,而它们落后一两个更新.

                The Weird thing is that it works for my team members. But not me. The differences in our environments are: the latest update from Windows and Visual Studio, while they are an update or two behind.

                有人知道解决方法吗?

                推荐答案

                我遇到了同样的问题,我通过将 Visual Studio 2017 从 15.5.2 更新到 15.5.4 并从以下位置更新我的测试项目引用来修复它:

                I had the same problem and I fixed it by updating Visual Studio 2017 from 15.5.2 to 15.5.4 and updating my test project references from:

                <ItemGroup>
                    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170628-02" />
                    <PackageReference Include="xunit" Version="2.2.0" />
                    <PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
                </ItemGroup>
                

                到:

                <ItemGroup>
                    <PackageReference Include="xunit" Version="2.3.1" />
                    <PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
                </ItemGroup>
                

                并重新启动 Visual Studio(显然 VS 缓存并使用以前的版本,即使您已经更新).

                And restarting Visual Studio (apparently VS caches and uses the previous version even after you've updated).

                不确定这三件事中的一件或它们的组合是否修复了它.

                Not sure if one of the 3 things or the combination of them fixed it.

                这篇关于Xunit 单元测试不会运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:我可以为Window Universal App创建一个警报应用程序吗? 下一篇:如何在 Windows 10 应用中实现应用内购买?

                相关文章

                1. <legend id='zRUxL'><style id='zRUxL'><dir id='zRUxL'><q id='zRUxL'></q></dir></style></legend>

                    <bdo id='zRUxL'></bdo><ul id='zRUxL'></ul>

                  <small id='zRUxL'></small><noframes id='zRUxL'>

                  <tfoot id='zRUxL'></tfoot>

                2. <i id='zRUxL'><tr id='zRUxL'><dt id='zRUxL'><q id='zRUxL'><span id='zRUxL'><b id='zRUxL'><form id='zRUxL'><ins id='zRUxL'></ins><ul id='zRUxL'></ul><sub id='zRUxL'></sub></form><legend id='zRUxL'></legend><bdo id='zRUxL'><pre id='zRUxL'><center id='zRUxL'></center></pre></bdo></b><th id='zRUxL'></th></span></q></dt></tr></i><div id='zRUxL'><tfoot id='zRUxL'></tfoot><dl id='zRUxL'><fieldset id='zRUxL'></fieldset></dl></div>