【问题标题】:Selenium IDE Test Case Pass / FailSelenium IDE 测试用例通过/失败
【发布时间】:2017-02-16 02:44:15
【问题描述】:

我是使用Selenium IDE 的新手。我正在编写这个测试用例,其中用户 A 单击此链接,然后它应该将用户引导到正确的页面。不幸的是,页面返回:

An error occured. Message: script 'pp/agensi-list.phtml' not found in path (C:/htdffocs/star/application/views\scripts/**)

但是在我的 selenium 上,它显示测试用例已经通过(它应该失败)。

谁能告诉我为什么?

【问题讨论】:

    标签: selenium testing automated-tests selenium-ide


    【解决方案1】:

    您好,使用 selenium 和 testng 框架编写测试用例结果通过/失败非常容易,请阅读下面的链接,我已经给出了明确的示例。

    How can I write Test Result (Pass/Fail) in Excel file using TestNG Framework with Selenium WebDriver?

    更多实时示例,您可以阅读write test case pass/fail in excel using testng

    您只需为文件输入流和文件输出流类创建 Excel 实用程序,如下所示,并使用扩展关键字将该类调用到另一个类中

    Excel 实用程序:

    public class Excelutility {
    
    @BeforeTest
    public void exceloperation(){
    
    FileinputStream file = new FileiinputStream("file path");
    //do file input stream details here
    Fileoutputstream newfile=new Fileoutputstream("filepath");
    //do fileoutputstream details here like create workbook,create sheets etc
    }
    }
    

    另一个类:

    public class operations{
    
    @Test
    public void openbrowser(){
    
    //write driver operations here
    
    //write excel operations using 
    if(Title.equalsIgnoreCase("HP Loadrunner Tutorial")){
                    Testcase="PASS";                    
            }else{
                Testcase = "FAIL";              
            }
    Label l1=new Label(1,2,"status")
    writablesh.addCell(l3);
    }
    

    【讨论】:

      【解决方案2】:

      测试可能通过了,因为您在点击后没有验证任何内容。

      如果在单击链接后测试停止,那么它将通过。你必须确认发生了什么事。寻找 CSS 的变化,或者甚至寻找您上面列出的消息?

      【讨论】:

      • 谢谢。但是如何让 selenium 显示失败或通过?
      • 已更新我的答案。代码仍然会有所帮助
      猜你喜欢
      • 2023-03-29
      • 2015-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-17
      • 2021-09-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多