简体   繁体   中英

selenium tests written using xunit framework not getting detected when run via cmd line

I have a couple of selenium tests(project type: .net core, xunit framework, selenium) that I am running in chrome headless mode. Only one test is getting detected when I attempt to run the tests via cmd line.

on cmd line: dotnet vstest

I have tried adding chromeoptions, but none of them seem to work.

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");

The cs.proj look like below:

<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>

I have two tests [Facts], only one seems to get picked up, any help would be appreciated.

我只想关闭这个循环,我禁用我的测试在调试时运行它们然后独立运行它们,我不得不调整脚本流程(减慢脚本速度),所以没有确定的解决方法这个问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM