我有几个硒测试(项目类型:.net核心,xunit框架,硒),它们以chrome headless模式运行。当我尝试通过cmd行运行测试时,仅检测到一个测试。
在cmd行上的: dotnet vstest
我尝试添加chromeoption,但是似乎都不起作用。
chromeoptions.AddArguments("--headless");
chromeoptions.AddArguments("--disable-gpu");
chromeoptions.AddArguments("--no-sandbox");
chromeoptions.AddArguments("--window-size=1920,1080");
chromeoptions.AddArguments("--allow-insecure-localhost");
chromeoptions.AddAdditionalCapability("--acceptInsecureCerts", true, true);
chromeoptions.AddArguments("--start-maximized");
chromeoptions.AddArguments("--proxy-server='direct://'");
chromeoptions.AddArguments("--proxy-bypass-list=*");
chromeoptions.AddArguments("--disable-extensions");
cs.proj如下所示:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
<PublishChromeDriver>true</PublishChromeDriver>
<RootNamespace>CVProSmokeTest</RootNamespace>
<AssemblyName>CVProSmokeTest</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
<Optimize>false</Optimize>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Microsoft.TestPlatform.TestHost" Version="16.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="Selenium.Support" Version="3.141.0" />
<PackageReference Include="Selenium.WebDriver" Version="3.141.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="74.0.3729.6" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.console" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
</ItemGroup>
<ItemGroup>
<None Update="Config\config.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
我有两个测试[事实],似乎只有一个测试可以得到帮助,我们将不胜感激。
答案 0 :(得分:0)
我只想关闭此循环,我禁用了测试,并在调试时运行它们,然后独立运行它们,我还必须调整脚本流(将脚本放慢一点),所以不确定解决此问题的方法。