Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Integration with SpecFlow
AlSki
#1 Posted : Wednesday, March 21, 2012 10:57:16 AM(UTC)
Rank: Member

Groups: Registered
Joined: 2/28/2012(UTC)
Posts: 17
Location: London

Thanks: 1 times
Was thanked: 2 time(s) in 2 post(s)
In case you don't use it, Specflow uses xxx.feature files with a Custom Tool attribute in VS, "SpecFlowSingleFileGenerator" that automatically generates a xx.feature.cs file whenever you save the .feature. The feature.cs contains the testable code. So if I modify my feature, ncrunch detects that and kicks off a new cycle, but because I haven't saved the file yet, nCrunch is using an out of date .feature.cs file.

I'm just wondering if this occurs for all designed code objects. Does nCrunch usually consider the Custom Tool?
Remco
#2 Posted : Wednesday, March 21, 2012 8:57:26 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,975

Thanks: 929 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for posting!

NCrunch doesn't have any special code or integration with SpecFlow, though as you've described it does recognise the NUnit tests that specflow generates. Because NCrunch isn't aware of the custom tool, it will simply kick off tests whenever a change is made to one of the .feature content files (which is actually too early, as the tests haven't been generated yet). This means that for the time being, SpecFlow tests won't run continuously in the same way as tests from other frameworks, as there is still a manual generation step.

I hope this helps :)


Cheers,

Remco
AlSki
#3 Posted : Thursday, March 22, 2012 9:36:04 AM(UTC)
Rank: Member

Groups: Registered
Joined: 2/28/2012(UTC)
Posts: 17
Location: London

Thanks: 1 times
Was thanked: 2 time(s) in 2 post(s)
Thanks Remco. I'm perfectly happy with the workaround, just wasn't sure if you took account of any Custom Tools, including WinForms Designer or Data Designer generated as well. I suppose if nobody else is raising this then its not a feature to consider yet. :-)
1 user thanked AlSki for this useful post.
Remco on 3/22/2012(UTC)
MikeHanson
#4 Posted : Friday, March 23, 2012 7:41:30 AM(UTC)
Rank: Member

Groups: Registered
Joined: 3/23/2012(UTC)
Posts: 11
Location: St Albans, UK

Was thanked: 3 time(s) in 3 post(s)
Loving NCrunch rapidly becoming an essential tool that I wouldn't want to be without.

I too use SpecFlow in conjunction with SpecSalad, NUnit and a UI automation framework such as Watin or WebAii. Since these tests are almost always going to be tests that drive the UI I won't want to run them continuously, so it would be great to be able to flag individual projects for manual run only or perhaps to be ignored by NCrunch. Is that a feasable feature?

Update: Ignore my question I discovered the Customise Engine Mode feature almost immediately after asking it.

For anyone else wondering the same thing you can exclude a project from automatic continuous testing like so:

1. Select NCrunch, Set Engine Mode, Customise Engine Modes... from the VS menubar
2. Click Add Enging Mode
3. Replace the generated name with something appropriate
4. In the conditions panel select is not in project with name from the list
5. Enter the name of the project to exclude in the adjacent field
6. Click OK
7. Select NCrunch, Set Engine Mode, [New Engine Mode] from the VS menubar to enable your new engine mode


You can also ignore the project in the NCrunch Tests window but you then have to remember to display ignored tests to run them manually. Using the engine mode option the tests are not run but are available in the default view of the Tests window so they can be run manually easily.
AlSki
#5 Posted : Thursday, April 26, 2012 9:08:50 AM(UTC)
Rank: Member

Groups: Registered
Joined: 2/28/2012(UTC)
Posts: 17
Location: London

Thanks: 1 times
Was thanked: 2 time(s) in 2 post(s)
Sorry been thinking about this a little more.

Where a file has a custom tool that generates another file, then nCrunch is kicking off builds as you change the source file even though nothing will be different in the build until you save and therefore trigger the custom tool to create the generated file.

I'm just wondering if you might save nCrunch some work by ignoring any file that has a custom tool from triggering an nCrunch build, just trigger off the generated files?
Remco
#6 Posted : Thursday, April 26, 2012 9:50:26 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,975

Thanks: 929 times
Was thanked: 1257 time(s) in 1170 post(s)
I think the tricky thing here would be reliably identifying when the file is being used by a custom tool, and when it isn't. There are certain things that could probably be hard coded (i.e. .feature files for specflow), though probably this would need to be configurable. I'll have a think about it.

Meanwhile, I have a different idea that you may wish to try. NCrunch will always build a project as soon as a .feature file is changed, so would it perhaps work to include the specflow generator as a pre-build event for the tests project? You'd need to enable pre-build events in your NCrunch configuration for the project, but in theory this would let you operate continuously without any manual steps at all.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.065 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download