Wednesday, August 24, 2016

Getting started with Protractor

Getting started with Protractor



Test Suite
A test suite begins with a call to the global Jasmine function ‘describe’ with two parameters: a string and a function.  The string is a name or title for a spec suite – usually what is being tested. The function is a block of code that implements the suite.

Test Spec
Specs are defined by calling the global Jasmine function ‘it’ with two parameters: a string and a function.  The string is the title of the spec and the function is the spec, or test. A spec contains one or more expectations that test the state of the code.
Variables declared inside a ‘describe’ are available to any ‘it’ block inside the suite.

Matchers
Each matcher implements a Boolean comparison between the actual value and expected value. It reports to Jasmine if the expectation is true or false. Ex: toBeDefined, toHaveBeenCalled, toEqual, toBeGreaterThan, toBeTruthy etc..,

Expectations                                                                                                                                                                          
Global Jasmine function ‘expect’ is used to define how we are expecting the testing target to behave. It takes one parameter, the actual value. It makes use of Matcher function, which takes the expected value. Matcher implements a Boolean comparison between the actual value and the expected value. 

No comments: