Specflow generated code is incorrect? - specflow

I've recently started playing around with Specflow, and generating test cases based on the examples on their website[1]. However, the generated code doesn't compile. For example, the "Given a new bowling game" line, generates the following:
testRunner.Given("a new bowling game");
But, the signature for ITestRunner.Given() is:
Given(string text, string multilineTextArg, Table tableArg);
The same applies for When(), And() and Then(). It also seems that the binding step definitions require a string parameter as well, which does not appear to be documented.
Is anyone else having these same issues? I downloaded Specflow 1.6.1, and am using VS2005.
Thanks,
Daniel B.
[1] http://specflow.org/specflow/workflow.aspx

The "overloads" are done through extension methods, that are not supported in .NET 2.0 used by VS2005. So i think you have to upgrade to VS2008 at least to be able to use SpecFlow.
See also SpecFlow forum entry related to VS2005

Related

Resx in Blazor WASM: What is "the issue" with the old static way of using the Resx Files?

[Disclaimer: I'm a long-time Desktop developer slowly learning Web and Blazor, so might be a noob question] but,
How come, when you try to find best-practice for doing Localization in Blazor you are told from official MS Docs (https://learn.microsoft.com/en-us/aspnet/core/blazor/globalization-localization?view=aspnetcore-5.0&pivots=webassembly) and various blogs to do the following:
Add NuGet Package: Microsoft.Extensions.Localization
Register localization "builder.Services.AddLocalization();"
Add your resx Files
Make IStringLocalizer (#inject IStringLocalizer Loc)
And finally use the following in your razor pages: #Loc["Greeting"]
Sure above works, but to a Desktop developer, this feels like a massive step-back in quality and "refactor-safeness" and the new way to use "magic strings" to reference the translations.
I've tested, and the "old way" on a Blazor Page of just:
Adding a MyResource.resx
Let it use the custom tool "PublicResXFileCodeGenerator" to make the .designer file
Simply reference the translation using MyResource.MyTranslationKey;
It works, it is refactor-safe, no need for an injection or NuGet packages... It just works, but despite that, it is not the recommended way... My question is why not? What is the drawback (all the blog and documentation fail to say why the new way is better)
I think there are a number of disadvantages using PublicResXFileCodeGenerator, which may have led to the current recommendations on how to support i18n-capabilities in [blazor-]apps.
Note that this is just a list of reasons I personally came up with finding possible causes which may have led to the current recommendations:
A: Visual Studio exclusivness
The way how PublicResXFileCodeGenerator generates files seem to be VisualStudio exclusive. Today´s teams tend to use a variety of IDEs / editor to build software, (f.e. VS, VSCode, Rider, WebStorm, etc.).
At least from my perception over the last couple of years
using IStringLocalizer works for all editors, even notepad or vim.
B: no default fallback
With the recommended way of accessing a translation, there will always be a useful fallback which is provided in markup. That is not the case when using the generated types to access translation-units.
C: no builtin-support for interpolation
Using IStringLocalizer, there is a built-in, lightweight and formalized way for utilizing interpolated strings. It even encourages using such strings in favor of manually building together such values, which is considered bad-practice when translating software.
DO:
#inject IStringLocalizer<DemoPage> L
<h1>#L["Greetings, {0}", userName]</h1> <!--Greetings, Arthur-->
#code {
string userName = "Arthur";
}
DON´T:
<h1>#DemoPageRessources.Greeting #userName</h1> <!--Greetings Arthur-->
#code {
string userName = "Arthur";
}
this dictates the order of strings, which might be OK for one language, but not for another. Achieving this with the generated type is a bit more verbose, and even may lead to runtime-exceptions, when there is no actual translation, i guess.

Failure running WebSharper 4.0 tutorial

I am learning how to use WebSharper. Actually, I am failing to learn how to use WebSharper.
I wanted to learn how to build a simple SPA so I followed this tutorial from the WebSharper page. I am able to create the SPA with Visual Studio and Zafir (the codename for WebSharper 4.0 that is in beta). I followed every step in the tutorial. I have created a repo on github that is everything in the SPA.
The project won't build. More specifically, in the Client.fs file, I get compiler error
The value or constructor P is not found
in line 10 with the P, in line 11 the same error with the Div, and in line 18 I get the error
Namesapces cannot contain values. Consider using a module to hold your value declrations.
with Run(), yet when I try to move the [<SPAEntryPoint>] information into the module HelloWorld, I get the error
Lookup on object of indeterminate type based on information prior to this program point. A type annotation...
As a result, when I try to build this project, the build fails.
Why am I getting these errors? Is the tutorial out of date with the rest of WebSharper? What can I do to get a simple tutorial to work correctly?
EDIT: I get the same errors when I use WebSharper v3.x, too.
Although not mentioned in the tutorial, adding
open WebSharper.Html.Server
eliminated the compiler errors with P and Div, adding
open WebSharper.Html.Client
eliminated a new compiler error of OnClick, and moving the [<SPAEntryPoint>] into the module eliminated that compiler error and allowed me to build the project.
Thanks for the report! I have updated documentation, indeed that page was not updated since a while. I will review it more thoroughly.
The source of the documentations are found at https://github.com/intellifactory/websharper.docs, feel free to add issue there about further questions/problems or also you can submit a PR.

IntelliJ with Ruby on Rails plugin gives warnings about "not able to find route path" when coding tests using built in mini-test framework

I am new to web dev and Ruby on Rails. I chose IntelliJ(13.1.5) with ruby plugins since I also have worked with Java apps for many years for saving a lot of typing. I am trying out rails built-in mini-test framework these days and I have trouble using auto-completion feature for route paths and urls in test classes. There are many warnings about "Cannot find xxx_path' for my sample code below though the tests do run fine.
get login_path
I understand it could be hard for IDE to work with a framework in dynamic language with built in magic. However, I experimented with RSpec test framework for rails and did not have such problem finding the route definitions in IDE. I like mini-test's simplicity more, but if IDE could not allow me to work efficiently, I have to think about RSpec again. Not sure if I miss something here or IDE's miss. Is there anyone else have the same problem with intelliJ mini-test classes for route definition? Do you get it work properly in Intellij or RubyMine? Thanks.
Posted it in JetBrains community and was told that this is supposed to be supported. Filed an issue https://youtrack.jetbrains.com/issue/RUBY-15920
Like you said, it is hard for Intellij to do the magic for dynamic language, it can't be sure about which one you are referencing. I noticed similar issue while writing ruby with IntelliJ IDEA. I'd suggest switching to RubyMine, which is basically a light-weight IntelliJ IDEA but has everything ruby needs. This solved some of my issues, meaning it can find the correct reference when you find declaration, although auto-completion still doesn't work well with instances outside of the current class.

how to use NCover in console/command line?

i've downloaded a free version of ncover here -> http://sourceforge.net/projects/ncover/
but unortunately i am unable to find steps on how to use it in the command line.
any help would be great, thanks!
Have a look at this question.
There are two free versions of NCover available: The SourceForge one (which is discontinued and not working well as Try's comment on Ira Baxter's answer shows) and the Gnoso one (which used to be free and has gone commercial after version 1.5.8). Get the latter one from here.
In case it helps somebody else. I was able to get NCover 1.5.8 (one that comes with TestDriven.NET) working nicely with nunit.
NCover.Console.exe nunit-console-x86.exe /noshadow yourAssembly.dll
The only trick was to makes sure CoverLib.dll COM component is properly registered
regsrv32 CoverLib.dll
Otherwise you'd get "Profiled Process Terminated" error, and then making sure we are passing /noshadow parameter to nunit, otherwise NCover would fail to load symbols for the assembly (at least in my case).
Have a look at this question.
Steps to solve
1.Need to monitor the execution of Test cases Using ncover-console.exe
"[path]\NCover.Console.exe" "[path]\nunit- console.exe" "E:\Myapp\test.sln" /xml="[PATH]\TestResult.xml"
This will create a .nccov file
2.Create coverage html report from .nccov file using NCover.Reporting.exe
"[path]\NCover\NCover.Reporting.exe" "[path]\coverage.nccov" //or FullCoverageReport:Html:output

FxCop/StyleCop for Delphi?

Does anyone know of an equivalent to FxCop/StyleCop for Delphi? I would really like to get the automatic checking of style, etc. into Continuous Integration.
There's Pascal Analyzer from Peganza: http://www.peganza.com/products_pal.htm
I don't know how the features compare to FxCop, since I haven't really used either one.
The closest I've seen is CodeHealer from SOCK software. We use it, and we have integrated it into our FinalBuilder build. It differs from FxCop in one important way: It analyzes the source code, rather than the produced executable. It also doesn't check quite as much as FxCop does. But I think it is the best thing which is available in this category for Delphi.
Delphi 2009 support isn't there just yet, but they say they're working on it.
Delphi Code Analyzer is another one that is open source.
The DGrok project started with something like FxCop some years ago. The parser and analysis parts are still available, read more at "DGrok 0.8.1: multithreading, default options, GPL" - The parser is a .Net project but
DGrok is a set of tools for parsing
Delphi source code and telling you
stuff about it. Read more about it on
the DGrok project page.
There is a new Delphi plugin for Sonar, which uses a Delphi grammar to run automatic tests over the source code.
I've heard of something called Delforex but haven't used it myself (yet)
Delforex is great for actually formatting the code. It does not do much more than that though. (we have/do use it).
I would second the votes for either Pascal Analyzer or Code Healer.
Vaccano
Doesn't Delphi output .net compatible IL code? I haven't used it in an age but I thought newer versions output .net assemblies.
If so then I would have thought FXcop would work and you could always add some of your own custom rules to it. Stylecop would not work but you could at least get FXCop running.

Resources