picklesdoc/pickles

Powershell and xunit2 - An error occurred during the activation of a particular registration

andez2000 opened this issue · 3 comments

I have created a dotnetcore application with xunit (2.4.1) as the unit test framework. I followed this example to get a powershell command line running to generate the docs.

My powershell

file to do this looks like the following:

$UserName = [Environment]::UserName

$root = "C:\dev.me\github\$UserName\living-docs\pickles\example1\"
$FeatureDirectory = "$root\acme.app.specs\Specs\Courses\Enrolment"
$OutputDirectory = "$root\docs"
$DocumentationFormat = "html"
$SystemUnderTestName = "Example"
$SystemUnderTestVersion = "1.3.42"
$TestResultsFormat = "xunit2"
$TestResultsFile = "$root\results\mytests_2019-08-28_10-06-01-108.trx"

cd $root

Import-Module C:\Users\$UserName\.nuget\packages\pickles\2.20.1\tools\PicklesDoc.Pickles.PowerShell.dll -Verbose

Pickle-Features -FeatureDirectory $FeatureDirectory -OutputDirectory $OutputDirectory -DocumentationFormat $DocumentationFormat -TestResultsFormat $TestResultsFormat -TestResultsFile $TestResultsFile -Verbose



This generates the following output and error in the console:

PS C:\dev.me\github\andez2000\living-docs\pickles\example1> C:\dev.me\github\andez2000\living-docs\pickles\example1\build\build-pickles.ps1
WARNING: The names of some imported commands from the module 'PicklesDoc.Pickles.PowerShell' include unapproved verbs that might make them less discoverable. To find the 
commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
VERBOSE: The 'Pickle-Features' command in the PicklesDoc.Pickles.PowerShell' module was imported, but because its name does not include an approved verb, it might be diff
icult to find. For a list of approved verbs, type Get-Verb.
VERBOSE: Importing cmdlet 'Pickle-Features'.
Pickles v.2.20.1.0

Generating documentation based on the following parameters
----------------------------------------------------------
Feature Directory              : C:\dev.me\github\andez2000\living-docs\pickles\example1\acme.app.specs\Specs\Courses\Enrolment
Output Directory               : C:\dev.me\github\andez2000\living-docs\pickles\example1\docs
Project Name                   : 
Project Version                : 
Language                       : en
Incorporate Test Results?      : Yes
Include Experimental Features? : No
Exclude Tag                    : 
Technical Tag                    : 
Test Result Format             : xUnit2
Test Result File               : C:\dev.me\github\andez2000\living-docs\pickles\example1\results\mytests_2019-08-28_10-06-01-108.trx
Pickle-Features : An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = ITestResults 
(DelegateActivator), Services = [PicklesDoc.Pickles.ObjectModel.ITestResults], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = 
OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = 
XUnit2Results (ReflectionActivator), Services = [PicklesDoc.Pickles.TestFrameworks.XUnit.XUnit2.XUnit2Results], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, 
Sharing = None, Ownership = OwnedByLifetimeScope ---> An exception was thrown while invoking the constructor 'Void .ctor(PicklesDoc.Pickles.IConfiguration, 
PicklesDoc.Pickles.TestFrameworks.XUnit.XUnit2.XUnit2SingleResultLoader, PicklesDoc.Pickles.TestFrameworks.XUnit.XUnit2.XUnit2ScenarioOutlineExampleMatcher)' on type 
'XUnit2Results'. ---> There is an error in XML document (2, 2). (See inner exception for details.) (See inner exception for details.) (See inner exception for details.)
At C:\dev.me\github\andez2000\living-docs\pickles\example1\build\build-pickles.ps1:16 char:1
+ Pickle-Features -FeatureDirectory $FeatureDirectory -OutputDirectory  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Pickle-Features], DependencyResolutionException
    + FullyQualifiedErrorId : Autofac.Core.DependencyResolutionException,PicklesDoc.Pickles.PowerShell.Pickle_Features

The tests are ran using dotnet test --logger "trx;logfilename=mytests.trx" -r .\results to generate the output file.

I've attached project here:
example1.zip

Hi,

Pickles does not support the test result files that are produced by .NET Core. So you can generate a living documentation of your application, but you will not be able to include test results in this case.

Cheers,
Dirk

Hmm, but the test output is XML? I'm not sat at a computer to verify. Could we not make it support dotnetcore?

The test output is indeed XML - but it has a different structure from the xml that is produced when using xunit in a non-dotnetcore environment.

With regard to making it support dotnetcore: that is of course technically possible. However, I currently don't have time to do development work on Pickles. I don't even have time to review pull requests and make releases at the moment ...