mardi 7 avril 2015

Using Sitecore.FakeDB causes error when used in Resharper Test Runner

I have created some unit tests and I am use Sitecore.FakeDB.


We are also using Resharper to run our tests.


When we use the Resharper test runner to run all our tests, the tests that are using the Sitecore.FakeDB, are throwing errors:


A sample error is:


SetUp : System.InvalidOperationException : Could not read Sitecore configuration. at Sitecore.Configuration.Factory.GetConfiguration()

at Sitecore.Configuration.Factory.GetConfigNode(String xpath, Boolean assert)

at Sitecore.Configuration.Factory.CreateObject(String configPath, String[] parameters, Boolean assert)

at Sitecore.Configuration.Factory.GetDatabase(String name)

at Services.Sitecore.ImportSitecoreService..ctor(ILogger logger, ISettings settings) in ImportSitecoreService.cs: line 15

at Services.Sitecore.Import.BaseImporter`2..ctor(ILogger logger, ISettings settings) in BaseImporter.cs: line 13

at Services.Sitecore.Test.Import.StubImporter..ctor(ILogger logger, ISettings settings) in BaseImporterTests.cs: line 31

at Services.Sitecore.Test.Import.BaseImporterTests.Setup() in BaseImporterTests.cs: line 53


Now if we run the tests individually within the Resharper test runner, then the tests run successfully, and pass.


When the tests are run within TeamCity, the test all pass with no errors.


At a loss to explain why this is occurring as its not the test code as it works under other circumstances. i.e on some developer machines the tests always pass, but on others fail when all test are run.


The Sitecore.FakeDB package was installed using NuGet. I have checked and for the test application is does look like the app.config has been configured correctly.


Aucun commentaire:

Enregistrer un commentaire