GithubHelp home page GithubHelp logo

grunt-parallel-behat's Introduction

grunt-parallel-behat Build Status

Run Behat Features in Parallel

Getting Started

This plugin requires Grunt ~0.4.0

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-parallel-behat

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-parallel-behat');

Usage Examples

Basic (using default options)

grunt.loadNpmTasks('grunt-parallel-behat');
> grunt behat

By default it will assume the behat.yml is in the same folder as the grunt file and it will run any feature files under the current directory.

Advanced usage

grunt.initConfig({
    behat: {
        src: '/path/to/features/**/*.feature',
        options: {
            config: './behat/behat.yml',
            maxProcesses: 5,
            bin: './bin/behat',
            flags: '--tags @wip',
            // Optional for junit formatted output 
            junit: {
                output_folder: 'tests/test_results/'
            }
            env: {
                MINK_EXTENSION_PARAMS: 'base_url=http://localhost:8080'
            }
        }
    }
});

License

Copyright (c) 2013 Linus Norton

Licensed under the MIT license.

grunt-parallel-behat's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

grunt-parallel-behat's Issues

Fatal error: ENOENT: no such file or directory, open 'tests/behat/test_results/basictest.xml'

When I run tests in a local VM, I get this error. It seems that this line (https://github.com/linusnorton/grunt-parallel-behat/blob/master/tasks/lib/BehatTask.js#L93) fails because the [feature].xml file is missing. This runs fine in other environments, so I'm a bit confused as to what should be creating the file in the first place.

Full stack trace:

Started: ./tests/behat/bin/behat -c ./tests/behat/behat.yml ./tests/behat/features/MyFeatures/BasicTest.feature -f junit --out tests/behat/test_results/
Fatal error: ENOENT: no such file or directory, open 'tests/behat/test_results/basictest.xml'
Error: ENOENT: no such file or directory, open 'tests/behat/test_results/basictest.xml'
  at Error (native)
  at Object.fs.openSync (fs.js:549:18)
  at Object.fs.readFileSync (fs.js:397:15)
  at ParallelExec.taskFinished (/vagrant/node_modules/grunt-parallel-behat/tasks/lib/BehatTask.js:93:31)
  at emitMany (events.js:108:13)
  at ParallelExec.emit (events.js:182:7)
  at ParallelExec.taskDone (/vagrant/node_modules/grunt-parallel-behat/tasks/lib/ParallelExec.js:56:14)
  at /vagrant/node_modules/underscore/underscore.js:593:19
  at ChildProcess.exithandler (child_process.js:207:5)
  at emitTwo (events.js:87:13)
  at ChildProcess.emit (events.js:172:7)
  at maybeClose (internal/child_process.js:862:16)
  at Socket.<anonymous> (internal/child_process.js:338:11)
  at emitOne (events.js:77:13)
  at Socket.emit (events.js:169:7)
  at Pipe._onclose (net.js:490:12)

Any ideas are appreciated. Even if it's just pointing me to where/how these xml files should be generated.

Upgrade to Grunt 1.0 and NodeJS 4.0.0 causes failure

We are encountering build failures due to the upgrade to Grunt 1.0 and Node 4.0.

Can we move the upgrade to a separate non-mainline branch?


npm WARN peerDependencies The peer dependency grunt@>=1.0.0 included from grunt-parallel-behat will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency 
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm ERR! Linux 2.6.32-573.22.1.el6.x86_64
npm ERR! argv "/opt/node-v0.10.28-linux-x64/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.4.1
npm ERR! npm  v2.14.20
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package [email protected] does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants grunt@^0.4.5
npm ERR! peerinvalid Peer [email protected] wants grunt@>=0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@>=0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@>=0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@>=1.0.0
npm ERR! peerinvalid Peer [email protected] wants grunt@^0.4.5
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@>=0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@>=0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@>=0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@>=0.4.0

Fatal error: Cannot read property '0' of undefined

I receive this error running behat tests in a Jenkins job:

Fatal error: Cannot read property '0' of undefined�
TypeError: Cannot read property '0' of undefined
    at /var/lib/jenkins/workspace/my-project/behat/node_modules/grunt-parallel-behat/tasks/lib/BehatTask.js:101:58
    at Parser.<anonymous> (/var/lib/jenkins/workspace/my-project/behat/node_modules/xml2js/lib/xml2js.js:483:18)
    at Parser.emit (events.js:95:17)
    at Object.onclosetag (/var/lib/jenkins/workspace/my-project/behat/node_modules/xml2js/lib/xml2js.js:444:26)
    at emit (/var/lib/jenkins/workspace/my-project/behat/node_modules/sax/lib/sax.js:624:35)
    at emitNode (/var/lib/jenkins/workspace/my-project/behat/node_modules/sax/lib/sax.js:629:5)
    at closeTag (/var/lib/jenkins/workspace/my-project/behat/node_modules/sax/lib/sax.js:889:7)
    at Object.write (/var/lib/jenkins/workspace/my-project/behat/node_modules/sax/lib/sax.js:1436:13)
    at Parser.exports.Parser.Parser.parseString (/var/lib/jenkins/workspace/my-project/behat/node_modules/xml2js/lib/xml2js.js:502:31)
    at Parser.parseString (/var/lib/jenkins/workspace/my-project/behat/node_modules/xml2js/lib/xml2js.js:7:59)

[sic] on the new line after the error. The referenced line is https://github.com/linusnorton/grunt-parallel-behat/blob/0.4.6/tasks/lib/BehatTask.js#L101. Specifically, the first check in that if statement: result.testsuites.testsuite["0"]

Note about the test I am running, it takes a long time, ~15-20 minutes or so. Could it be running into timeouts?

Error when adding out path

When i add an out path it throws an error: flags: '--profile=<%= envOptions.behat.profile %> --format=junit --out=./reports/behat/'

Fatal error: Cannot call method 'indexOf' of undefined

Cannot set behat parameters via flags

Hi there,
I can't figure out how to set parameters to behat. Looks like something stopped working

behat: {
            src: './features/**/*.feature',
            config: './behat.yml',
            maxProcesses: 1,
            bin: './bin/behat',
            flags: '--tags="run" -p phantomjs',
            env: {
                'BEHAT_PARAMS':'{"extensions":{"Behat\\MinkExtension":{"base_url":"http://local.google"}}}'
            }
tiko@tiko:/var/www/gridics/behat_tests$ grunt
Running "behat:src" (behat) task

Found 28 feature file(s). Running 10000 at a time.
Started: ./bin/behat -c ./behat.yml  ././features/abutting_parcels.feature
Started: ./bin/behat -c ./behat.yml  ././features/admin_views.feature
Started: ./bin/behat -c ./behat.yml  ././features/agents_offices.feature
Started: ./bin/behat -c ./behat.yml  ././features/autocomplete.feature
Started: ./bin/behat -c ./behat.yml  ././features/breadcrumbs.feature
Started: ./bin/behat -c ./behat.yml  ././features/chart_dropdowns.feature

Multiple @javascript tests break zombie.js

I've been writing tests in Behat for my Drupal site, and I've based my setup after the example/ folder from grunt-drupal-tasks, so I'm running tests with Goutte and Zombie.js. However, as soon as I had a second Feature tagged @javascript, it throws this error:

      Server process has been terminated: (8) [
      events.js:72
              throw er; // Unhandled 'error' event
                    ^
      Error: listen EADDRINUSE
          at errnoException (net.js:904:11)
          at Server._listen2 (net.js:1042:14)
          at listen (net.js:1064:10)
          at net.js:1146:9
          at Object._onImmediate (node_modules/zombie/lib/zombie/dns_mask.js:69:16)
          at processImmediate [as _immediateCallback] (timers.js:345:15)
      ] (RuntimeException)

I thought maybe it was an issue in Mink, and it kind of is, because of the way they call zombie.js, but they said Mink accepts setting the port in the environment (see minkphp/MinkZombieDriver#126). So, the thing to do appears to be using a different port for each test process that gets spawned. Considering how prevalent JavaScript is, I think it would be prudent to make this the default behavior.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.