Specflow feature file shows step as both undefined and having mulitiple definitions at the same time - specflow

I have a specflow feature file. It has numerous scenarios in it.
In the editor, each step shows as purple (not defined). Right clicking in the feature file and selecting "Generate Step Definitions" pops a dialog for defining the definition methods for each step. Each step is listed. Generating those step definitions generates code whose signatures are identical to what already exists.
However...
If I right click on a step in the feature file and say "Go to definition," It pops a message saying that there are multiple definitions found and takes me to the first one. There are definitely no other steps named the same anywhere in the project at all.
What could be some things which could cause this?

In my particular instance, it was a scope decorator for my feature steps file:
[Scope(Tag = "#myTag", Feature ="myFeature")]
which I understand as being necessary since we are using inheritance to deal with a very complex testing framework and specflow has elsewhere been described as not respecting inheritance (just goes by the [Binding] decorator).

Related

Why should I use a separate test target for running XCTests and how should I do that?

I once asked a question related to XCTests. And in one of the answers I was told that it is a common practice to use a separate test target (other than the main app) when running unit tests (at least, in iOS development). I tried to find some sources about it, but I couldn't
I understand, that it is probably a best practice, so I would really like to understand it. Could someone explain to me why is it important, what benefits do I get from it and how should I go about doing it? Links to some articles explaining the issue will be much appreciated.
P.S. I understand that I need special environment for tests (fake in-memory database, mocked networking layer, etc.), but up until now I managed to achieve it without a separate test host. But I believe that there might be a better way.
To answer your points:
Why is using a separate test target important?
Separation of concerns. A unit test target does not have the same kind of structure as a regular app target - it contains a test bundle, which references the app target under test, as well as the test classes and any helper classes required. It is not a duplicate of the app target with test code added to it - in fact it should not even contain the code under test. This means that you don't have to make any special effort to keep the test target in sync with the main app target - the fact that the test bundle loads the main app handles all that for you. (You made a comment on Richard Ross's answer to your previous q suggesting you've run into the difficulties duplication causes already).
How should I go about doing this? (checked on Xcode 7).
Assuming you are wanting to add a target to an existing project that doesn't have any tests, select the main project, and then click on the '+' beneath the list of targets in the project. You can also use the File->New->Target menu option.
You'll see a menu asking you to choose a template for your new target. Select 'Test' and within test select 'iOS Unit Testing Bundle'.
Check the fields in the next screen - they should be correct by default - but you might want to double check the 'Target to be Tested' field value is correct if you have a lot of targets in the project/workspace. Click 'OK' and you should have a functioning unit test bundle, with an example test that you should be able to run using Apple-U or Product->Test You'll still need to #import the app classes if you're using ObjC.
If you are creating a new project, all you need to do is tick the 'Include Unit Test' box when creating the project - no other steps are required.
Apple Docs (with links to relevant WWDC presentations)
Tutorials. Most of the tutorials around are a bit out of date. But not that much has changed, so just look at the docs and figure it out. The two below might be useful, otherwise just google. From a quick glance, most of them seem to assume that the project had unit tests set up at the beginning
http://www.raywenderlich.com/22590/beginning-automated-testing-with-xcode-part-12 (2012/iOS 6, but the process is still broadly the same. Also deals with Jenkins, Git and running tests from the CLI).
Unit testing in OSX - most recent post - not iOS, I know, but more up to date than most of the iOS tutorials (Oct 2015), and gives step by step instructions (including setting the unit test target in the build schemes, which probably won't be necessary in your case). Probably worth a look anyway.

How to resolve "Main module of program is empty: nothing will happen when it is run"

I have two projects in an F# solution.
1. main project with [EntryPoint] and set as the StarUp project.
2. support, the second project, holds a group of support modules. I.e. they are only called and never initiate anything nor serve as the entry point nor are the StartUp project.
For the last module in the support project, compiling in Visual Studio gives
warning FS0988: Main module of program is empty; nothing will happen
when it is run
While using compiler option nowarn inline as #nowarn "988" in the module causing the warning does suppress the message I would rather add something like a dummy function with comments that resolves the issue.
How does one make such a dummy function to resolve the warning?
EDIT
Jack is correct in that my support project was setup as a Console Application instead of a Class Library. Changing to Class Library resolved the warning. It is also nice to know about do () for the other case.
EDIT
While it seemed odd that I would have set a support project as a Console Application, I recently found that for some reason when I made a change to the code in the project, something changed the Output type from Class Library to Console Application. I suspect it has to do with the F# PowerPack and it's build rules, but it's only a guess.
Are you building the support project as a Library or as a Console Application? (This is set via the project properties page.)
If you're building it as a library, then you may need to add a do() at the end of the last file in the project. This is necessary to make the F# compiler happy in a few specific scenarios, like when you create a module which contains only assembly-level attributes (because they're applied to the assembly, the module appears "empty" to the compiler).
You can see an example in my code here:
https://github.com/jack-pappas/FSharp.Compatibility/blob/master/FSharp.Compatibility.OCaml/AssemblyInfo.fs

