Is there a way to find all unbound steps in SpecFlow? - specflow

My case is this: I refactor some test steps and I wanna make sure after my refactoring is done all old tests steps are changed to new ones.
So I need to make sure my project doesn't have unbound steps. Is there a way to do this?

Yes, there is. Specflow has a 'stepdefinitionreport' command which you can use to generate a HTML report which shows which steps are used / unused.
specflow.exe stepdefinitionreport MySpecflowProject.csproj /BinFolder:bin/debug
MySpecflowProject.csproj is your project, BinFolder: is the output directory where the report will be made.

I use a unit test coverage tool (such as dotcover) to highlight used steps (green).
This show unused steps as grey for easy removal.

Related

Adding new Ant targets to org.dita.eclipsehelp

I need to do some postprocessing with the output of Eclipse Help transformation. Nothing too fancy, just some folder arrangement, adding some extra files.
I made a plugin for this purpose, but I didn't find the right extension points for Eclipse help, so I've had to implement my ant targets with depend.preprocess.post and depend.preprocess.clean-temp.pre.
The result is obvious: my plugin is working, but messes up all other output type.
I think the best scenario for me would be an extension point right at the end of the Eclipse help pipeline. How can I achive something like that?
Currently using: DITA-OT 2.1
Thanks in advance!
As you can see by opening the "DITA-OT/plugins/org.dita.eclipsehelp/plugin.xml", the "org.dita.eclipsehelp" plugin defines 4 extension points that could be used by another plugin, two of them are XSLT, one is for adding extra parameters and one called "dita.map.eclipse.index.pre" is for registering an extra ANT target to be called before the indexing is done.
So I think you will probably need to directly edit the "org.dita.eclipsehelp" plugin or copy it entirely and make it your own, rename its id, its transformation type.

MSBuild argument to let pickles import test results causes Illegal path error

We are using SpecFlow to apply BDD practices and Pickles to generate the documentation.
Our build looks like this:
Build
Deploy
Test (using VSTest)
Generate documentation (using Pickles)
The generate documentation step comes after the Test step, so we can include testresults to pickles. I want to use pickles as a build step, so I can manage the pickles version to use and additional options in each Solution.
The Visual Studio Build step in TFS2017 looks like this:
/t:DocumentationGeneration
/p:Pickles_Generate=True
/p:Pickles_DocumentationFormat=dhtml
/p:Pickles_ResultsFile="$(build.sourcesdirectory)/TestResults/*.trx"
/p:Pickles_OutputDirectory="$(build.artifactstagingdirectory)/PickledDocumentation"
[some more generic parameters that are not relevant here]
When I do the above, I get an "Illegal character in path" error during the build. It seems to be the * causing this error, when I replace it with /p:Pickles_ResultsFile="$(build.sourcesdirectory)/TestResults/testresults.trx" there is no problem at all, only the testresults are not found because the testresults are in the non predictive format:
USERNAME_SERVERNAME1234 2017-02-02 09_09_09.trx
I tried to look into generating a generic name for the .trx file, but VSTest does not support custom names. Did anyone else encounter this problem and is there a nice approach to solve it?
Pickles only supports the exact name of the test result file. There is an issue on the GitHub project site to allow wildcards. As the maintainer of Pickles, I will be happy to review any pull requests that address that issue.
At request: This is how I solved it. It is more a work around that works in my particular situation, but at the bottom I explain how I hope it will be fixed soon.
Create a Command Line build step right after test build step
as tool use Rename
as arguments use "$(build.sourcesdirectory)\TestResults\*.trx" TestResults.trx
Now you can use a Visual Studio Build step to generate pickles documentation (you need to have pickles as NuGet package in your project)
As Solution set $(Build.SourcesDirectory)/yourproject.csproj
As buildarguments set additional parameters:
/t:DocumentationGeneration
/p:Pickles_Generate=True
/p:Pickles_DocumentationFormat=dhtml
/p:Pickles_ResultsFile="$(build.sourcesdirectory)/TestResults/TestResults.trx"
/p:Pickles_ResultsFormat="vstest"
/p:Pickles_OutputDirectory="yourdestinationpath"
As I said, the renaming is a bit a work around, so I extended the code of pickles itself to enable wildcard support, and is now a pull request in the pickles repo, so hopefully it is implemented in the next release and you all can use it that way :).

Create/Run IntelliTests automatically

I have been working with Pex(IntelliTests) for some time now and I wondered if it is possible to create the tests via some sort of command(or .exe) and not through the IDE(VS2015) with right-clicking the function.
I have an automated process which builds my projects and further runs my tests. However if the IntelliTests are not generated anew for the new implementation they are rather useless.
This may seem like a basic question but unfortunately I could not find any information on the internet.
A command line for IntelliTest is not yet supported. If you would like to see it supported, kindly add your vote here: https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/8623015-enable-intellitest-to-run-in-the-build-pipeline

How to use TFS Build Process: LabelSources?

I'm attempting to modify my build process file for TFS 2010. I have a flag that is set when queuing the build, and when said flag is set, I want to create a Label, and add all the source files in the compiled project to that label.
On sequential builds, with the flag set, I than want to replace older source files in said label with anything new in the changeset being compiled.
I've been attempting to do this with LabelSources with no luck, and there is but vary poor documentation on either LabelSources or LabelWorkspace (whats the difference?).
Here's what I currently have:
<mtbwa:LabelSources
Child="[LabelChildOption.Replace]"
Comment="Published to Container"
DisplayName="Create Container Label"
sap2010:WorkflowViewState.IdRef="LabelSources_1"
Items="[{"$/Foo/LabelTest/Sandbox/"}]"
Name="[String.Format("{0}-{1}", LabelName, Version_Container)]"
Recursion="[RecursionType.Full]"
Scope="$/Foo"
mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces"
Version="T" />
It definitely hits the action, but no labels can be found after the fact.
Any help would be much appreciated. and Any tangible documentation, other than Class Documentation with sparse definitions would also be greatly appreciated
Edit 1: Tried to clear up my goal.
What you are trying to do is built into the existing template. There should be an option in the process definition that refers to Clean Sources which will be set to True.
This option controls wither the build sources get cleaned, deleted and start afresh. Or if a differential is done.
If you have a lot of source code you can set clean sources to false and save a bunch of time getting the code.
You can also speed the build by placing a TFS Proxy on the build box which will cache the files and make a clean build quicker.
In my experience, Most of the built-in activities are poorly-documented for a reason - their only well-tested use case is their use inside TFS' built-in templates (DefaultTemplate.11.0.xaml, etc.). I'm afraid you're going to have to write some custom code, in the form of a custom activity, powershell script or something, to achieve other goals.
That said, I don't really understand the process you're trying to set up. Do you just want to have a label set as your latest-successfully-built sources? Why not use the one created automatically by the build itself?

Creating build definition with visual studio

I am creating a build definition in visual studio 2013. As you know, while creating build definition we can also set the assembly (in "Automated Tests" section) which contains the unit test methods to run. I am able to create the definition till this point. Now, what I want is once the test run is over, I want to call an exe that will parse the Trx file generated as a result of test run and send the run results in an email.
Can anyone have an idea about where I can set the path to the exe and pass some arguments to it while creating build definition? If this cannot be done while creating definition, what else is the other way to achieve it?
Thanks!
What you ask involves multiple steps, especially if you want to pull the tool from version control (which is IMHO the best option).
See the ALM Rangers' Team Foundation Build Customization Guide for help and guidance on this topic.
Or you can just setup an email notification when the TFS Build completes. That should include the test run results, and a clickable link to go to the full build report.

Resources