These are chat archives for mojotech/pioneer

12th
May 2015
Steven Langbroek
@StevenLangbroek
May 12 2015 08:52
hey guys
i was wondering if anybody could give me some guidance regarding (a) running before and after commands (for starting and stopping a mock-server) and (b) for outputting test-results to jenkins (junit xml)
would be greatly appreciated :)
(much karma)
Tom Hicks
@tomhicks
May 12 2015 09:05
For junit xml use json reporter and then use cucumber-junit from npm
Steven Langbroek
@StevenLangbroek
May 12 2015 09:10
@tomhicks thanks, is there some documentation in place for using the json reporter? couldn't find anything...
Tom Hicks
@tomhicks
May 12 2015 09:11
Formatter: json in pioneer confit I think
Format: json sorry
Steven Langbroek
@StevenLangbroek
May 12 2015 09:12
ah amazing
i'll make PR later today to add it to docs
Steven Langbroek
@StevenLangbroek
May 12 2015 12:01
how do you guys run a mock-server? i was thinking just use nodemon + expressjs and stop & start with a package.json "script"
so:
{ "scripts": { "test": "nodemon start mock.js && ./node_modules/pioneer/bin/pioneer && nodemon stop mock.js" } }
Sam Saccone
@samccone
May 12 2015 13:25
hola
how is everyone
i have some exciting plans for pioneer and such
Steven Langbroek
@StevenLangbroek
May 12 2015 13:25
yay!
Sam Saccone
@samccone
May 12 2015 13:25
going to extract the widgets to be standalone
pioneer will have them as a dependency
so pioneer can really just be focused on the runner and such
:)
:clap:
Tom Hicks
@tomhicks
May 12 2015 13:26
Good!
Steven Langbroek
@StevenLangbroek
May 12 2015 13:26
great stuff :)
obviously a great start so far
Steven Langbroek
@StevenLangbroek
May 12 2015 13:26
have you taken a look at the way karma treats plugins / environments?
Sam Saccone
@samccone
May 12 2015 13:26
hahaha
I have not...
Steven Langbroek
@StevenLangbroek
May 12 2015 13:26
popping in saucelabs is installing a plugin and pointing karma to it
Sam Saccone
@samccone
May 12 2015 13:26
oh neat
also, config as a .js file instead of .json allows for programmatic config setup, which i think is nice
Sam Saccone
@samccone
May 12 2015 13:30
yeah that is nice
Tom Hicks
@tomhicks
May 12 2015 13:31
Yeah webpack is big on that too
Steven Langbroek
@StevenLangbroek
May 12 2015 13:31
think it's a nice approach
the threshold for starting actual testing with pioneerjs within the rest of our infrastructure was (/is) quite high
there's no real good alternatives, so if you manage to ease up the onboarding process for new devs (through maybe more fleshed out docs and / or plugin infra), you've got something amazing right here
(no alternatives that i'm aware of anyway)
Sam Saccone
@samccone
May 12 2015 13:33
yeah...
:(
can you expand
on what was hard about the setup?
Steven Langbroek
@StevenLangbroek
May 12 2015 13:34
well, figuring out how to get running on saucelabs, reporting to jenkins, starting + stopping a mock-server before & after test-runs...
still don't know that last bit
so my test-run would look like this ideally:
  • start express-js based mock server
  • run tests
  • convert output to junit (apparently using cucumber-junit i learned here from @tomhicks)
  • stop mock server
Steven Langbroek
@StevenLangbroek
May 12 2015 13:41
having something like this as config feels natural to me:
import mocks from './mocks';
import cucumber from 'cucumber-junit';
import fs from 'fs';

export default function(pioneer){
  return pioneer.config({
    format: 'json',
    output: './spec/results/integration.xml',
    before(){
      return mocks.start();
    },

    after(results){
      fs.writeFileSync(this.output, cucumber(results));
      mocks.stop();
    }
  });
}
Sam Saccone
@samccone
May 12 2015 13:42
sure
i agree
Steven Langbroek
@StevenLangbroek
May 12 2015 13:43
whoops, missed cucumber there
Steven Langbroek
@StevenLangbroek
May 12 2015 14:08
or, ideally:
import mocks from './mocks';

export default function(pioneer){
  return pioneer.config({
    plugins: ['saucelabs', 'junit'],
    jUnit: {
      path: './spec/results/integration.xml'
    },
    sauceLabs: {
      testName: 'Product Functional Tests',
      username: 'somepoorbastard',
      accessKey: 'yeah-whatever-your-key-here',
      browsers: {
        sl_ios_safari: {
          base: 'SauceLabs',
          browserName: 'iphone',
          platform: 'OS X 10.9',
          version: '7.1'
        },
        sl_android_42: {
          base: 'SauceLabs',
          platform: 'Linux',
          browserName: 'android',
          deviceName: 'LG Nexus 4 Emulator'
        },
        sl_android_40: {
          base: 'SauceLabs',
          platform: 'Linux',
          version: '4.0',
          browserName: 'android',
          deviceName: 'Motorola Atrix HD Emulator'
        }
      }
    },
    before(){
      return mocks.start();
    },

    after(results){
      mocks.stop();
    }
  });
}
Sam Saccone
@samccone
May 12 2015 14:09
grunt esk
:*(
heh
Steven Langbroek
@StevenLangbroek
May 12 2015 14:09
yeah
that's pretty much copied over from my karma config
not sure what happened to the syntax there...
Steven Langbroek
@StevenLangbroek
May 12 2015 15:05
want me to open an issue about this?
Sam Saccone
@samccone
May 12 2015 15:05
hmm sure
Steven Langbroek
@StevenLangbroek
May 12 2015 15:05
1 for plugin architecture, 1 for .js config?
Sam Saccone
@samccone
May 12 2015 15:05
yeah
Steven Langbroek
@StevenLangbroek
May 12 2015 15:09
#324
#325
Sam Saccone
@samccone
May 12 2015 15:15
:+1: thanks
Steven Langbroek
@StevenLangbroek
May 12 2015 15:16
the actual implementation is probably a bit over my head, but ping me on twitter if you think i can help with something
i'm not on gitter often
Sam Saccone
@samccone
May 12 2015 15:16
np
thanks!
Steven Langbroek
@StevenLangbroek
May 12 2015 15:16
no problem at all, you too
btw, any guidance re: before & after scripts you can give for current version?
Sam Saccone
@samccone
May 12 2015 15:17
as to...
beforeAll
afterAll
Steven Langbroek
@StevenLangbroek
May 12 2015 15:17
where?
Sam Saccone
@samccone
May 12 2015 15:17
you can return promises
anywhere
:)
Steven Langbroek
@StevenLangbroek
May 12 2015 15:17
really?
Sam Saccone
@samccone
May 12 2015 15:17
this.beforeAll(function(){})
yap
:)
Steven Langbroek
@StevenLangbroek
May 12 2015 15:17
huh
:)
Steven Langbroek
@StevenLangbroek
May 12 2015 15:19
alright
i'll investigate that
feels weird to do that in step files...
Sam Saccone
@samccone
May 12 2015 15:19
well
typically I have a file
like setup.js
Steven Langbroek
@StevenLangbroek
May 12 2015 15:21
how do you load that?
loads anything in steps folder?
Sam Saccone
@samccone
May 12 2015 15:21
that is one way
you can also use pioneer.json
to require them
Steven Langbroek
@StevenLangbroek
May 12 2015 15:21
eh?
Steven Langbroek
@StevenLangbroek
May 12 2015 15:24
doh!
yup, i think it's about time i call it a day
Sam Saccone
@samccone
May 12 2015 15:26
:)