In Ruby debug, only step through application/project files and skip framework files?

I'm using pry-debugger with debugger. When stepping through the execution stack, I would like to skip over framework and library files and only view code in my project (a rails app).
Is there a way to do this?
Similar question here.
I'm stuck with the same question.
Apparently you can exclude the files you don't want to enter by going into Run|Edit configurations, then select the code coverage tab and click on the add patterns button.
You have to put in a regular expression for the files you want to exclude.

ide sublime2 how to find method definition

I'm using Sublime 2 for Ruby On Rails programming.
I need a ability to click a method name and jump to class where the method is defined. There are many IDE with similar capability...
Goto symbol is Ctrl-R (linux), this gives a pop-up-list of all symbol and class definitions in the file, in definition order, and you can jump to what you're after. You could do the same thing with Goto Anything, Ctrl-P and then typing # and the method name.
Also, there is a Goto Symbol plugin, which lets you jump straight to the definition of the method name your cursor is at, with a key binding or click.
However, both those methods are limited to the current file. If you need to jump to definitions in other files, probably the best solution is the SublimeCodeIntel plugin. It seems to be working pretty well and just by hitting Ctrl-f3 (linux) will open up the file at the definition you want.
Another solution is CTags.
SublimeCodeIntel seems to be pretty buggy judging from unresolved issues on the Github tracker. Also it crashes for me, probably because the code base I'm working on is too big...
What I'm using now is the CTags package. There's no "intelligence" but it allows you to jump to definitions and back very easily and it is super fast.
upgrade to sublime text 3 and then put cursor on function name and click F12
to go back ALT+-
or from the menu click on Goto

Asset being built two times with different settings, what can I do?

In my XNA 3.1 project, I have a cubemap (*.dds) file that seems to be required by almost all of my models in my project. When I go to build my project with the cubemap set to compile into the pipeline, I receive an error going something like this:
Asset was built 2 times with different settings: using TextureImporter
and TextureProcessor, referenced by Models\AlphaDeadTree.X
(RacingGameModelProcessor), Models\AlphaPalm.X
(RacingGameModelProcessor), Models\AlphaPalm2.X
(RacingGameModelProcessor), Models\AlphaPalm3.X
(RacingGameModelProcessor)...
And so on and so forth. Several google results mention that simply removing the file from the Content node, while retaining the physical file in its directory will solve the problem, however, it seems as though it's no longer loaded into the Content pipeline once it's removed from the project's Content node, despite the models requiring that file.
At this point, what can I do? Is my only option to ignore that gigantic warning message?
I see on your Content.contentproject that you still direct reference model textures (textures\SkyCubeMap.dds, Shaders\Textures\NormalizeCubeMap.dds, ...): this is not correct. From your content project you only have to reference models (.X) but not textures (.tga, *.dds, etc.) used by the models. Don't worry for those textures: they will automatically be located, imported and processed.
For example, if you have a model called Tank.X and that model uses a texture called Tank.dds you only have to include Tank.X in your content project. Including Tank.dds will produce the error.
On the other hand, you will have to include on your content project textures that you are going to load by hand: Content.Load("MyByHandLoadedTexture");
If you need to load the same texture from a model and by hand you will have to duplicate it and make the models use one copy and include the other copy in the content project in order to be loaded by hand.
Also you can right click the texture and in the properties dialog look for the 'Build Action' option and set to 'None'. This works for me in XNA 4.0.
The cubemap is built twice because it's referenced by one or more models (firs time) and because it's referenced explicitly by your content project (second time).
Try to remove it from your content project but CAUTION, don't click it and press "delete": this would remove it from the disk. Right-click it and, from the contextual menu, select "exclude from project" (or something similar... I use a localized version of Visual Studio and don't know the exact option label in english).

Resources