Visual Studio 2015: SpecFlow

Dunno why, but installing SpecFlow in Package Manager console works… but then I can’t find the items.

So going here, gives you this:


Same how-tos here and page dedicated to 2015 here.

Install it…


Then when you stop and start VS, you get this:


I had already created a MSTest project inside a console application solution. Before I didn’t have the SpecFlow items, now I do, when I go to add an item:


The first time of asking, we get this:



So easy enough to resolve the SpecFlow reference, now just the NUnit.

This is the app.config for the other project (sic):


And I’ve seen comments saying that you need this line (first for context):

      <unitTestProvider name="MsTest.2010" />

I dragged the updated app.config into the Unit Test Project, thus…



Also note that the generated file now contains MSTest references, not NUnit references, since we have the new entry in the app.config (the squiggles are because it can’t find a schema for SpecFlow:


Perhaps now I can get to the error I was trying to demonstrate. Oh but first I have to give it some bindings:


So now we have that (PasteBin here)…


Then the test passes…


And then I was playing with the tags trying to get it to break with this error re ScenarioContext and missing key… but I can’t now (get it to break).

Visual Studio: code snippets

As at work we might stop using ReSharper, I’ll assume that and come back to how you do Code Snippets, Visual Studio-style.

There’s this from MSDN which shows you how to create one.

This is how you can use it of course: you start to type letters and after some pre-defined pause it assumes you want to see the snippet library, in this case for all snippets starting with [p]:


Where has this come from?



Now interesting here is that e.g. the [propa] and [propdp] snippets are not in that list, so presumably it at least aggregates from a few different sources under the [C:\Program Files (x86)\Microsoft Visual Studio 14.0] area. So if I do try to find e.g. propdp,


, which expands to this promising code:VSSnippets04

I need to know the location and extension of a snippet, so from the Manager, I can get the location, giving this:


Notice that [Snippets] is below [VC#], rather than the other way round, which seems a bit mad to me. Regardless,I now know where to look for the propdp snippet:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC#\Snippets\1033\NetFX30



So that too is under the VC# umbrella, so maybe it is just grouping the C# bits together.

More MSDN [List of common C# snippets (.e.g. for properties)] [Create a New Snippet with Replacements] [Distribute Code Snippets]

Now my pet rant on C# code snippets vs ReSharper was the fact that you can’t do any on-the-fly substitution (see my YouTube elsewhere on what I mean by that) on macro variables. Fine, with a few extra keystrokes, you can achieve the necessary with the standard snippet [propfull]:

PropFull01 PropFull02

and in simple uses, this is probably enough (propg):


Might be helpful to show what underpins the fuller one, propfull:



Visual Studio: diagnostics

I am a fan of the debugger in Visual Studio. For a number of years now, I have seen the Intellitrace window appear more as an irritant… because I knew nothing about it. So today I took the trouble to watch the VS-embedded video on this. And it sounds promising, particularly the ability to run Intellitrace on a machine that does not have VS, and to collect the data for subsequent analysis on a machine that does.

The diagnostics section of the MSDN blog:

Channel 9 Visual Studio videos, including the Intellitrace one.

Chef: more

If I try to apply an example from the bottom of this page… then it’s pretty clear this content will not fly on Windows (but will of course on Unix/Linux). But it’s still interesting to see errors. I’ll include this in a .rb file..

file 'C:\temp\settings.ini' do
  owner 'root'
  group 'root'
  mode '0755'
  action :create

, and then run it:

No mapping between account names and security IDs was done.

OK, so I've played with some permutations on this, and I see that this  works:

DenChefOwner01 DenChefOwner02
, and if I deliberately give it a bad owner, then more or less we get this again:


so the catch-all for bad anything almost is the "Mapping" exception. So we'll back in the valid user and make them the Group as well, just as a quck test:
ChefUser01 ChefUser02

That is ok, so now let's apply the group and user exactly as they are in Computer Management:

ChefUser03 ChefUser04
Enough for now.