【问题标题】:Running automation test with Grunt task使用 Grunt 任务运行自动化测试
【发布时间】:2015-01-29 10:24:31
【问题描述】:

我有一个在 java 中使用 Selenium Webdriver 的测试自动化项目。我想使用 Grunt 任务(我是 Grunt 新手)开始驱动测试。我使用 grunt-selenium-webdriver 插件(Git 这里:https://github.com/levexis/grunt-selenium-webdriver

我安装了这个插件,并在 Gruntfile.js 中添加了这部分 webdriver

grunt.initConfig({
    webdriver: {
        options: {
            desiredCapabilities: {
                browserName: 'chrome'
            }
        },
        login: {
            tests: ['Test/Automation/NextGenWebViewerUI/src/test/java/com/autodesk/infraworks/webviewer/tests/*.java'],
        },

    },
});

grunt.loadNpmTasks('grunt-selenium-webdriver');

然后,我用这个命令运行这个任务

grunt webdriver

但我收到了警告:

>> Grunt script called with:
>> Tasks: webdriver
>> Options:
Warning: Task "webdriver" not found. Use --force to continue.

任何人都可以帮助我或有使用示例吗?非常感激!

【问题讨论】:

  • 您缺少一些配置。看看这个例子 - gruntjs.com/sample-gruntfile.
  • @AleksandrM:谢谢,我拿了这个例子,所有的 javaScript 插件,我使用 Java,所以它似乎不能这样工作。我更新了我的问题。有什么想法吗?
  • Java?那你为什么要使用 grunt 呢?根据grunt-selenium-webdriver 的文档,其中有 3 个任务(selenium_start、selenium_stop 和 selenium_phantom_hub)。

标签: java node.js selenium-webdriver automation gruntjs


【解决方案1】:

我用 grunt-shell 解决了这个问题,在 grunt-shell 中执行 maven 命令。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-23
    • 1970-01-01
    • 2014-02-17
    • 1970-01-01
    相关资源
    最近更新 更多