Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在Robot框架中处理异常?_Java_Python_Robotframework - Fatal编程技术网

Java 如何在Robot框架中处理异常?

Java 如何在Robot框架中处理异常?,java,python,robotframework,Java,Python,Robotframework,我想了解在Robot中异常处理是如何完成的。我想用一些通用的方法处理来自多个测试用例的异常。您可以使用以下两个关键字: 运行关键字并在失败时继续 运行关键字并根据您的要求忽略错误,但我建议使用第二个关键字,因为您将能够存储输出和状态 例如,可以定义测试拆卸关键字。在我的案例(web自动化解决方案)中,会发生以下情况: # Following closes potential alert and saves what the alert says ${message} = Run Keywo

我想了解在Robot中异常处理是如何完成的。我想用一些通用的方法处理来自多个测试用例的异常。

您可以使用以下两个关键字:

  • 运行关键字并在失败时继续

  • 运行关键字并根据您的要求忽略错误,但我建议使用第二个关键字,因为您将能够存储输出和状态


  • 例如,可以定义测试拆卸关键字。在我的案例(web自动化解决方案)中,会发生以下情况:

    # Following closes potential alert and saves what the alert says
    ${message} =    Run Keyword And Ignore Error    Handle Alert    timeout=0s
    # This is a keyword that empties download/upload directories and saves their content for future debugging
    Save Artefacts    uploadDir=${global_uploadDir}    downloadDir=${global_downloadDir}    outputDir=${global_outputDir}    testStatus=${TEST STATUS}
    # This keyword just captures a screenshot in case that test failed
    Run Keyword If Test Failed    Capture Page Screenshot
    
    “处理异常”是什么意思?什么例外?正在测试的应用程序中是否存在异常?