如何从Grunt任务多次启动量角器实例

时间:2015-07-08 06:56:39

标签: gruntjs protractor

我正试图从像这样的grunt任务多次启动量角器

grunt.registerTask('makeapps', 'Create Apps', function(count) {

      console.log('value of count is' + count);
      var done=this.async();

      for(var i=1 ;i <= count; i++)
      {

              grunt.initConfig({

              protractor: {
                options: {
                  configFile: "./createAppConf.js", // Default config file which includes protractor tests and other dependencies such as HTML protractor screenshot reporter
                  keepAlive: true, // If false, the grunt process stops when the test fails.
                  noColor: false, // If true, protractor will not use colors in its output.
                  args: {
                    // Arguments passed to the command
                  }

                },
                your_target: {   // Grunt requires at least one target to run so you can simply put 'all: {}' here too.
                  options: {
                    configFile: "createAppConf.js", // // Default config file which includes protractor tests and other dependencies such as HTML protractor screenshot reporter
                    args: {} // Target-specific arguments
                  }
                },
              },
             })

              grunt.loadNpmTasks('grunt-protractor-runner');
       }  

       done();

});

我像这样运行任务

  

grunt makeapps:3量角器

我只能启动量角器和测试一次。我无法多次启动它。谁能告诉我我做错了什么?

1 个答案:

答案 0 :(得分:0)

您的解决方案将运行您具有定义的量角器任务的功能。 Grunt更具说明性,它首先收集任务定义,然后你可以触发它们。

如何使用https://github.com/sindresorhus/grunt-concurrenthttps://github.com/iammerrick/grunt-parallel