Java Selenium与Apache Poi在Excel中保存错误消息
我有一个Excel文件,可以读取测试参数。 我想将测试期间显示的错误消息保存在同一个Excel文件中。我在Excel中创建了一个名为“status”的列。 带有错误消息的代码示例:Java Selenium与Apache Poi在Excel中保存错误消息,java,excel,selenium,apache-poi,Java,Excel,Selenium,Apache Poi,我有一个Excel文件,可以读取测试参数。 我想将测试期间显示的错误消息保存在同一个Excel文件中。我在Excel中创建了一个名为“status”的列。 带有错误消息的代码示例: if((Konfiguration.get("some excel parametr").equalsIgnoreCase("metro"))) { throw new RuntimeException("My error messages"); } 如何将此错误消息保存在Excel文件中名为“statu
if((Konfiguration.get("some excel parametr").equalsIgnoreCase("metro"))) {
throw new RuntimeException("My error messages");
}
如何将此错误消息保存在Excel文件中名为“status”的列中,以写入Excel文件中的特定列中
FileInputStream file = new FileInputStream(new File(File_path));
HSSFWorkbook yourworkbook = new HSSFWorkbook(file);
HSSFSheet sheet1 = yourworkbook.getSheetAt(0);
Row row = sheet1.getRow(2);
Cell column = row.getCell(5);
column.setCellValue(your_error_message);
还可以使用指针跟踪上次写入期间写入的列