Specflow Add-on

Answered

I currently use Xamarin Studio for .NET development and the latest version of the EAP seems to have everything I need, except for the ability to create Specflow tests. Would be good to have this so that I can stop using Xamarin Studio. 

17
26 comments
Avatar
Permanently deleted user

This is one important feature which is stopping me to start using Rider.

4

For developing BDD tests in c# I use VS with Specflow. For Java I use IDEA with Cucumber for Java. Rider could be a great alternative for VS, but I can not use it without Specflow too. 

This is not only a problem for me, but the c# developers in my team need to run these test too, not only the testers.

 

0
Avatar
Permanently deleted user

I am quite disappointed as there is no response from Rider team on this request.

Did not expected for a quick response but its been a while now with out any acknowledgement of the request.

0
Avatar
Permanently deleted user

I guess it is more like "SpecFlow's team should create a Plugin" and they wont do it until Rider get's popular.... From JetBrains perspective, specflow is probably not a key penetration factor

0
Avatar
Permanently deleted user

Let me connect related SpecFlow ticket: https://github.com/techtalk/SpecFlow/issues/773

Looks like the only way to make Rider work together with SpecFlow is to rely on community contibution.

0
Avatar
Permanently deleted user

How would one even start?  I might have just missed it, but I couldn't find any docs on building plugins for Rider.

0
Avatar
Permanently deleted user

One thing they could do is make it an actual part of the IDE itself.
They have done in IntelliJ, PHPStorm, Webstorm, PyCharm and Ruby Mine.

0
Avatar
Permanently deleted user

I really enjoy the JetBrains IDE lineup. Not having SpecFlow is also preventing me from using Rider in full.

1
Avatar
Permanently deleted user

To start it is more than likely that a new JetBrains platform plugin would need to be created.

http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started.html

I've never actually written a plugin but I'm a long term user of IntelliJ (on which Rider is based). From my understanding the plugin would need to be implemented in Java (or any other language that is interoperable with the JVM - say Kotlin). It would more than likely have to follow the same sort of pattern as the extension for Visual Studio, as a start:-

  • It would have to generate the C# files and/or binary files that can be executed by NUnit based on the feature files loaded in the project
  • Add the ability to create missing step definitions
0

Hi!
For now we have at least one good example plugin, which has both C# and Kotlin parts, but we still had no time to make it community friendly, I mean there are no docs on how to build it locally.
https://github.com/JetBrains/resharper-unity
But, for sure, it is planned.

0

Hi!

 

I'm doing automation development with Selenium WebDriver and Specflow in Rider.

All I had to do is give up on their auto generator (which imo is badly written anyways and slow as a dead snail).

Built a powershell script which generates the .feature.cs files for every feature file found and that was it.

 

Here's my powershell script:

 

cls

Add-Type -AssemblyName System.Windows.Forms
$Title = "Specflow Features Maintainer"
#winform dimensions
$height=150
$width=450
#winform background color
$color = "White"
$form1 = New-Object System.Windows.Forms.Form
$form1.Text = $title
$form1.Height = $height
$form1.Width = $width
$form1.BackColor = $color
$form1.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedSingle
$form1.StartPosition = [System.Windows.Forms.FormStartPosition]::CenterScreen

$label1 = New-Object system.Windows.Forms.Label
$label1.Text = "Begining SpecFlow Features cleaning process!"
$label1.Left=5
$label1.Top= 10
$label1.Width= $width - 10
$label1.Height=50
$label1.Font= "Consolas"
$form1.controls.add($label1)
#optional to show border
#$label1.BorderStyle=1
$form1.Focus() | out-null
$form1.Show() | out-null
$form1.Focus() | out-null

$label1.text="Starting the cleanup process!"
$form1.Refresh()


# Everything above this point is not necessary. I wanted to have a tiny status window that says what it is doing for the guys in my team.

# This helps them know when the PS script is launched and what state it is in.

#The variable $scriptPath is used to declare the path where the script resides (in my case inside the project in a Scripts folder),

# from the script's path it then switchs to the parent folder.

$scriptPath = $PSScriptRoot | Split-Path -Parent
[xml]$appConfig = [xml](Get-Content ($scriptPath+"\App.config"))

