1
resposta

Problema ao rodar testes (CollectionFixture)

Boa tarde, estou tentando executar meus testes, mas quando tento rodar o VS2017 exibe este erro:

Test Name:    PagouFacil.Tests.RealizarCadastro.CadastroDadosInvalidosSemEmail
Test FullName:    PagouFacil.Tests.RealizarCadastro.CadastroDadosInvalidosSemEmail
Test Source:    C:\Users\bfgusmao\source\repos\XUnitTestProject1\XUnitTestProject1\UnitTest1.cs : line 28
Test Outcome:    Failed
Test Duration:    0:00:00,001

Result StackTrace:    
----- Inner Stack Trace #1 (OpenQA.Selenium.WebDriverException) -----
   at OpenQA.Selenium.DriverService.Start()
   at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
   at PagouFacil.Fixtures.TestFixture..ctor() in C:\Users\bfgusmao\source\repos\XUnitTestProject1\XUnitTestProject1\Fixtures\TestFixture.cs:line 17
----- Inner Stack Trace #2 (Xunit.Sdk.TestClassException) -----
Result Message:    
System.AggregateException : One or more errors occurred. (Cannot start the driver service on http://localhost:60588/) (The following constructor parameters did not have matching fixture data: TestFixture fixture)
---- OpenQA.Selenium.WebDriverException : Cannot start the driver service on http://localhost:60588/
---- The following constructor parameters did not have matching fixture data: TestFixture fixture

--

Não entendi muito bem o que pode ser, poderiam me ajudar?

Meu código está desta forma:

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Firefox;
using System;
using System.Collections.Generic;
using System.Text;

namespace PagouFacil.Fixtures
{
    public class TestFixture : IDisposable
    {
        public IWebDriver Driver { get; private set; }

        //Setup
        public TestFixture()
        {
            Driver = new ChromeDriver(@"C:\Users\bfgusmao\source\repos\XUnitTestProject1\XUnitTestProject1\bin\Debug\netcoreapp2.2");
            Driver.Manage().Window.Maximize();
            Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
        }

        //TearDown
        public void Dispose()
        {
            Driver.Quit();
        }
    }
}

Observação: Já tentei alterar o chromedriver de pasta ou até mesmo deixar sem o caminho, mas o erro permanece.

1 resposta
O post foi fechado por inatividade. Para continuar o assunto, recomendamos criar um novo tópico. Bons Estudos!