Hooks method AfterTestRun does not execute - specflow

Info of my tools & version set up are below
SpecFlow Version: 2.3
Used Test Runner: NUnit
Version number: NUnit.ConsoleRunner v3.8.0; NUnit v3.10.1
Visual Studio Version: VS 2015
Are the latest Visual Studio updates installed? Yes
.NET Framework: >= .NET 4
Test Execution Method: Visual Studio Test Explorer TFS/VSTS
Issue Description:
On a project that I have been working on for more than 2 years now using SpecFlow automation, I recently discovered that the AfterTestRun method is not working; and it's not been working since May 2017. As I can see the clean up activities were executed in the results from that time; but have not been executing since then. At that time, we were using an earlier SpecFlow version but I am not sure which. However the issue is that BeforeTestRun and all other Hooks methods (BeforeFeature, BeforeScenario, BeforeStep, AfterStep, AfterScenario and AfterFeature) are working perfectly. Just the AfterTestRun method does not get executed at all. The final result compilation completes successfully but no traces of AfterTestRun having been executed.
I have searched through all relevant posts on the forum but have not been able to get any headway. i even installed SpecFlow.Nunit and SpecFlow.Nunit.Runner to see if that may be the issue (per one of the posts - but that too did not resolve the issue)

Related

how to run SmartStore.NET in visual studio 2015?

