Home > Automation Testing > Simple protractor script

Simple protractor script

Code for sample protractor script: In protractor there are two basic files to execute any automation script. Those are configuration file and specification file. Configuration file contains all configuration related code. And specification file contains test scripts. Configuration file is one for the project and we can have any number specification files in single project.

Basic Configuration file: Create configuration file with name “conf.js” and add below code in it.

In specs we should mention specification file names. In multiCapabilities we need to mention browser names.

Specification file:

Specification file is test script file where we can write test case scripts.

Create specification file with name “Spec1.js”. It should contain “describe” and “it” blocks as shown below.

In “describe” we can mention test case description. In “it” block we can have test step description. In simple words “describe” is test case definition and “it” block is test step definition. Inside “it” block we need to have code for test steps.

Steps to Execute scripts:

  1. Open command prompt and make selenium server up and running using the command “webdriver-manager start”
  2. To execute the scripts open command prompt and navigate to project location
  3. Execute the command “protractor conf.js”
This Article is TAGGED in . BOOKMARK THE permalink.

Avatar photo
Amit Bharamasali
Automation Software Test Engineer. Skills: Manual Testing, Selenium, Java, Protractor, JavaScript, Katalon Studio, Groovy, Appium, Sahi, Sahi Script and UI/UX testing.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">