简体   繁体   中英

Error “The expression ['$Agent.NUnit.3.0.Path$' exists] evaluated False” when trying to run NUnit from final builder?

I'm trying to run some unit tests using Final Builder Continua but nothing I try seems to work. I've configured a Unit test stage:

在此处输入图片说明

But everytime I run the build I get the error:

The expression ['$Agent.NUnit.3.0.Path$' exists] evaluated False

在此处输入图片说明

then the whole thing hangs. There are several issues reported on the final builder forums but the soliutions all relate to older versions or various other fixes none of which seem to apply to my situation.

I'm guessing it doesn't know where the NUnit console is. I have tried specifying the missing parameter in the build config for the agent: 在此处输入图片说明

I've tried installing NUnit from nuget

nuget install nunit

Has anyone any experince of this or solutions to this issue?

I'm using continua 1.8.1.277

It's not practical for Continua CI to know all possible installation locations for NUnit. If installed using NuGet then it will be installed under the current directory by default - this installation folder can be changed using the OutputDirectory parameter for NuGet.

Editing the property collector search path is not considered to be a hack - it is actually a recommended solution if you know the path of the executable.

Another equally valid solution would be to add the path to the executable to the PATH environment variable on your agent. As of v1.8.1.556 , Continua CI will automatically pick up changes to the PATH variable without restarting agent service.

Note that the NUnit action also provides a option to install the executable using NuGet as part of the build:

使用NUnit操作中的NuGet选项在代理上安装NUnit

Ticking the "Install NUnit on agent using NuGet" will show a NuGet tab allowing you to enter the NuGet install parameters.

在此处输入图片说明

You can also choose "Custom" in the Using drop-down. This allows you to specify the path to the executable to use for this action.

在此处输入图片说明

Simply by clicking in random places I noticed this under Property Collectors (No I don't know what this actually means):

在此处输入图片说明 在此处输入图片说明

This seems to suggest that it will look in certain folders for Nunit (not where nuget installs them interestingly):

Finds the executable 'nunit3-console.exe' in any of the following locations '%PROGRAMFILES%\\NUnit.org\\nunit-console\\, %PROGRAMFILES(x86)%\\NUnit.org\\nunit-console\\, %PATH%'.

So I created a new folder in my program files and copies the required nunit3-console.exe etc. into it. I now no longer get the error.

Seems that edit allows your to (ahem) edit these paths. So a better solution is to add the path to NUnit into this variable:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM