Customizing Step Definition Skeleton Templates is not working

94 views
Skip to first unread message

Morgan

unread,
Feb 17, 2015, 12:12:35 PM2/17/15
to spec...@googlegroups.com
Hello,

I'm trying to override the template "StepDefinitionClass". (http://www.specflow.org/documentation/Step-Definition-Styles/)

I put the skeleton file right there "C:\Users\me\AppData\Local\SpecFlow\SkeletonTemplates.sftemplate" and reboot Visual Studio.

I tried to regenerate feature.cs files and nothing more was added to the file.

The SkeletonTemplates.sftemplate :

>>>CSharp/StepDefinitionClass
/****************************
 * SpecFlow Rocks!
 ****************************/

using System;
using TechTalk.SpecFlow;

namespace {namespace}
{
 
[Binding]
 
public class {className}
 
{
{bindings}
 
}
}

Do you have any ideas of what the problem might be ?

Did I miss something ?

Thanks a lot.

Morgan

Gáspár Nagy

unread,
Feb 23, 2015, 3:32:33 AM2/23/15
to spec...@googlegroups.com
This template is used when you use "generate step definitions" in order to generate the step definition classes (with [Given]/[When]/[Then] attributes).

The feature.cs is the code behind of the feature file, contains the test classes with unit test attributes. To alter the behavior of that, you need to write a custom unit test provider. There is no easy template-besed configuration there.

Br,
Gaspar

Morgan Leroi

unread,
Feb 23, 2015, 8:12:00 AM2/23/15
to spec...@googlegroups.com
Thanks Gaspar.

I built a custom provider with the plugin system for MSTest and It's working. (My plugin just add a base class to the generated class).

Now I want to use Specrun as a unit test provider ...and I still want my base class in the generated class.

What is the best way to achieve that with Specrun ?

thanks a lot.

Morgan

---------------------
Morgan Leroi

--
You received this message because you are subscribed to the Google Groups "SpecFlow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to specflow+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages