使用Grunt任务运行自动化测试

时间:2015-01-29 10:24:31

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

我在java中使用Selenium Webdriver进行测试自动化项目。我想使用Grunt任务(我是Grunt的新手)来开始测试。我使用grunt-selenium-webdriver插件(Git here: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.

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

1 个答案:

答案 0 :(得分:0)

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