2017-02-16 66 views
0

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

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

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

有人能告诉我为什么吗?

回答

0

嗨很容易写测试用例结果通过/失败使用硒与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

只要你必须创建的FileInput流和FileOutputStream中的类Excel的工具如下并调用该类到使用另一个类extends关键字

的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 
} 
} 

另一个CLA ss:

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); 
} 
0

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

如果在链接被点击后停止测试,它会通过。你必须确认发生了什么事。在CSS中查找更改,或者查找上面列出的消息?

+0

谢谢。但如何使硒显示失败,或通过? – aemy

+0

你可以发布你的代码吗? – Brainles71

+0

已经更新我的回答。代码仍然有帮助 – Brainles71