Robotframework 如何在Robot框架中使用/实现SoftAssert特性

Robotframework 如何在Robot框架中使用/实现SoftAssert特性,robotframework,Robotframework,我在Java中使用了TestNG SoftAssert特性,我们在其中进行多次验证,并将每次验证的结果存储在SoftAssert中,并在测试用例结束时将所有验证结果存储在测试用例assert中 我在Robot框架中找不到类似的功能。如果RobotFramework中存在此功能,是否有人知道如何实现或使用此功能?您可以使用。如果您运行的关键字失败,测试将继续运行,并在结束时报告失败 例如: 以下是使用此关键字的测试: *** Test cases *** Example run keywo

我在Java中使用了TestNG SoftAssert特性,我们在其中进行多次验证,并将每次验证的结果存储在SoftAssert中,并在测试用例结束时将所有验证结果存储在测试用例assert中

我在Robot框架中找不到类似的功能。如果RobotFramework中存在此功能,是否有人知道如何实现或使用此功能?

您可以使用。如果您运行的关键字失败,测试将继续运行,并在结束时报告失败

例如:

以下是使用此关键字的测试:

*** Test cases ***
Example
    run keyword and continue on failure  log   this passes
    run keyword and continue on failure  fail  this is a failure
    run keyword and continue on failure  log   this also passes
    run keyword and continue on failure  fail  this is also a failure
运行时,您将在控制台上看到:

==============================================================================
Example                                                                          
==============================================================================
Example                                                               | FAIL |
Several failures occurred:

1) this is a failure

2) this is also a failure
------------------------------------------------------------------------------
Junk                                                                  | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
您也可以使用该关键字作为测试模板的值,尽管我不认为我会推荐它作为标准实践:

*** Test cases ***
Example
    [template]  run keyword and continue on failure
    log   this passes
    fail  this is a failure
    log   this also passes
    fail  this is also a failure
你可以用。如果您运行的关键字失败,测试将继续运行,并在结束时报告失败

例如:

以下是使用此关键字的测试:

*** Test cases ***
Example
    run keyword and continue on failure  log   this passes
    run keyword and continue on failure  fail  this is a failure
    run keyword and continue on failure  log   this also passes
    run keyword and continue on failure  fail  this is also a failure
运行时,您将在控制台上看到:

==============================================================================
Example                                                                          
==============================================================================
Example                                                               | FAIL |
Several failures occurred:

1) this is a failure

2) this is also a failure
------------------------------------------------------------------------------
Junk                                                                  | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
您也可以使用该关键字作为测试模板的值,尽管我不认为我会推荐它作为标准实践:

*** Test cases ***
Example
    [template]  run keyword and continue on failure
    log   this passes
    fail  this is a failure
    log   this also passes
    fail  this is also a failure

显示注释@Dev.的代码测试用例。。我正在探索RF中合适的关键字。Bryan已经为我的问题提供了一个解决方案,展示了您的代码,并对注释@Dev.进行了测试。。我正在探索RF中合适的关键字。Bryan为我的queryPerfect提供了一个解决方案!这就是我要找的!谢谢@BryanPerfect!这就是我要找的!谢谢@Bryan