How to run a single specific test case when using protractor

后端 未结 4 906
误落风尘
误落风尘 2020-12-10 00:54

I am using protractor for angular js testing in my app and have around 19 test cases at the moment, of which one of them is failing

describe(\'Login page\',          


        
相关标签:
4条回答
  • 2020-12-10 01:16

    You can use --grep.

    protractor conf.js --grep='name of your test case'

    0 讨论(0)
  • 2020-12-10 01:23

    Jasmine added fit and fdescribe in 2.1 for running single tests or describe blocks.

    http://pivotallabs.com/new-key-features-jasmine-2-1/

    This feature almost made it in the 2.0 release. Now enough of this functionality is present to support fit and fdescribe for focused spec and suite running.

    from 2.1 git lib/jasmine-core/jasmine.js

    var jasmineInterface = {
    describe: function(description, specDefinitions) {
      return env.describe(description, specDefinitions);
    },
    
    xdescribe: function(description, specDefinitions) {
      return env.xdescribe(description, specDefinitions);
    },
    
    fdescribe: function(description, specDefinitions) {
      return env.fdescribe(description, specDefinitions);
    },
    
    it: function() {
      return env.it.apply(env, arguments);
    },
    
    xit: function() {
      return env.xit.apply(env, arguments);
    },
    
    fit: function() {
      return env.fit.apply(env, arguments);
    },
    
    0 讨论(0)
  • 2020-12-10 01:26

    The most recent version (at least) of Protractor supports the usual Jasmine way of doing that: rename a describe() function to ddescribe(), and only the tests inside it will run. Or rename an it() function to iit(), and only this test will run.

    0 讨论(0)
  • 2020-12-10 01:30

    Perhaps you should separate the tests into different suites. Then you can just run: protractor test/protractor-conf.js --suite example

    0 讨论(0)
提交回复
热议问题