# The next 3 variables must be declared in your app.config file.
$path = $appConfig.configuration.appSettings.SelectSingleNode('//add[@key="WhereYourFeatureFilesSit"]').value
$packages = $appConfig.configuration.appSettings.SelectSingleNode('//add[@key="WhereYourPackagesReside"]').value
$projRoot = $appConfig.configuration.appSettings.SelectSingleNode('//add[@key="YourRootProjectFolder"]').value
$specflow = 'SpecFlow.2.1.0\tools\'
$packPath = ($packages+$specflow)
$projFile = ($projRoot+'YourProject.csproj')
$cmd = ('.\specflow.exe generateAll "'+$projFile+'" /force /verbose')

$label1.text="Deleteing All *.feature.cs files if any are found."
$form1.Refresh()


If (Test-Path $path){
Get-ChildItem -Path $path -Include *.feature.cs* -File -Recurse | foreach { $_.Delete()}
}

$label1.text="Generating Feature files for all Specflow scenarios"
$form1.Refresh()

Set-Location $packPath

Invoke-Expression -command $cmd| Out-Null

$form1.Close()

 

This is a script which is launched once a day whenever the first test is fired (no matter which - it is basically fired by the base class).

It is helpful because it also maintains and updates all the .feature.cs files with whatever changes were missed initially or after some refactorings.

1
Avatar
Permanently deleted user

Thats cool!

Thank you for sharing your tooling.

0

@Tenebrarum118 Thank you, happy to help.

 

Forgot to mention the fact that you could generate one set of steps with the specflow tooling, copy the skeleton, place the copied skeleton in a new file in Resharper or Rider and save it as a template for any .feature file. So that way whenever you create a new .feature file, it could either get a corresponding step file or a template for the actual .feature files, or both. Depends on how acquainted the team is with specflow skeletons. I did it to ease the life of all Automation engineers in my team so they don't have to worry about minor things like that. 

0

I can't use Rider because this feature is missing :'(

0
Avatar
Permanently deleted user

well i think is fair enough that we give a go as in the Specflow ticket (https://github.com/techtalk/SpecFlow/issues/773), I am starting development by myself so if anyone has previous experience on Intellij plugins or is interested help is welcome (I have done a few VS plugins but not java ones). It should be quite straight forward to do using something as antlr.

 

The repo where i am doing this is https://github.com/kanekotic/Specflow.Rider

0
Avatar
Permanently deleted user

 I'm a bit surprised Jetbrains hasn't provided any commentary given the amount of attention this feature request has received.  Add me to the list of people interested in it.

0

@Erikhejl 
Providing SDK for plugins is definitely on the list, it is just not so easy for Rider.

0
Avatar
Permanently deleted user

@Ivan Shakhov isn't it possible already? i mean it should be possible to create an intellij plugin that does the transpilation that is actually the only thing that the plugin has to do (take one file, spit out 2 of them, and the rest is the normal test framework taking care of it). This should qualify as a frontend plugin no?

0
Avatar
Permanently deleted user

I have a quick workaround but it misses completion and actions:

  • I grab the gherkin plugin from IntelliJ plugin folder to Rider's one. This will provide coloration and formatting to feature files. Sources are available here I think: https://github.com/JetBrains/intellij-plugins/tree/master/cucumber
  • Then in Rider settings, in Editor/Inspection Settings/Generated Code, I add *.feature.cs.
  • Using the Jetbrains Action Tracker plugin, I apply this action in order to have the generated .cs files detected for recompilation:

Still missing a way to create .feature and update the .csproj accordingly + completion on feature files.

If there is a new Specflow plugin it would be nice it reuses the gherkin plugin.

1

I've got a blog post how you can update the feature.cs files in Rider. It doesn't give autocompletion and does not generate the steps.cs file, but it's a start.

0
Avatar
Permanently deleted user

It would really really help me if you made a specflow addon.

First off i would like to plainly state i think Rider is a great product and i'm enjoying usiing it. The problem is (for my sins) I'm a QA engineer and Specflow is pretty much essential for this role

 

Thankyou Ken for your very useful work around 

0

You'll also be pleased to know that I found a way to generate the code in rider too.

0

We tried to migrate from VS to Rider.. everything is fine except SpecFlow and Database projects. We can live without DB projects probably, but missing SpecFlow is a show stopper for us :-(

0

Hi Lukas! 
Please, upvote this issue for SecFlow support RIDER-9750. Thank you! 

0

Still not available? I would really love to have it. Otherwise I need to go back to using VS

0

Since some weeks there is a SpecFlow extension for Rider available. You can find it here: https://plugins.jetbrains.com/plugin/15957-specflow-for-rider

0

Please sign in to leave a comment.