https://hjrlive.wordpress.com/2014/02/15/test-post/
There is a new technology called Feature files which is used to build scenarios about automation testing. Cucumber is a method of feature files. So I have to install cucumber on my computer for further learning. Cucumber is a method of BDD.
Behaviour Driven Development a.k.a BDD is a software development approach being followed by most of the projects across the BBC. One of the key benefits of BDD is improved communication between technical and non-technical people.
BDD has drastically changed the roles of the members of the agile team. It encourages a collaborative way of working between product owners, business analysts, project managers, developers and test engineers. Please read my post on Eurostar blogs explaining how the tester’s role has changed in BDD.
We use Cucumber as a BDD tool to automate acceptance criteria. Feature files are written in the domain specific language ‘Gherkin’.
Quick Introduction to Gherkin
Gherkin is the domain specific language used in BDD for writing software requirements in the form of feature files. Feature files are written in the Given-When-Then [GWT] format. Feature files usually consist of Feature Title, Narrative, Background, Scenarios, Steps, Tags, Example Tables and Doc Strings.Features
Feature is the user story template. A feature has two components; a feature title and a narrative.The feature title is a short description of the story we are talking about. It should be ideally be a sentence that describes the scope of the story. An example of the feature title for the brand page of the BBC Television programmes looks like this:
Feature : BBC Television brand page
A narrative describes the story in detail with role and benefit. There are two most commonly used format of the narrative.
Prerequisites
If you’re running a completely vanilla system you’ll need
to install a Java Development Kit (JDK). You can check if you have a JDK
via control panel-> programs and features.
The screenshot below shows part of the programs and
features window when the JDK is installed (Java components underlined,
ignore the other items in the list) :
However, if you don’t have it, install it via http://www.oracle.com/technetwork/java/javase/downloads/index.html and install the latest JDK for your OS. If you’re unsure whether you’re running 32 or 64 bit windows see : http://windows.microsoft.com/en-GB/windows7/find-out-32-or-64-bit
If you don’t have Firefox on your system, that will need to
be installed along with Selenium IDE. Selenium IDE isn’t required to
run Webdriver, but it can be very useful especially when learning the
Webdriver API.This tutorial uses Selenium IDE later on.
If Firefox isn’t present then follow these instructions :
-
Download firefox and open it. Note that sometimes Selenium and Firefox v.latest do not work together. If you find this is the case then use a known good combination (todo : insert a good combo here)
-
In Firefox go to http://docs.seleniumhq.org/download/ and click on the Selenium IDE latest version link. This should kick off the installation of the XPI file. Click allow then install now to install all of the components of IDE. When all of the IDE constituent add ons are installed, Firefox will need to be restarted.
-
To check that Selenium IDE has installed properly, hit Alt to bring up the menus in Firefox, then select Tools-> Web Developer, then Selenium IDE should be there as an option at the bottom.
Download the Eclipse IDE :
-
Go to http://www.eclipse.org/downloads/ , select the ‘Eclipse IDE for Java Developers’ for your version of windows (32 or 64 bit) . I’m unsure what the difference is between that and the EE version, but this version appears to be twice as popular!
- Note that there is no installation required. Eclipse comes in the form of a Zip file. Simply open the Zip file and copy the Eclipse directory to a suitable location, such as C:/
- Navigate to the Eclipse directory, right click and select copy on Eclipse.exe and go to your desktop. Paste the item as a shortcut.
- Double click on this desktop icon and Eclipse should open!
Setting up Eclipse
Open Eclipse and set the directory of your choice as your workspace.
Close the welcome screen
Then set the encoding to UTF-8 : Go to
Window->preferences->general->workspace. Set text file encoding
by selecting the other radio button and selecting UTF-8, hit apply.
Failure to set the encoding means all sorts of problems with £ signs and such
Set the compiler preferences :
-
Go to Window->Preferences->Java->Compiler, change Compiler compliance level to 1.8 (or the highest level available) if it is not set already.
Install the Cucumber Plugin into Eclipse :
This plug in enables certain features in Eclipse – e.g. a
nice green cucumber icon for feature files. Also when you double click
on a feature file then it will open the feature in Eclipse rather than
opening notepad.
-
In Eclipse, go to help->install new software
-
Paste the URL : http://cucumber.github.com/cucumber-eclipse/update-site into the ‘Work with’ text box. Press enter once you have pasted the link in. Note that if running behind a proxy server and you get a ‘HTTP Proxy Authentication Required’ error you may need to contact a system administrator to set up your proxy server settings. See http://stackoverflow.com/questions/1940984/how-to-specify-eclipse-proxy-authentication-credentials
-
Click the Cucumber Eclipse Plugin checkbox (select the newer version if there is more than one available), hit next, next, accept the licence agreement and finish
When Eclipse has restarted, create a new project :
-
Go to file-> new-> Java project
-
Give the project the required name e.g. TestProject and accept the defaults. Hit finish.

No comments :
Post a Comment