2

We are using SpecFlow to apply BDD practices and Pickles to generate the documentation.

Our build looks like this:

  1. Build
  2. Deploy
  3. Test (using VSTest)
  4. 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?

AutomatedChaos
  • 7,267
  • 2
  • 27
  • 47
  • 1
    There's probably no other option than to figure out the exact filename. That is not too hard, it's built-in msbuild functionality, principle would be to pass a custom 'PicklesResultsDir' to the project and withing the project have msbuild look for the files with ``. You don't say what your solution/project layout is though so I cannot tell you where exactly to put this logic. – stijn Feb 02 '17 at 08:50

2 Answers2

2

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.

  • Hi @dirk-rombauts, thanks for your great product. I will look into it and maybe I can even push a fix! (I have a real-life testcase anyways :).). Right now I solved it by renaming the .trx file with another build step. – AutomatedChaos Feb 02 '17 at 12:01
  • I'm glad you found a way to make it work for you! Feel free to ask if there are any other Pickles-related things I might be able to help you with. – Dirk Rombauts Feb 02 '17 at 13:29
  • @Cece-MSFT done. Will update when appropriate (ie wildcards are supported). – AutomatedChaos Feb 07 '17 at 10:09
0

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.

  1. Create a Command Line build step right after test build step
  2. as tool use Rename
  3. 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)

  1. As Solution set $(Build.SourcesDirectory)/yourproject.csproj
  2. 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 :).

AutomatedChaos
  • 7,267
  • 2
  • 27
  • 47