
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Differences Between Selenium and Cucumber
There are differences between Selenium and Cucumber are listed below −
Sr. No. | Selenium | Cucumber |
---|---|---|
1 | It is a test automation framework. | It is not a test automation framework. |
2 | Primarily used for automation testing of front end applications. | Primarily used as a tool for behavior driven development. |
3 | Can be written in any programming language like Java, Python, Ruby, C#, and so on. | Can be written in Gherkin language. |
4 | Developed in Java. | Developed in Ruby. |
5 | Can only be used by users having technical knowledge. | Can be used by users without any technical knowledge. |
6 | Less readable compared to Cucumber. | Easily readable. |
7 | Installation is lengthy and complex compared to Cucumber. | Installation is easy. |
8 | Conditional statements can be incorporated. | Conditional statements cannot be incorporated. |
9 | Syntax errors can be easily determined. | Syntax errors often get unnoticed. |
10 | All the project stakeholders (developers, testers, product owners, business analysts, clients and so on) can contribute. | Team members- developers and testers can only contribute. |
11 | Enables us to automate steps which are manually performed on the browser. | Enables creating scenarios in plain English with the help of the keywords - Given, Then, When, and so on in the steps. |
12 | Consists of only one file which contains the script implementation. | Consists of three files – Feature file, Step Definition file (implementation of steps in Feature file) and Test Runner file. |
Implementation with Cucumber −
Feature File
Feature: Login Module Scenario: User login Given: Visit URL "https://tutorialspoint.com"
The corresponding Step Definition File
@Given ("^Visit URL \"([^\"]*)\"$") public void visit_url(String u){ System.out.println("URL is : " + u); }
Example
Implementation with Selenium −
import org.openqa.selenium.WebDriver; import org.openqa.selenium.ie.InternetExplorerDriver; public class BrwserLaunch{ public static void main(String[] args) { //configure path of IEDriverServer.exe path System.setProperty("webdriver.ie.driver", "C:\Users\ghs6kor\Desktop\Java\IEDriverServer.exe"); //object of InternetExplorerDriver WebDriver driver = new InternetExplorerDriver(); //URL launch driver.get("https://www.tutorialspoint.com/index.htm"); driver.quit(); } }
Advertisements