我有一个用于soapUI项目的jenkinsfile。
我需要从输入中获取值。例如“线程”
[$class: 'DynamicReferenceParameter',
name: 'strategyParams',
referencedParameters: 'strategySelect',
choiceType: 'ET_FORMATTED_HTML',
description: '...',
filterable: false,
script: [
$class: 'GroovyScript',
fallbackScript: [
classpath: [],
sandbox: true,
script: 'return ["..."]'
],
script: [
classpath: [],
sandbox: true,
script: """
if (strategySelect == 'Simple') {
return '''
<p><b>...</b><br><input type="text" class="" name="threads" value="" placeholder="Thread"></p>
<p><b>...</b><br><input type="text" class="" name="testDelay" value="" placeholder="Test Delay"></p>
<p><b>...</b><br><input type="text" class="" name="randomFactor" value="0.5" placeholder="Random"></p>
<p><b>...</b><br><select name="limitType" >
<option>Seconds</option>
<option>Total Runs</option>
<option>Runs per Thread</option>
</select></p>
<p><b>...</b><br><input type="text" class="" name="testLimit" value="" placeholder="Test Limit"></p>
'''
并将其放入testrunner
sh '/opt/SoapUI-5.7.0/bin/testrunner.sh -P threads=${strategyParams["threads"]} -P testDelay=${strategyParams["testDelay"]} -P randomFactor=${strategyParams["randomFactor"]} -P limitType=${strategyParams["limitType"]} -P testLimit=${strategyParams["testLimit"]} loadTests.xml -s Load -c Config -r'
我尝试了-P threads=${strategyParams["threads"]}
和-P threads=${threads}
,在作业运行后,我在jenkins控制台中看到空值-P threads=
。
1条答案
按热度按时间tzcvj98z1#
我从Jenkins Community的用户那里得到的解决方案-很有帮助:)
Jenkins community