选择表达式中位置3处的意外标记'' [英] Unexpected token '' at position 3 in selection expression

查看:259
本文介绍了选择表达式中位置3处的意外标记''的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Jenkins Job中执行批处理脚本.

I am executing a batch script in Jenkins Job.

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

我也使用了过滤器,但没有用.

I used Filter as well but no use.

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

此批处理命令具有where条件(--where"cat == Unit").当我执行此操作时,我将遇到错误.

This batch command has a where condition (--where "cat == Unit"). When I execute this I am getting below error.

测试文件

  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.

由于此错误,我无法获得代码覆盖率.请提出建议.我在下面找到了链接,但无法完成此操作.

Because of this error I am not able to get Code Coverage. Please suggest.I found below link but I am unable to get this done.

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

更新的错误日志.

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.

推荐答案

这看起来像胡话

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

类似的东西应该会更好

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

我建议您尝试使用Powershell代替批处理文件

I recommend you to try powershell intstead of batch files

这是示例脚本: https://github.com/rpokrovskij/opencover4vs.ps1

将其放入解决方案文件夹,修改第一行,希望它能为您工作,而无需进行其他更改.

Put it to solution folder, modify first line , and I hope it will work for you, without additional changes.

这篇关于选择表达式中位置3处的意外标记''的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