by admin | Aug 28, 2016 | 2016, Fixed |
There are various frameworks available for Behavior-Driven Development (BDD). As an automation testing services company, we have used Cucumber, Behave, and Specflow for test automation projects.
However, we have found and listed 25 BDD frameworks
which are popular among experts.
Cucumber
Cucumber is a software tool that computer programmers use for testing other software. It runs automated acceptance tests written in a behavior-driven development (BDD) style. Cucumber is written in the Ruby programming language. Cucumber projects are available for other platforms beyond Ruby.
Link: https://cucumber.io/
Serenity BDD
Serenity BDD helps you write better, more effective automated acceptance tests, and use these acceptance tests to produce world-class test reports and living documentation
Link: Serenity BDD
SpecFlow
SpecFlow acceptance tests follow the BDD paradigm: define specifications using examples understandable to business users as well as developers and testers. SpecFlow integrates with Visual Studio, but can be also used from the command line.
Link: http://www.specflow.org/
Jasmine
Jasmine is a behavior-driven development framework for testing JavaScript code. It does not depend on any other JavaScript frameworks. It does not require a DOM. And it has a clean, obvious syntax so that you can easily write tests.
Link: http://jasmine.github.io/2.0/introduction.html
GivWenZen
GivWenZen allows a user to use the BDD Given When Then vocabulary and plain text sentences to help a team get the words right and create a ubiquitous language to describe and test a business domain.
Link: https://github.com/weswilliams/GivWenZen
easyb
easyb is a behavior driven development framework for the Java platform. By using a specification based Domain Specific Language, easyb aims to enable executable, yet readable documentation.
Link: http://easyb.org/
Concordion
Concordion is an open-source tool for automating Specification by Example. It’s used by product teams all over the world to help them deliver great software.
Link: http://concordion.org/
cola-tests
COLA Tests are different from all other BDD framework as it allows for developers to keep using any JUnit Runner without having to do any complex configuration or setup.
Link: https://github.com/bmsantos/cola-tests
Behat
Behat is an open source Behavior Driven Development framework for PHP 5.3+. What’s behavior driven development, you ask? It’s a way to develop software through a constant communication with stakeholders in form of examples; examples of how this software should help them, and you, to achieve your goals.
Link: http://docs.behat.org/en/v3.0/
Squish
Squish’s support for BDD is unique because it tightly combines and integrates the BDD approach and GUI test automation.
Link: https://www.froglogic.com/squish/gui-testing/features/index.php?id=bdd.html
Jdave
JDave is a BDD framework for Java. It is inspired by rspec and integrates JMock 2 as mocking framework and Hamcrest as matching library. It uses JUnit adapter to launch JDave specifications.
Link: https://github.com/jdave/Jdave
behave
behave is behaviour-driven development and uses tests written in a natural language style, backed up by Python code.
Link: https://pypi.org/project/behave/
Lettuce
Lettuce is a very simple BDD tool based on the Cucumber, which currently has many more features than Lettuce.
Lettuce aims the most common tasks on BDD and it focus specially on those that make BDD so fun 🙂
Link: http://lettuce.it/
Frank
Frank allows you to write structured text test/acceptance tests/requirements (using Cucumber) and have them execute against your iOS application.
Link: http://www.testingwithfrank.com/
Codeception
All Codeception tests are written in a descriptive manner. Just by looking at the test body you can get a clear understanding of what is being tested and how it is performed. Even complex tests with many assertions are written in a simple PHP DSL.
Link: http://codeception.com/docs/07-BDD
Chakram
Chakram is a REST API testing framework offering a BDD testing style and fully exploiting promises.
Link: http://dareid.github.io/chakram/
Nbehave
NBehave is a framework for behaviour-driven development (BDD). BDD is an evolution of test-driven development (TDD) and acceptance-test driven design, and it is intended to make these practices more accessible and intuitive to newcomers and experts alike.
Link: https://github.com/nbehave/NBehave/wiki/Getting%20Started
Jbehave
JBehave is a framework for Behaviour-Driven Development (BDD). BDD is an evolution of test-driven development (TDD) and acceptance-test driven design, and is intended to make these practices more accessible and intuitive to newcomers and experts alike. It shifts the vocabulary from being test-based to behaviour-based, and positions itself as a design philosophy.
Link: http://jbehave.org/
minitest
minitest provides a complete suite of testing facilities supporting TDD, BDD, mocking, and benchmarking.
Link: https://github.com/seattlerb/minitest
Hiptest
Hiptest, a realtime test management platform that supports behaviour driven development and seamlessly blends in continuous delivery processes.
Link: https://github.com/hiptest
Gauge
Gauge is an open source test automation tool that is completely hackable. Written in golang, Gauge lets you write tests in plain-speak and refactor fearlessly.
Link: https://github.com/getgauge/
LightBDD
Lightweight Behavior Driven Development test framework.
Link: https://github.com/Suremaker/LightBDD
Specter
Specter enables behavior driven development (BDD) by allowing developers to write executable specifications for their objects, before actually implementing them.
Link: http://specter.sourceforge.net/
SubSpec
SubSpec xUnit BDD Framework.
Link: https://github.com/topics/subspecs
System.Spec
System.Spec is testing tool for the C# programming language.
Link: https://github.com/alexfalkowski/System.Spec
by admin | Aug 24, 2016 | 2016, Fixed |
From Selenium 3.0, minimum Java version is 8. In this blog article, we would like to show you how to use Java 8 features like Lambda expression and Collections Stream to simplify Selenium WebDriver snippets.
Let’s start with Lambda expression.
Java lambda expressions are Java’s first step into functional programming. A Java lambda expression is thus a function which can be created without belonging to any class. A lambda expression can be passed around as if it was an object and executed on demand.
Source: Tutorials Jenkov
Let’s say you want to print all the elements from an array list without lambda expression; then you will come up with the below snippet.
List list=new ArrayList();
list.add("Selenium");
list.add("UFT");
list.add("Appium");
for(String item:list){
System.out.println(item);
}
The same logic, we can implement a lot easier with lambda expression in Java 8.
list.forEach(item -> System.out.println(item));
Collections Stream
Collections Stream is a new feature in Java 8. A stream represents a sequence of elements and supports different kind of operations from a collection.
Let’s say you want to check whether an option is available or not in a drop-down list.
Select select=new Select(driver.findElement(By.id("drp1")));
//Validating drop-down option without For Loop
select.getOptions().stream().anyMatch(item->item.getText().equals("Option1"))
Filtering WebElements using Regular Expression
driver.get("file:///C:/sample.html");
List<WebElement> elements=driver.findElements( By.xpath("//input[@type='checkbox']"));
elements.stream()
.filter(element->Pattern.compile("check_(\d+)_box").matcher(element.getAttribute("id")).matches())
.forEach(element->element.click());
Getting a visible WebElement from WebElement List
driver.findElements(By.xpath("//input"))
.stream()
.filter(elemnt -> elemnt.isDisplayed())
.findFirst()
.get()
.sendKeys("codoid-testing company");
Very Simple, isn’t it?
by admin | Jun 29, 2016 | 2016, Fixed |
How to check or wait until multiple web elements are visible in one webdriver ExpectedCondition? Or how to wait until at least one element is clickable in a group of web elements?
Selenium WebDriver ExpectedCondition supports logical operators which has answers for the above questions and it also helps to create robust automation test scripts. Let’s see ExpectedConditions’ logical operators with examples.
AND Operator
//Wait until both the elements are visible
wait.until(
ExpectedConditions.and(
ExpectedConditions.visibilityOfAllElementsLocatedBy(By.name("Services")),
ExpectedConditions.visibilityOfAllElementsLocatedBy(By.name("Products"))
)
);
OR Operator
//Wait until at least anyone condition returns true
wait.until(
ExpectedConditions.or(
ExpectedConditions.visibilityOfAllElementsLocatedBy(By.name("Services")),
ExpectedConditions.visibilityOfAllElementsLocatedBy(By.name("Products"))
ExpectedConditions.visibilityOfAllElementsLocatedBy(By.name("Contact Us"))
)
);
by admin | Mar 10, 2016 | 2016, Fixed |
QTP XPath examples to identify web objects. XPath is a language for addressing parts of an XML document. Xpath expressions to select nodes or node-sets in an XML document.
In this blog, we have listed some useful XPath locating techniques for QTP (Automation Testing Tool). If you are a beginner, you can refer this list to improve object locating strategy.
Identifying using ID attribute
obj.WebEdit("xpath:=//input[@id='htmlID']").Set "QTP"
Identifying using Type attribute
'Setting value in first textBox
obj.WebEdit("xpath:=//input[@type='text'][1]").Set "QTP"
Identifying using Tagname
'Highlighting first listBox
obj.WebList("xpath:=//select[1]").Select "London"
Identifying using Innertext
'Clicking Google link
obj.Link("xpath:=//a[.='Google']").Click
Identifying WebTable based on Rowcount
'Highlighting the table which has only two rows
obj.WebTable("xpath:=//table[count(.//tr)=2]").Highlight
by admin | Jun 2, 2016 | 2016, Fixed |
This is our first blog post on Ruby Cucumber automation testing and as an automation testing services company, we would like to share basic and advanced techniques of automation testing with software testing & quality assurance communities.
In this article, we will show you how to create a feature file and implementation code using RubyMine. Before following up the below steps, make sure you have already configured RubyMine
Step1-Create Empty Ruby Project
File->New Project
Step2-Create Gem file
Select project directory, right click and click New->File
Create Gem file with the following Gem details as shown below.
Note: These Gem details will be published in our next article.
source 'https://rubygems.org/'
gem 'cucumber', '1.2.1'
gem 'rspec', '2.10.0'
gem 'ffi', '1.3.1'
gem 'watir-webdriver', '0.7.0'
gem 'watir'
gem 'selenium-webdriver'
gem 'headless', '0.2.2'
gem 'titleize', '1.2.1'
gem 'json', '1.7.7'
gem 'gherkin', '<= 2.11.6'
gem 'syntax'
Step3-Directory Structure
Create sub folders as shown below
—>features
————->Project1
——————->feature
——————->pages
——————->step_definitions
————->Support
Step4-Create Shared Driver
Create SharedDriver.rb inside Support folder with the following code.
require 'rubygems'
require 'rspec'
require 'watir-webdriver'
include Selenium
#Creating Remote WebDriver
browser = Watir::Browser.new(:remote, :url => "http://SauceUsername:[email protected]:80/wd/hub",
:desired_capabilities => WebDriver::Remote::Capabilities.firefox)
#If you want to run it locally, use Watir::Browser.new :firefox
Before do
@browser = browser
end
Step5-Create Feature file
Create sample.feature file inside feature folder with the below steps
Feature: Sample Feature
Scenario: Sample Scenario
Given I launch https://codoid.com
And I click on Login tab
And I enter username
And I enter password
When I click Login button
Then I see Home page
Step6-Create Step Definitions
Create Step Definitions with pending steps
Given(/^I launch http://www.codoid.com$/) do
pending
end
And(/^I click on Login tab$/) do
pending
end
And(/^I enter username$/) do
pending
end
And(/^I enter password$/) do
pending
end
When(/^I click Login button$/) do
pending
end
Then(/^I see Home page$/) do
pending
end
Step7-Create Page Object
class LoginPage
attr_accessor :loginTab,:txtUsername,:txtPassword,:btnLogin
def initialize(browser)
@browser = browser
@loginTab = @browser.a(:text => "Login")
@txtUsername = @browser.text_field(:id => "userId")
@txtPassword = @browser.text_field(:id => "password")
@btnLogin = @browser.element(:id => "log_in_button")
end
def visit
@browser.goto "https://codoid.com"
end
def clickLoginTab()
@loginTab.click
end
def enterUsername(username)
@txtUsername.set username
end
def enterPassword(password)
@txtPassword.set password
end
def clickLoginButton
@btnLogin.click
end
def verifyHomePageHeader()
@browser.element(:text => "Dashboard").wait_until_present
end
end
Step8-Call Page Methods in Step Definitions
Given(/^I launch http://www.codoid.com$/) do
@LoginPage = LoginPage.new(@browser)
@LoginPage.visit
end
And(/^I click on Login tab$/) do
@LoginPage.clickLoginTab
end
And(/^I enter username$/) do
@LoginPage.enterUsername("xxxxxxx")
end
And(/^I enter password$/) do
@LoginPage.enterPassword("yyyyyyy")
end
When(/^I click Login button$/) do
@LoginPage.clickLoginButton
end
Then(/^I see Home page$/) do
@LoginPage.verifyHomePageHeader
end
Step9-Create cucumber.yml file
Create cucumber.yml file inside project directory as shown below
default: --format html --out=Report.html
Step10-Run the feature file
Once execution is done, open the report file
You will see the report as shown below
In the subsequent articles, we will share more topics and advanced techniques. Stay tuned!