.net 术语';纽曼&x27;未被识别为cmdlet的名称,
我能够从常规powershell执行.net 术语';纽曼&x27;未被识别为cmdlet的名称,,.net,powershell,jenkins,postman,newman,.net,Powershell,Jenkins,Postman,Newman,我能够从常规powershell执行newman命令,而不会出现问题: 但是,当我让Jenkins运行相同的脚本时,我会得到以下输出: Checkinig prerequisites Chocolatey is already installed NodeJS is already installed NPM is already installed Starting collection tests Testing C:\Program Files (x86)\Je
newman
命令,而不会出现问题:
但是,当我让Jenkins运行相同的脚本时,我会得到以下输出:
Checkinig prerequisites
Chocolatey is already installed
NodeJS is already installed
NPM is already installed
Starting collection tests
Testing C:\Program Files (x86)\Jenkins\workspace\GenericServiceWithPostman\Collections\Account Recv Microservice.postman_collection.json
newman : The term 'newman' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At C:\Program Files
(x86)\Jenkins\workspace\GenericServiceWithPostman\RunColletionTests.ps1:47
char:1
+ newman run $test.FullName --environment .\Environments\DEV01.postman_ ...
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (newman:String) [], CommandNotFo
undException
+ FullyQualifiedErrorId : CommandNotFoundException
我运行的脚本:
$tests = gci .\Collections\*postman_collection.json| Select-Object -Property FullName
foreach ($test in $tests)
{
Write-Host ""
Write-Host " Testing " $test.FullName
Start-Sleep -s 5
newman run $test.FullName --environment .\Environments\DEV01.postman_environment.json
}
术语“newman”不被识别为cmdlet的名称
我做错了什么?我如何才能让它看到
纽曼
?无论运行Jenkins的是什么,它看起来好像不在它的路径上。在Jenkin的服务帐户上下文下,尝试where.exe newman
。如果它在路径中,它应该返回程序的位置。不管运行Jenkins的是什么,看起来newman不在它的路径中。在Jenkin的服务帐户上下文下,尝试where.exe newman
。如果它在路径中,它应该返回程序的位置。您应该选择安装
npm安装-g newman
调用您的集合:newman run examples/sample-collection.json
或使用纽曼作为库:
const newman=require('newman');//在你的项目中需要纽曼
// call newman.run to pass `options` object and wait for callback
newman.run({
collection: require('./sample-collection.json'),
reporters: 'cli'
}, function (err) {
if (err) { throw err; }
console.log('collection run complete!');
});
您应该安装
npm安装-g newman
调用您的集合:newman run examples/sample-collection.json
或使用纽曼作为库:
const newman=require('newman');//在你的项目中需要纽曼
// call newman.run to pass `options` object and wait for callback
newman.run({
collection: require('./sample-collection.json'),
reporters: 'cli'
}, function (err) {
if (err) { throw err; }
console.log('collection run complete!');
});
参见此问题的答案:参见此问题的答案: