mstest


Integrating Spring.NET with Specflow


Can I make use of Spring.NET's base classes (a la AbstractDependencyInjectionSpringContextTests) for loading an application context and performing dependency injection using MSTest?
I'm trying to develop transactional scenarios that will ultimately hit a live integration database and rollback. I have a set of base classes that extend from Spring's that perform a bit of initialization necessary on our application platform.
I suppose I can abstract this and use the Before and After hooks, but I'd like to keep it as similar as possible to what we already have and continue to make use of autowired dependency injection.
I would suggest that you take a look that the ContextInjection-feature of SpecFlow. It's a simple but rather powerful feature that allows you to inject an object right into your step definition class.
For example you could configure your transactional component the way you want and then just inject the configured object right into your steps. Create a "use-only-in-test"-version of it so to speak.
For transactions I've used the Before/AfterScenario hooks before but that is a bit hidden as you say. It works fine though.
Hope this helps
I was able to extend the Spring test base class and hook up test initialize/cleanup with Specflows Before/After scenario. My step class, at least, will be auto-wired with the necessary dependencies.
https://github.com/techtalk/SpecFlow/wiki/Hooks
[Binding]
public class MySteps : AbstractDependencyInjectionSpringContextTests
{
protected override string[] ConfigLocations
{
get
{
return new string[] {
"assembly://My.Assembly/Path.To.Config/My.config" };
}
}
public IMyService MyService { get; set; }
[Before]
public void BeforeTest()
{
this.TestInitialize();
}
[After]
public void AfterTest()
{
this.TestCleanup();
}
}

Related Links

How to explicitly exit Data driven test method in MSTest
MSTest: why is TestOutcome = InProgress after ExpectedCondition?
parallel execution of tests in same class in mstest
Running dotCover Console Runner with MsTest
How to get a test result output file attachment from remote test agent for mstest
MS Test TestResult Deployment Folders
All test methods in a package/solution in MSTest
MSTest occasionally hangs with VSTTExecution sourced error: ControllerExecution.ReleaseAllAgents: timed out waiting on m_agentsReleased
How to get NCover from TestDriven.NET to generate code coverage via the command line
Specflow running with MSTest
MS Test hangs when tried to execute the tests without installing visual studio
How to list all test categories from Mstest dll?
How to set dll search path of MSTest used with opencover?
Get a List on TestInitialize and use it on Data driven test case
mstest, how to run all tests automatically?
Listen for MsTest Events in Visual Studio Addin

Categories

HOME
facebook-oauth
jsf-2.2
ms-access-2016
xbee
polling
gluon-mobile
title
special-characters
syntaxnet
vimdiff
project-intu
endpoint
favicon
selenium-ide
modbus-tcp
atlassian-stash
mapstruct
ios10.2
postscript
inno-download-plugin
exploit
ms-access-web-app
wcag
datastax-enterprise-graph
paperjs
subclass
constexpr
xbox
postback
jbutton
angularjs-material
pop3
sharding
reverse
connection-pool
health-monitoring
metaprogramming
news
skylink
softmax
claims
bindingnavigator
apache-directory
strftime
servermanager
nanoc
ntvs
openrasta
fclose
netbeans6.8
tf
posixct
video-conferencing
context-sensitive-grammar
spring-data-couchbase
java-6
gpg-signature
restore
autosar
builtins
microstation
simevents
kango-framework
jbase
gocql
wiredep
include-guards
uncompress
android-broadcast
fits
pseudo-class
linkedin-jsapi
lnk
vsx
scriptaculous
light
jammer
cocoalibspotify-2.0
script#
poker
rmiregistry
subgraph
oracle-enterprise-linux
kqueue
xcelsius
diagrams
delimited-text
pagemethods
lobo-cobra
todos
sqlobject
change-management
wspbuilder

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App