- Protractor - Discussion
- Protractor - Useful Resources
- Protractor - Quick Guide
- Protractor - Style Guide for Protractor
- Protractor - Debugging
- Protractor - Objects
- Protractor - Core APIs(Contd..)
- Protractor - Core APIs
- Protractor - Writing the First Test
- Protractor and Selenium Server
- Protractor - Getting Started
- Concepts of Javascript Testing
- Protractor - Introduction
- Protractor - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Protractor - Debugging
既然我们在前几章中看到了所有起诉人的概念,那么我们就能够理解本章中详细列出的欺骗概念。
Introduction
终端到终端(e2e)测试很难进行消减,因为它们取决于这一应用的整个生态系统。 我们已经看到,它们取决于各种行动,特别是我们可以说,它们取决于像原木这样的先前行动,有时取决于许可。 分解电子2e测试的另一个困难是依赖网络驱动器,因为它与不同的操作系统和浏览器不同。 最后,分解电子2e测试也会产生长的错误信息,使得难以区分与浏览器有关的问题和测试过程错误。
Types of Failure
测试套失败的原因可能多种多样,下面是一些众所周知的失败类型——
WebDriver failure
当指挥无法完成时,网络司机将犯错误。 例如,浏览器不能获得确定的地址,或者没有发现某个要素。
WebDriver unexpected failure
如果不更新网络司机主管,就会出现意外的浏览器和与本组织有关的故障。
Protractor failure for Angular
当Protractor在图书馆发现安乐器时,安乐器的失败发生。
Protractor Angular2 failure
在这种失败的情况下,如果组合中没有使用AllAngular2AppRoots参数,则Protractor将失败。 之所以出现这种情况,是因为如果没有这一点,测试过程将研究一个单一的基本要素,同时期望这一进程中有一个以上要素。
Protractor failure for timeout
这种失败发生在试验规格击中 lo或长期池时,未能及时归还数据。
Expectation failure
最常见的测试失败之一显示正常的期望失败。
Why debugging is important in Protractor?
假设是,如果你有书面测试案例,而且没有成功,那么了解如何减少这些测试案例非常重要,因为很难找到发生错误的确切地点。 在与Protractor合作时,你将在指挥线的红色字体上发现一些长期错误。
Pausing and Debugging the Test
The ways to debug in Protractor are here &miuns;
Pause Method
采用停用法,在导师中减少测试病例,是最容易的方法之一。 我们可以在我们想要放弃我们的试验规范和计划的地方打下以下指挥;
browser.pause();
当运行守则击中上述指挥部时,它将暂停运行方案。 之后,我们可以根据我们的偏好给予以下指挥——
Type C for Moving Forward
每当指挥部门用尽时,我们必须把C类推向前进。 如果你不使用C类,则该试验不会适用全法典,而且由于Jasmine的错误,它将失败。
Type repl for entering interactive mode
互动模式的好处是,我们可以把网络司机指挥员派往我们的浏览器。 如果我们想要进入互动模式,那么repl。
Type Ctrl-C for exiting and continuing the tests
为了摆脱暂停状态,并继续从停止试验的地方进行试验,我们需要对Ctrl-C进行分类。
Example
在这个例子中,我们有以下具体文件:example_debug.js, protractor 试图确定一个包含by. binding(``````````'')的元素,但URL(
。 网页没有特定定位器的元素。describe( Suite for protractor debugger ,function(){ it( Faipng spec ,function(){ browser.get("http://angularjs.org"); element(by.model( yourName )).sendKeys( Vijay ); //Element doesn t exist var welcomeText = element(by.binding( mmmm )).getText(); expect( Hello +welcomeText+ ! ).toEqual( Hello Ram! ) }); });
现在,为了实施上述测试,我们需要在上述规格档案中增加浏览器。 它将研究如下:
describe( Suite for protractor debugger ,function(){ it( Faipng spec ,function(){ browser.get("http://angularjs.org"); browser.pause(); element(by.model( yourName )).sendKeys( Vijay ); //Element doesn t exist var welcomeText = element(by.binding( mmmm )).getText(); expect( Hello +welcomeText+ ! ).toEqual( Hello Ram! ) }); });
但在执行之前,我们也需要在配置档案中作一些改动。 我们正在前一章对先前使用的配置文件进行如下改动:example_configuration.js。
// An example configuration file. exports.config = { directConnect: true, // Capabipties to be passed to the webdriver instance. capabipties: { browserName : chrome }, // Framework to use. Jasmine is recommended. framework: jasmine , // Spec patterns are relative to the current working directory when // protractor is called. specs: [ example_debug.js ], allScriptsTimeout: 999999, jasmineNodeOpts: { defaultTimeoutInterval: 999999 }, onPrepare: function () { browser.manage().window().maximize(); browser.manage().timeouts().imppcitlyWait(5000); } };
现由以下指挥部门领导:
protractor example_configuration.js
夸张将从上述指挥开始。
Debugger Method
采用停用法,在轨迹中减少试射病例,是一种先进的办法。 我们可以在我们想要打破我们的试验守则的地方打下以下指挥——
browser.debugger();
它利用“ no”来推翻测试法。 为了管理上述指挥,我们必须在从试验项目地点开始的单独指挥中进行以下指挥:
protractor debug protractor.conf.js
在这种方法中,我们也需要在终点站对C进行分类,以继续试验守则。 但与停用方法相反,这种方法只需要一次分类。
Example
举例来说,我们正在使用上文使用的相同规格文件“example_debug.js。 唯一的区别是,我们不必使用browser.pause()browser.debugger()。 我们想要打破试验守则的地方。 它将研究如下:
describe( Suite for protractor debugger ,function(){ it( Faipng spec ,function(){ browser.get("http://angularjs.org"); browser.debugger(); element(by.model( yourName )).sendKeys( Vijay ); //Element doesn t exist var welcomeText = element(by.binding( mmmm )).getText(); expect( Hello +welcomeText+ ! ).toEqual( Hello Ram! ) }); });
我们正在使用上述格式文件example_configuration.js。
如今,通过下调指挥线选择,进行了驾驶员测试。
protractor debug example_configuration.js
夸张将从上述指挥开始。
Advertisements