2017-03-09 2 views
0

Ich führe ein Batch-Skript in Jenkins Job aus.Unerwarteter Token '' an Position 3 in Auswahlausdruck

C:\Users\Administrator\AppData\Local\Apps\OpenCover\OpenCover.Console.exe "-target:C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" "-targetargs:C:\Test\src\Example.Tests\bin\Debug\example.Tests.dll --where "cat == Unit" -register:Administrator 

Ich benutzte Filter auch, aber keine Verwendung.

C:\Users\Administrator\AppData\Local\Apps\OpenCover\OpenCover.Console.exe "-target:C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" "-targetargs:C:\Test\src\Example.Tests\bin\Debug\example.Tests.dl -filter:"+[Unit]*" -register:Administrator 

Dieser Stapelbefehl hat eine Where-Bedingung (--where "cat == Unit"). Wenn ich dies ausführe, erhalte ich einen Fehler.

Testdateien

C:\Test\src\Example.Tests\bin\Debug\example.Tests.dll 
    == 
    Unit 

Test Filters 
    Where: cat 

Unexpected token '' at position 3 in selection expression. 
Committing... 
No results, this could be for a number of reasons. The most common reasons are: 
    1) missing PDBs for the assemblies that match the filter please review the 
    output file and refer to the Usage guide (Usage.rtf) about filters. 
    2) the profiler may not be registered correctly, please refer to the Usage 
    guide and the -register switch. 

Wegen dieses Fehlers bin ich Code Coverage bekommen nicht in der Lage. Bitte schlagen Sie vor. Ich fand den Link unten, aber ich kann das nicht erledigen.

https://github.com/codecov/example-csharp 

aktualisierte Fehlerprotokolle.

Incorrect Arguments: The argument 'cat == Unit' is not recognised 

Usage: 
    ["]-target:<target application>["] 
    [["]-targetdir:<target directory>["]] 
    [["]-searchdirs:<additional PDB directory>[;<additional PDB directory>][;<additional PDB directory>]["]] 
    [["]-targetargs:<arguments for the target process>["]] 
    [-register[:user]] 
    [["]-output:<path to file>["]] 
    [-mergeoutput 
    [["]-filter:<space separated filters>["]] 
    [["]-filterfile:<path to file>["]] 
    [-nodefaultfilters] 
    [-regex] 
    [-mergebyhash] 
    [-showunvisited] 
    [-returntargetcode[:<opencoverreturncodeoffset>]] 
    [-excludebyattribute:<filter>[;<filter>][;<filter>]] 
    [-excludebyfile:<filter>[;<filter>][;<filter>]] 
    [-coverbytest:<filter>[;<filter>][;<filter>]] 
    [["]-excludedirs:<excludedir>[;<excludedir>][;<excludedir>]["]] 
    [-hideskipped:File|Filter|Attribute|MissingPdb|All,[File|Filter|Attribute|MissingPdb|All]] 
    [-log:[Off|Fatal|Error|Warn|Info|Debug|Verbose|All]] 
    [-service[:byname]] 
    [-servicestarttimeout:<minutes+seconds e.g. 1m23s> 
    [-communicationtimeout:<integer, e.g. 10000> 
    [-threshold:<max count>] 
    [-enableperformancecounters] 
    [-skipautoprops] 
    [-oldStyle] 
or 
    -? 
or 
    -version 

For further information on the command line please visit the wiki 
    https://github.com/OpenCover/opencover/wiki/Usage 

Filters: 
    Filters are used to include and exclude assemblies and types in the 
    profiler coverage; see the Usage guide. If no other filters are supplied 
    via the -filter option then a default inclusive all filter +[*]* is 
    applied. 
Logging: 
    Logging is based on log4net logging levels and appenders - defaulting 
    to a ColouredConsoleAppender and INFO log level. 
Notes: 
    Enclose arguments in quotes "" when spaces are required see -targetargs. 
+0

Benötigen Sie vielleicht ein Zitat nach 'example.Tests.dll'? –

+0

Hat nach dem Zitieren der DLL nicht funktioniert –

Antwort

2

Das sieht aus wie Unsinn

"-targetargs:C:\Test\src\Example.Tests\bin\Debug\example.Tests.dl -filter:"+[Unit]*" 

So etwas sollte besser funktionieren

"-targetargs:C:\Test\src\Example.Tests\bin\Debug\example.Tests.dll" -filter:"+[*Unit]*" 

Ich empfehle Ihnen, Power intstead von Batch-Dateien

Hier ist das Beispielskript, um zu versuchen : https://github.com/rpokrovskij/opencover4vs.ps1

Legen Sie es in Lösung Ordner, ändern Sie die erste Zeile, und ich hoffe, es wird für Sie arbeiten, ohne zusätzliche Änderungen.