我创建了一个 Excel 文件,并在 (0,0) [row,cell] 中插入了一个新值作为Hello。第二次我打开同一个 Excel 文件、同一个工作表并用另一个字符串值更新同一个 (0,0) 单元格。
代码运行成功,没有任何错误,但文件已损坏且无法打开。
代码
namespace PractiseProject
{
public static class ExcelNPOI
{
static IWorkbook workbook;
static ISheet sheet;
static IRow row;
static ICell cell;
static string file = "C:/Users/MSTEMP/Documents/Files/Test.xlsx";
static string sheetName = "Testcase";
public static void createExcel()
{
string firstValue = "Hello";
if (!File.Exists(file))
{
using (FileStream str = new FileStream(file, FileMode.Create, FileAccess.Write))
{
workbook = new XSSFWorkbook();
sheet = workbook.CreateSheet(sheetName);
row = sheet.CreateRow(0);
cell = row.CreateCell(0);
cell.SetCellValue(firstValue);
workbook.Write(str); …Run Code Online (Sandbox Code Playgroud) 对于Java,有外部报告生成工具,如extent-report,testNG.Junit为单个要素文件生成xml格式输出.为了获得详细的报告,我在Behave框架中没有看到选项或广泛的方法或解决方案.
如何在Behave中生成报告,是否需要为Behave中的报告生成添加任何其他工具或框架?
执行测试后,我收到一个错误,该错误主要来自第二次执行时间。我也尝试过最新的 selenium 版本(3.13)和最新的 chrome 驱动程序(2.40)。
注意:测试直到昨天才通过,我从今天开始注意到这个问题。
以下是关闭驱动程序的代码。
WebDriver driver = WebDriverFactory.getDriver();
if (driver != null) {
System.out.println("Base Class's AfterClass started to quit the driver....");
driver.quit();
}
Run Code Online (Sandbox Code Playgroud)
我得到的异常如下:
Jul 17, 2018 8:48:33 PM org.openqa.selenium.os.OsProcess destroy
INFO: Unable to drain process streams. Ignoring but the exception being swallowed follows.
org.apache.commons.exec.ExecuteException: The stop timeout of 2000 ms was exceeded (Exit value: -559038737)
at org.apache.commons.exec.PumpStreamHandler.stopThread(PumpStreamHandler.java:295)
at org.apache.commons.exec.PumpStreamHandler.stop(PumpStreamHandler.java:181)
at org.openqa.selenium.os.OsProcess.destroy(OsProcess.java:135)
at org.openqa.selenium.os.CommandLine.destroy(CommandLine.java:153)
at org.openqa.selenium.remote.service.DriverService.stop(DriverService.java:222)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:95)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:443)
at commontestbase.ClientTestBase.tearDownAfterMethod(ClientTestBase.java:62)
at …Run Code Online (Sandbox Code Playgroud) 我已经安装了Pycharm社区版并使用以下命令安装了behave 1.2.5 。
pip install behave
Run Code Online (Sandbox Code Playgroud)
它已成功安装,并且可以在Pycharm 项目解释器中使用,如下所示。
但当我右键单击项目时,我没有看到创建 .feature 文件(Gherkin 文件)的选项
我是否错过了这里的任何内容,在 Pycharm professional 中默认 Behave BDD 可用。如何配置 Pycharm 社区的行为。
我在量角器中使用 browser.sleep 将执行保持特定的时间。以类似的方式,我尝试了 WebDriverIO 中的 browser.pause 。但它不会暂停给定的时间。
即使对于浏览器暂停我参考了WebDriverIO官方文档,也给出了相同的内容
步骤定义代码:
Given(/^Verify the title of Salesforce web page$/,function(){
browser.url('https://login.salesforce.com/');
browser.pause(10000);
});
Run Code Online (Sandbox Code Playgroud)
我在配置中使用异步模式
WebDriverIO 版本:^5.22.4
wdio.config.js
exports.config = {
//
// ====================
// Runner Configuration
// ====================
//
// WebdriverIO allows it to run your tests in arbitrary locations (e.g. locally or
// on a remote machine).
runner: 'local',
//
// Override default path ('/wd/hub') for chromedriver service.
path: '/',
//
// ==================
// Specify Test Files
// ==================
// Define …Run Code Online (Sandbox Code Playgroud)