Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Integration tests fails due to initialization quirks related to test framework

$
0
0

Hi,

I followed the guidelines by @henriknystrom at https://thisisnothing.nystrom.co.nz/2017/12/05/integration-testing-with-episerver/ refered to in this closed thread: https://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=185646

I'm trying out some Integration testing, using NUnit 3 and SpecFlow, IIS Express and Selenium.

When calling:
_engine = new InitializationEngine((IEnumerable)null, HostType.TestFramework, new AssemblyList(true).AllowedAssemblies);
_engine.Initialize();


I get a failure that seems to be related to this: https://github.com/Microsoft/vstest/issues/1417

So, basically I should not be reflecting types from Microsoft.VisualStudio.TestPlatform.ObjectModel.

Therefore I tried something like this:

var data = Assembly.GetAssembly(typeof(EPiServer.Data.DataInitialization));
var events = Assembly.GetAssembly(typeof(EPiServer.Events.EventMessage));
var framework = Assembly.GetAssembly(typeof(EPiServer.Framework.EnvironmentOptions));
var epiServer = Assembly.GetAssembly(typeof(EPiServer.DeleteContentEventArgs));
var epiServerEnterprise = Assembly.GetAssembly(typeof(EPiServer.Enterprise.ContentExportedEventArgs));
var structureMap = Assembly.GetAssembly(typeof(EPiServer.ServiceLocation.StructureMapServiceLocator));

var _engine = new InitializationEngine((IEnumerable)null, HostType.TestFramework,
new List {
data,
events,
framework,
epiServer,
epiServerEnterprise,
structureMap
});
_engine.Initialize();

But it´s not getting me the whole way, some error about no connectionstrings is found etc. (I have the connectionstring in my app.config, and I have a InitializationModule setting the connectionstring up configuring DataAccessOptions)

Does anyone know exactly which assemblies are needed to setup EPi CMS for testing or how I could use new AssemblyList(true).AllowedAssemblies and instead exclude Microsoft.VisualStudio.TestPlatform.ObjectModel?

Guess things starts working when all needed assemblies are loaded and the initialization modules are run correctly, without some buggy assembly comes interfering and ruining my geeky party. @henriknystrom - can you please shed some light on this for me!? ;)



Viewing all articles
Browse latest Browse all 9076

Trending Articles