Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
630 views
in Technique[技术] by (71.8m points)

angularjs - How to run a single specific test case when using protractor

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', function() {

beforeEach(function() {
  browser.ignoreSynchronization = true;
  ptor = protractor.getInstance();
});

it('should contain navigation items', function(){
  //test case code here
});

it('should login the user successfully', function(){ 
  //test case code here
})
});

Currently, I run all the test cases. But, how can I run just one test case to debug an issue for example one which is described as "Login page should login the user successfully"?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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);
},

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...