在两个测试用例之间传递变量?
Passing a variable between two test cases?
我有一组简单的测试用例,其中我首先将一个变量分配给一个图形。然后在另一个测试用例中,我试图访问该变量并注销。
这是我目前的情况。
TestCase1
${FIGURE}= get text xpath=//*[@id="reportTableId"]/tr[1]/td[14]
set variable ${FIGURE}
log ${FIGURE}
TestCase2
log ${FIGURE}
但是,在第二个测试用例中。 ${FIGURE}
显示为未分配。
有没有我遗漏的步骤?
测试用例中的变量是局部范围的,在其他测试中是不可见的。如果你想在另一个测试中访问 ${FIGURE}
,你应该将它设置为套件变量:
TestCase1
${FIGURE}= get text xpath=//*[@id="reportTableId"]/tr[1]/td[14]
set suite variable ${FIGURE}
log ${FIGURE}
TestCase2
log ${FIGURE}
我有一组简单的测试用例,其中我首先将一个变量分配给一个图形。然后在另一个测试用例中,我试图访问该变量并注销。
这是我目前的情况。
TestCase1
${FIGURE}= get text xpath=//*[@id="reportTableId"]/tr[1]/td[14]
set variable ${FIGURE}
log ${FIGURE}
TestCase2
log ${FIGURE}
但是,在第二个测试用例中。 ${FIGURE}
显示为未分配。
有没有我遗漏的步骤?
测试用例中的变量是局部范围的,在其他测试中是不可见的。如果你想在另一个测试中访问 ${FIGURE}
,你应该将它设置为套件变量:
TestCase1
${FIGURE}= get text xpath=//*[@id="reportTableId"]/tr[1]/td[14]
set suite variable ${FIGURE}
log ${FIGURE}
TestCase2
log ${FIGURE}