为什么CodeceptJS不执行测试中的步骤?为什么我看不到正在执行的测试?

时间:2017-02-02 09:21:38

标签: javascript automated-tests codeceptjs

我最近遇到过CodeceptJS,我想过尝试一下。我正在关注CodeceptJS's QuickStart page上的教程,但现在我面临两个问题:

  1. 测试似乎只执行第一步
  2. 我没有看到测试的执行情况
  3. 以下是我运行codeceptjs init的时候:

    enter image description here

    运行codeceptjs run --steps时的以下内容:

    enter image description here

    以下是我的测试(Test101_test.js):

    
    
    Feature('Google search');
    
    Scenario('test something', (I) => {
        I.amOnPage('/');
        I.fillField('q', 'Codeception');
        I.see('YAY');
    });
    
    
    

    从selenium服务器登录:

      

    17:29:38.490 INFO - 执行:[新会话:能力   [{rotating = true,locationContextEnabled = true,   loggingPrefs=org.openqa.selenium.logging.LoggingPreferences@35f1c325,   browserName = firefox,javascriptEnabled = true,handlesAlerts = true,   requestOrigins = {name = webdriverio,version = 4.6.2,   url = http://webdriver.io}}]])17:29:38.496信息 - 创建一个新的   功能会话[{rotating = true,   locationContextEnabled = TRUE,   loggingPrefs=org.openqa.selenium.logging.LoggingPreferences@35f1c325,   browserName = firefox,javascriptEnabled = true,handlesAlerts = true,   requestOrigins = {name = webdriverio,version = 4.6.2,   url = http://webdriver.io}}] 17:29:38.871警告 - 抛出异常   java.util.concurrent.ExecutionException:   org.openqa.selenium.WebDriverException:   java.lang.reflect.InvocationTargetException构建信息:版本:   ' 3.0.1',修订版:' 1969d75',时间:' 2016-10-18 09:48:19 -0700'系统   info:host:' My-Mac-mini.local',ip:' 172.20.4.68',os.name:' Mac OS   X',os.arch:' x86_64',os.version:' 10.12.1',java.version:' 1.8.0_91'   驱动程序信息:driver.version:未知   java.util.concurrent.FutureTask.report(FutureTask.java:122)at   java.util.concurrent.FutureTask.get(FutureTask.java:192)at   org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183)     在   org.openqa.selenium.remote.server.DefaultSession。(DefaultSession.java:119)     在   org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95)     在   org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:131)     在   org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:59)     在   org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:36)     在   org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111)     在   org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:189)     在   org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:222)     在   org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:184)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:707)at   org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:150)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:790)at   org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:808)     在   org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:587)     在   org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)     在   org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:515)     在   org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1061)     在   org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)     在   org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)     在org.seleniumhq.jetty9.server.Server.handle(Server.java:499)at   org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:310)     在   org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:257)     在   org.seleniumhq.jetty9.io.AbstractConnection $ 2.run(AbstractConnection.java:540)     在   org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)     在   org.seleniumhq.jetty9.util.thread.QueuedThreadPool $ 3.run(QueuedThreadPool.java:555)     在java.lang.Thread.run(Thread.java:745)引起:   org.openqa.selenium.WebDriverException:   java.lang.reflect.InvocationTargetException构建信息:版本:   ' 3.0.1',修订版:' 1969d75',时间:' 2016-10-18 09:48:19 -0700'系统   info:host:' My-Mac-mini.local',ip:' 172.20.4.68',os.name:' Mac OS   X',os.arch:' x86_64',os.version:' 10.12.1',java.version:' 1.8.0_91'   驱动程序信息:driver.version:未知   org.openqa.selenium.remote.server.FirefoxDriverProvider.callConstructor(FirefoxDriverProvider.java:96)     在   org.openqa.selenium.remote.server.FirefoxDriverProvider.newInstance(FirefoxDriverProvider.java:64)     在   org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)     在   org.openqa.selenium.remote.server.DefaultSession $ BrowserCreator.call(DefaultSession.java:222)     在   org.openqa.selenium.remote.server.DefaultSession $ BrowserCreator.call(DefaultSession.java:209)     在java.util.concurrent.FutureTask.run(FutureTask.java:266)at   org.openqa.selenium.remote.server.DefaultSession $ 1.run(DefaultSession.java:176)     在   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     在   java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:617)     ... 1更多引起:java.lang.reflect.InvocationTargetException at   sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)     在   sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)     在   sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)     在   org.openqa.selenium.remote.server.FirefoxDriverProvider.callConstructor(FirefoxDriverProvider.java:86)     ... 9更多引起:java.lang.IllegalStateException:路径   必须由webdriver.gecko.driver系统设置驱动程序可执行文件   属性;有关更多信息,请参阅   https://github.com/mozilla/geckodriver。最新版本可以   从https://github.com/mozilla/geckodriver/releases下载   com.google.common.base.Preconditions.checkState(Preconditions.java:199)     在   org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109)     在   org.openqa.selenium.firefox.GeckoDriverService.access $ 000(GeckoDriverService.java:37)     在   org.openqa.selenium.firefox.GeckoDriverService $ Builder.findDefaultExecutable(GeckoDriverService.java:95)     在   org.openqa.selenium.remote.service.DriverService $ Builder.build(DriverService.java:296)     在   org.openqa.selenium.firefox.FirefoxDriver.createCommandExecutor(FirefoxDriver.java:277)     在   org.openqa.selenium.firefox.FirefoxDriver。(FirefoxDriver.java:247)     在   org.openqa.selenium.firefox.FirefoxDriver。(FirefoxDriver.java:242)     在   org.openqa.selenium.firefox.FirefoxDriver。(FirefoxDriver.java:135)     ... 14更多17:29:38.875警告 - 例外:司机的路径   必须由webdriver.gecko.driver系统属性设置可执行文件;   有关更多信息,请参阅https://github.com/mozilla/geckodriver。该   最新版本可以从中下载   https://github.com/mozilla/geckodriver/releases

    有人可以帮助我找到我可能做错的事吗?

1 个答案:

答案 0 :(得分:2)

我刚刚遇到了EXACT SAME问题,我不得不键入" Selenium-standalone install"然后" selenium-standalone start"在我的命令提示符下。然后我打开另一个命令提示符并键入" codeceptjs run --steps"而这次测试都运行正常,而不只是运行第一个,就像发生在你身上一样。我希望这有帮助,我发现这个问题非常令人沮丧!