how start smartstore.net in visual studio localhost without any error
i download github code and open project file from
SmartStoreNET-3.x\src\SmartStoreNET.sln
The download link https://github.com/smartstoreag/SmartStoreNET
I use visual studio 2015 enterprise edition and windows 10.
First, you must be change the "Solution Configuration" to Debug mode, and second change the "Solution Plataform" to Any CPU.
This work for me.
I recently went through this integration/configuration procedure trying to get a local instance of SmartStore.NET up and running with demo data. I was able to get there eventually, but the development environment setup was by far the most tricky.
I would suggest starting with these two links:
http://docs.smartstore.com/display/SMNET30/Installing+SmartStore.NET
http://docs.smartstore.com/display/SMNET30/How+to+build+SmartStore.NET
I have a hunch you're issue may be your development environment configuration is not fully correct. Check out this page for more details about requirements:
Technology and Prerequisites
http://docs.smartstore.com/pages/viewpage.action?pageId=35555597
*NOTE: they reference ASP.NET 4.5.1 but I had to use 4.61 to take advantage of some newer features in C# 7.0 - Tuples, and several others)
Probably the most significant discovery I found was their were dependency issues when trying to restore the NuGet packages referenced in the solution. I had to go through this process maybe 4 or 5 times to finally get the app running locally.
Once all of this was complete, getting it working in 2015 required little effort.
I would also suggest narrowing your question to more specific problems. (that's just me)

Trouble running specflow tests with VS2015 and resharper?

I'm using SpecFlow with Visual Studio 2013 without issue with Resharper 8.2. If I try running the tests in Visual Studio 2015 with Resharper 10 I get a "Not implemented" error if I right click a scenario and choose Run Unit Tests (worked in 2013 this way) and if I choose the Run SpecFlow Scenario option instead the project seems to build but the test never runs.
Has anyone else run into this? I tried uninstalling resharper, but it tells me no tests are found if I do that and "Run SpecFlow Scenarios" inside my feature file.
In my case the only thing I had to change is the follwoing setting fdrom Auto to Resharper - and it worked:
Its a known issue with Resharper 10 (And some versions of 9) and Specflow (The bindings)
I spent many hours last week banging my head against a wall with it (Someone decided to upgrade to R# 10 and all hell breaks loose with testing)
After many hours of playing around I worked out that certain versions work with certain versions of specflow (Currently)..
Image of versions grid (Selenium to Resharper version combinations that work) http://i.stack.imgur.com/Zxh9G.png (Text as I cant post more than 2 links -_-)
This is hopefully a short term issue (For VS 2013/2015 anyways) as there is what looks like a fix in progress. Here for these two versions of visual studio (Specflow wise). Those links have more info in them (Than my short explanation)
For anyone still using VS 2010 or 2012 whether the Specflow plugin will ever be updated for these versions I don't know... (That being that version 1.9.2 of specflow) for those versions of VS has not been updated since 2013... (Could be updated I don't know however keep that in mind...)
TL;DR
The issue is basically Resharper test hooks have been changed again by the looks of it in R# 9.2+ (In some way). Which is why SpecFlow is not playing ball any more with higher versions! (Basically a waiting on a updated version) which for VS 2010 and 2012 may never come :(
I am using VS2015 / ReSharper Ultimate 2016.1.2 and was able to run after installing SpecRun.Runner v1.5.2 from NuGet / restarting VS2015. (As a side note I also have the "SpecFlow for Visual Studio 2015" extension installed).

VSIX Custom Checkin Policy not loading

I'm attempting to modify a custom Checkin Policy to work against Visual Studio 2013.
At first, I attempted to just add a new section to the manifest for 2013:
<VisualStudio Version="12.0">
<Edition>Ultimate</Edition>
<Edition>Premium</Edition>
<Edition>Pro</Edition>
</VisualStudio>
and whilst this allowed it to install, it doesn't allow the policy to run (if I go to the policies>>Add section of TFS it's not present, and the policies throws an exception stating that the Policy is not registered).
After much hunting around, I thought perhaps there was an issue with the Policies.pkgdef - The Extension manager in VS2013 shows it as installed, but it's not showing as installed at Pending Changes. However I can't see any issue with it either:
[$RootKey$\TeamFoundation\SourceControl\Checkin Policies]
"VersionOneTFSPolicy"="$PackageFolder$\VersionOneTFSPolicy.dll"
I've opened it and compiled it in 2013, and fixed any reference issues so that it will compile correctly, but it still doesn't seem to like using it.
Does VS2013 manage Custom Checkin policies differently to 2010/2012? From what I can see it should just work with a manifest change and a recompile.
Edit
So I managed to get the custom policy running on VS2013 by upgrading the reference to Microsoft.TeamFoundation.VersionControl.Client from 11 to 12 and upgrading the project to .Net 4.5. However, this now renders the custom policy unusable on VS2012 (and I would assume 2010 too but I haven't tested that yet). Is there a way to have this run on 2010 through to 2013 from a single VSIX?
In the absence of any other solution, I reverted to the tried and tested method of updating the extension and building it as a new package. So simply having a 2012 version and a completely separate 2013 version.
I am trying to solve this as well, and from everything I have found, the only way to get extensions that target all versions is to actually create 3 separate (2010, 2012 and 2013) extensions, and install them using an InstallShield package that has each one as sub-features that get installed in sequence.
Upgrades are then done on each one individually as the VSIX is actually doing the install.
Links that may help you out on this include:
Single extension targeting VS 2012 and VS 2013
How to target an extension in both VS2012 and VS2010

Will VS2012 work with TFS2010?

I'm considering using VS2012 RC to put together coded UI tests (since VS2010 SP2 FP2 does not fully support IE9).
Currently, my test projects are contained within a solution which is connected to our TFS team project. I also set up a build definition to build the project when new code is checked in (the builds are performed on our build machine).
I suppose that if I upgrade my solution to VS2012, then to be able to build the solution on the build machine I will need VS2012 RC installed there too, right? But then is it possible to specify in my build definition for my project to be built by VS2012 instead of VS2010?
Is it possible for me to upgrade my project with VS2012 while still using TFS2010? I should note my solution will be the only one upgraded to VS2012. All the other solutions in the company still need to be built by VS2010. A company-wide upgrade to VS2012 won't be in place for at least a few months, I imagine.
Or do I need a separate build machine or anything?
Any thoughts, ideas or solutions appreciated!
UPDATE: So I gave it a try, and everything worked okay. My only problem is that the Coded UI tests I have didn't work after being re-built on on my build machine, but I suppose that's probably something I'd need to ask about elsewhere. To clarify, the solution built successfully, but the tests still failed.
Visual Studio 2012's project changes allow most types to still be opened by Visual Studio 2010 with SP1, so it depends on what kind of projects are in your solution - see this page for the full compatibility list:
If you created your assets in Visual Studio 2010 with Service Pack 1
(SP1), many of them will load and run in Visual Studio 2012 without
any further action on your part. Many assets will also open again in
Visual Studio 2010 with SP1 without any issues, even after you open
those assets in Visual Studio 2012.
See also "Round-tripping with Visual Studio 11" on the VS blog which has more detail.
Note though that if your build process uses custom build activities then just installing Visual Studio 2012 breaks the build definition on your local machine, and also that MVC1 or MVC2 projects just aren't supported by VS2012. Oh, and Visual Studio 2012 isn't a RC any more, it was RTM'd last week.
(I presume you mean 2012 RTM rather than RC, now that the final release is available)
Theoretically (from what I've read) VS2012 and VS2010 use the same project/solution file format, so you should be able to switch between them without any compatibility issues (aside, presumably from obvious things like creating new file types that VS2010 doesn't understand)
TFS updates have historically been backwards compatible, so you can usually use different client and server versions (but usually you need a compatibility pack installed for old clients on new servers, a new client running against an old server has usualyl been fine). So I'd expect this to work well.
I'd say try it, but diff any files that appear in VCS2012's Pending Changes carefully before you check in to be sure that it hasn't changed anything that will cause problems. The worst that can happen then is that your development machine gets a "corrupt" version of the code and you'll need to revert to 2010.
(This is the approach I've been using with our 130-project C# solution, and so far (1 day) it's working fine, apart from the new UI making my eyes bleed as they try to find the information in all the indistinguishable monochrome clutter)

VS 2010 and Nunit testing framework setup

I am working on an Asp.net mvc3 project (.NET 4). And required to integrate a testing tool. I tried to setup up the Nunit testing framework in my solution but it seems that there is a problem setting it up in vs2010.
now I want to know if Nunit still works in vs2010 or
Arent there a clear testing tools for vs2010.?
tnx!
Yes, VS works only with MSTest framework. But you can use some external test-runner:
TestDriven.Net
CodeRush
ReSharper
Another option - go to NUnit GUI settings and turn on test re-running when test assembly changes. Actually I like big green bar, so I have NUnit GUI opened on separate monitor. When test assembly re-builded, all latest tests executed automatically. If I want to debug some test, I use CodeRush - match better than attaching debugger to NUnit.
NUnit has a separate test runner program. I believe the workflow with NUnit is that you code the tests in VS, but you have to run them using the separate NUnit test running program. MSTest is the only unit test framework I know of that lets you run tests from directly within VS.
However, there is a VS plugin called ReSharper. Installing that gives you an NUnit test runner within VS.
Update
Also anyone can correct me if I'm wrong here, but I believe you only get the MSTest runner with versions of VS Professional and up. I don't think VS Express comes with a built-in MsTest runner.
There's Visual Nunit that'll let you run tests from within visual studio.
There's also NCrunch, still in beta but pretty cool. From their website:
NCrunch is an automated parallel continuous testing tool for Visual Studio .NET. It intelligently takes responsibility for running automated tests so that you don't have to, and it gives you a huge amount of useful information about your tests (such as code coverage and performance metrics) inline in your IDE while you work.

Resources