我在测试报告中收到错误:
我按照以下步骤
- 我用 java 方法编写了所有测试用例,并使用了 if else 等 java 验证来通过我的测试用例
2.我创建了一个testng类,在testng类中我调用了我所有的java方法
我执行了 testng 类,这个类包含大约 30 个 java 方法,每个方法都是一个测试用例。
如果我执行为基于 testng 的注释生成的类报告,它不会将 java 方法考虑到测试用例中,我如何调用我所有的 java 方法?我需要为我的 java 方法生成报告
这是我的代码:
import java.io.FileNotFoundException;
import java.io.IOException;
import jxl.read.biff.BiffException;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class DocumentSearchTest {
WebElements webEleObj;
/*
* AllLetter Lettobj ; AllSearch allseObj; AllTranscript TraObj;
*/
FrameSearchExported fseObj;
TextBoxSearch textObj;
DateSinceSearch dateSinceObj;
/*
* public void loginTest() throws FileNotFoundException, BiffException,
* IOException, InterruptedException {
* webEleObj.textbox(webEleObj.properties
* ("Username"),webEleObj.excelRead(1,2,1));
* webEleObj.textbox(webEleObj.properties
* ("Password"),webEleObj.excelRead(2,2,1)); webEleObj.sleep(5000);
* webEleObj.button(webEleObj.properties("Login")); webEleObj.sleep(20000);
*
* }
*/
@BeforeClass
public void start() throws FileNotFoundException, BiffException,
IOException, InterruptedException, RowsExceededException,
WriteException {
// Assert.assertEquals(true, true, "Loggend into application");
webEleObj = new WebElements();
/*
* allseObj = new AllSearch(webEleObj); Lettobj = new
* AllLetter(webEleObj); TraObj =new AllTranscript(webEleObj);
*/
fseObj = new FrameSearchExported(webEleObj);
textObj = new TextBoxSearch(webEleObj);
dateSinceObj = new DateSinceSearch(webEleObj);
webEleObj.browserLaunch();
webEleObj.loginTest();
webEleObj.sleep(20000);
webEleObj.setUpApp();
// webEleObj.excelwrite(4);
System.out.println("hi logged in");
}
@Test
public void ts_1() throws FileNotFoundException, IOException,
InterruptedException, RowsExceededException, BiffException,
WriteException {
webEleObj.sleep(10000);
System.out.println("First TestCase---->");
fseObj.allexportedSearch();
fseObj.letterexportedSearch();
fseObj.transcriptexportedSearch();
fseObj.allnotexpSearch();
fseObj.letternotexpSearch();
fseObj.transcriptnotexpSearch();
fseObj.allsignsearch();
fseObj.lettersignSearch();
fseObj.transcriptsignSearch();
fseObj.allnotsignSearch();
fseObj.letternotsignSearch();
fseObj.transcriptnotsignSearch();
System.out.println("Document Search Test Case Completed");
}
/*
* @Test(enabled=false) public void ts_2() throws FileNotFoundException,
* BiffException, IOException, InterruptedException, RowsExceededException,
* WriteException { System.out.println("Second TestCase---->");
* textObj.accountNo_All(); textObj.accountNo_Letter();
* textObj.accountNo_Transcript(); textObj.firstName_All();
* textObj.firstName_Letter(); textObj.firstName_Transcript();
* textObj.lastName_All(); textObj.lastName_Letter();
* textObj.lastName_Transcript();
*
* }
*/
@Test
public void ts_3() throws FileNotFoundException, IOException,
InterruptedException, RowsExceededException, BiffException,
WriteException {
// webEleObj.sleep(10000);
System.out.println("Third TestCase---->");
dateSinceObj.datesinceAll_Today();
dateSinceObj.datesinceAll_Yesterday();
dateSinceObj.datesinceAll_ThisMonth();
dateSinceObj.datesinceAll_LastMonth();
dateSinceObj.datesinceAll_ThisYear();
dateSinceObj.datesinceAll_LastYear();
dateSinceObj.datesinceLetter_Today();
dateSinceObj.datesinceLetter_Yesterday();
dateSinceObj.datesinceLetter_ThisMonth();
dateSinceObj.datesinceLetter_LastMonth();
dateSinceObj.datesinceLetter_ThisYear();
dateSinceObj.datesinceLetter_LastYear();
dateSinceObj.datesinceTranscript_Today();
dateSinceObj.datesinceTranscript_Yesterday();
dateSinceObj.datesinceTranscript_ThisMonth();
dateSinceObj.datesinceTranscript_LastMonth();
dateSinceObj.datesinceTranscript_ThisYear();
dateSinceObj.datesinceTranscript_LastYear();
// logOut();
}
}