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

Have PartCover include an assembly with “System” in name
MSTest - data drive ntest from a method?
Usage of moles.runner.exe with MSTest.exe as the test runner
Tools to view code coverage results of MSTest in Jenkins
Teamcity MSTest 10.0 no suitable build agents error
Only one TestResult folder with MSTest?
TFS build cannot publish test results if TFS server is in domain different from drop location
NLog not working with MSTest, where should the config go?
Can you invoke a control rather than launch an app for coded ui tests?
Watin accessing localhost
In MSTest's Test View, how can I get a list of all Tests with no category?
run tests from msbuild script
cruisecontrol mstest problem wenn tests fail
MSTest /noisolation fails tests
Perform Visual Studio Data Compare automatically prior to running MSTest tests
Setting up MS Tests 2010 on TeamCity?

Categories

HOME
shell
uml
azure-stream-analytics
facebook-oauth
hyperlink
eslint
ecmascript-6
formal-languages
depth
fftw
jelastic
spring-data-mongodb
big-o
web-hosting
square
jax-ws
azure-container-service
heap
mod-security
modbus-tcp
symfony-2.8
html5-appcache
google-container-registry
object-storage
epsilon
froala
xcode-ui-testing
flooding
jasmine-node
delimiter
iis-express
livelink
anki
dumpbin
laravel-eloquent
baidu-map
batching
engine.io
magento-1.9.2.4
xcode7.3
reactivekit
timing
demo
news
postgresql-8.4
builder
payara-micro
seq
janus
filenet
android-instrumentation
observablecollection
qiime
boost-serialization
atan2
boomerang
xenomai
nutiteq
android-broadcast
bcache
gamekit
procedural-programming
apache-spark-1.3
ejb-2.x
viewer
webfinger
appserver
verold
vsx
authlogic
hibernate-entitymanager
mysql-error-1044
joomla-template
web-notifications
mkv
jdb
database-create
apache-commons-dbutils
inline-formset
hbm2java
tabpanel
lxr
asynchronous-wcf-call
int64
movieplayer

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