6

can I run protractor tests with spec or suite name as a parameter? I'm currently running it with:

protractor myconf.js 

thanks.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
user2880391
  • 2,683
  • 7
  • 38
  • 77

1 Answers1

11

Yes, there is the specific --specs command-line argument:

$ protractor --help
Usage: protractor [options] [configFile]
configFile defaults to protractor.conf.js
The [options] object will override values from the config file.
Options:
  --help                                             Print Protractor help menu                               
  --version                                          Print Protractor version         
...
  --specs                                            Comma-separated list of files to test  

You would still need a config to be passed, but --specs would override the specs set in the configuration:

protractor myconf.js --specs=test/e2e/myspec.js

You can also use the --suite command-line argument:

protractor myconf.js --suite=smoke

where smoke matches the configured suite name:

suites: {
  smoke: 'spec/smoketests/*.js',
  full: 'spec/*.js'
},

Alternatively, if you are using jasmine2, you can make use of the "focused tests" feature by temporarily changing describe to fdescribe and/or it to fit.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • you're the greatest. I didn't think there is such option. thanks. – user2880391 Jul 13 '15 at 19:04
  • 1
    How come --suite is not mentioned when you type "protractor --help"? What else are they not telling us? – IanT8 Oct 20 '16 at 05:13
  • 1
    @IanT8 yeah, good finding, my understanding is that's because we are just setting/overriding the `suite` from the protractor config..you can override everything in the config this way from the command line. – alecxe Oct 20 '16 at 16:48