【问题标题】:Error when trying to run a Selenium test with PHPUnit尝试使用 PHPUnit 运行 Selenium 测试时出错
【发布时间】:2016-03-23 17:42:21
【问题描述】:

我想用 PHPUnit 运行 Selenium 测试,但出现了这个错误,我不知道它试图告诉我什么:

$ phpunit ApplicationTest/Controller/StationTest.php

致命错误:未捕获的异常 'Zend\Config\Exception\RuntimeException' 与消息 'Filename "" 找不到相对于工作目录' C:\Users*****\Documents*****\******\vendor\zendframework\zendframework\library\Zend\Config\Factory.php:73

知道为什么会这样吗?

【问题讨论】:

  • It is in error reposne 'Filename "" cannot be found relative to the working directory' in 表示您在代码中的某处引用了不存在的文件“文件名”
  • 正如@dafyk 已经指出的那样,这可能是原因,但如果您想要更多有用的回复,您需要分享您的 StationTest 代码

标签: php selenium phpunit


【解决方案1】:

如果使用不是有效文件路径的参数调用它,则从Zend\Config\Factory::fromFile() 引发异常。在您的情况下,参数为空(''

看起来您有一个 Zend Framework 应用程序需要一些未提供的配置文件。

要调试此错误,请查看异常堆栈跟踪以了解调用此代码的位置。获取堆栈跟踪的一种方法是将测试用例包装在 try...catch 块中,如下所示:

function testSomething()
{
    try {
        ...
    } catch (Exception $e) {
        echo $e->getTraceAsString(); // alternatively, write to log file
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-01
    • 2020-11-03
    • 1970-01-01
    • 2017-08-05
    • 2014-05-08
    • 1970-01-01
    • 2013-06-13
    • 1970-01-01
    相关资源
    最近更新 更多