SpecFlow Feature File

History of SpecFlow Feature File

 

What is SpecFlow Feature File?

A feature file is an entryway to the SpecFlow test. That is a file where identify lab tests in Descriptive language. It an important part of SpecFlow, as it functions as an automation test script as well as live documents.

 History of SpecFlow Feature File

An attribute file can contain a scenario or many scenarios within a feature data file. it usually contains a set of cases. Let’s create one such file.
The head for writing the first script, let’s create a nice folder composition of the task.

Create a Feature File Folder

It will always be good to have a nice and clean folder framework in the job.Each folder signifies this content in it. So, first build a folder for the feature file.
1) Create a new Folder by right click on the ‘Task’ and navigating to include -> New Folder.
2) Name the folder as ‘Features’ and hit enter.
After the folder for feature document created, we have been all set to make a feature file.

Create a Feature File

1) Over the Feature folder Right-click and navigate to include -> New Item.
2) Select SpecFlow Feature File in the center. it logical name, with regard to this guide, please use the same name ‘LogIn_Feature’.
For SpecFlow to find the testimonies, It will need to make sure that they carry the ‘.feature’ file extension.
3) Write first feature file for LogIn Scenario.

Gherkin

A language named Gherkin. it implements the concepts of Business readable area specific language(BRDSL). Site-specific language provides the capability the application behavior without details of implementation.

If we have now come back to BDD/BRDSL we will see that we are able to describe checks in a more readable format. In the above test it’s quite clear and obvious, by reading, what test would do. At exactly the same time of being a test drive, it also documents the habit of application. The true power of BDD/BRDSL and it’ll become the electricity of cucumber works on the same principles.

Keywords

Now moving forward we have described a test. You will notice colored part of the tests. They are keywords described by Gherkin.
Feature: Defines what feature you will be testing in the assessments
Given: Tells the pre-condition of the test
And: Defines extra conditions of the test
When: Defines the action of the test
Then: Says the postcondition. Able to say that it’s expected result of the test

 History of SpecFlow Feature File 

We provide History of SpecFlow Feature File in real time training. We offer selenium training in Hyderabad by real-time project Training.

Save

Selenium Test using NUnit Framework

Selenium Test using NUnit Framework

What is NUnit Framework?

NUnit is a unit testing platform for performing unit testing based on the .NET platform. It is a trusted tool for unit testing and is preferred by many designers today selenium training in Hyderabad.

Selenium Test using NUnit Framework

NUnit absolved to use. NUnit does not create any test scripts alone. write test scripts on own, but NUnit gives to work with its tools and classes to make product trials easier. The details to keep in mind about NUnit are listed below:

  • NUnit is no automated GUI testing tool.
  • It is not a scripting dialect, all tests written in .NET backed languages, e.g., C#, VC, VB.NET, J#, etc.

What is NUnit Adapter?

The NUnit Test Adapter gives you to run NUnit testing inside Visual Studio.

Steps to Download and Install NUnit Construction using the NuGet Deals?

1) Go to Recommendations >> Manage Nuget Plans… from the answer Explorer window from the right side.
2) Type Nunit in the Search pack. This will need few seconds to find the right tool. Locate (seek out) NUnit in the center panel and showcase it by selecting it and Click Install.

Steps to Download and Install NUnit Adapter using the Extension Manager?

1) From within Visual Studio, go to Tools >> Extensions and Posts.
2) Seek out NUnit Test Adapter as soon as found select Install button.

How to choose between Expansion and NuGet package

The Extension will apply to Visual Studio room itself and can work with all projects you use. All users of your solution need to set up the Extension.
The Deal will apply to the solution and can work for any other end user too, as it follows the solution.

Steps to Create a NUnit Test

The very first thing need to do is to make a new course and write test code in that.
1) Right Click on the Project in the Solution Explorer and choose Add >> Class.
2) Give your Course name ‘NUnitTest’ and select Finish button. This will bring up a sugary class creation window.
3) Write the selenium code for the next steps

  • Take up a FireFox Browser
  • Start Website in the web browser started out by Selenium
  • Close the Browser

4) Separate the code into three different parts:

  • Take up a FireFox Browser: Initialize
  • Start Website in the internet browser began by Selenium: OpenTestApp
  • Close the Web browser: EndTest

5) Now Build the solution again by doing Build >> Build Solution.
6) Now use NUnit Annotations to specify your test. Use [SetUp], [Test] & [TearDown] for the three methods created above for every single action. And again run the Build
7) It’s enough time to run the NUnit test. To perform the test, Right Click in the Code window and choose Run Tests.

Steps to make a New Package

Now we are moving to learning Selenium. We are doing a lot of practice for Selenium Code. so it makes sense to create a different package for all the Selenium Test. To achieve that, we need to create a fresh folder into the project solution.
1) Right Click on the Project and select Add >> New Folder and name it Selenium Basics.

Selenium Test using NUnit Framework

We provide Selenium Test using NUnit Framework in real time training. We offer classroom and project training for selenium training in Hyderabad.

How to Handle Multiple Browsers in Selenium CSharp

Handle Multiple Browsers in Selenium CSharp

 

How to Handle Multiple Browsers in Selenium CSharp

There many windows via Selenium web drivers. that clicking on a link which opens the page in a fresh browser screen. Selenium web drivers keep tabs on glass windows it opened throughout a session. Any browser windowpane Exposed Opened by a prior treatment of Selenium Webdriver period. We mean the duration of the time instantiates a WebDriver occasion enough time. we kill it via WebDriver.Give up or by hand killing the process.

Handle Multiple Browsers in Selenium CSharp

This will click on the “New Browser Windowpane” button 3 times. As a result, you will see 4 house windows that will come into existence. Take into account window opened during driver initialization is the Parent home window.

How to Handle Screen in Selenium CSharp?

To identify a web browser Selenium WebDriver map of Opened windows VS Window Deal with. It distinctive string value identifies an Internet browser screen on the desktop. It guaranteed that every browser will have a unique window cope with. To get Screen handle WebDriver program provides two methods CurrentWindowHandle – WindowHandles

The current window handle method returns a string value. its profits the Window take care of current focused browser windows. WindowHandles. This method results in a ReadOnlyCollection of all Window handles browsers opened period.

Console Output: This is the output that gets on the system. Focus on the Window take care of values, they can be unique to the other person

The way to handle Many House windows in Selenium CSharp?

Their idea of currently focused windows selenium web driver commands focused home window. By default the emphasis definitely on the Parent windowpane, please start the screenshot. To shift concentrate from Parent Window to any child home window. We use the next command line on WebDriver – driver.SwitchTo(). Home window This control takes in a window handle and switches the driver context on that screen. Once the Transition happens all the driver commands will go to the focused home window. That important to comprehend, without switching to the desired window. we will never be able to perform any action on that windowpane. Which across all the open up glass windows and navigates to a specific page in every the open windows one at a time.

Concluding all the Windows

There quite two commands. that people use to close browser windows WebDriver.close() and WebDriver.Quit().

WebDriver.Close() command line will close the current window on which the focus is present. This used to close glass windows. The windows would like to nearby use the right Window take care. the call the WebDriver.Close command word. That may close the existing browser window.

WebDriver.Quit()

It will close all the house windows exposed in the program. This command shuts down the driver instance and WebDriver leads to the exception. That’s pretty much it that people have for handling many windows.

Handle Multiple Browsers in Selenium CSharp

We provide Handle Multiple Browsers in Selenium CSharp by real time experts.We provide real time project training for selenium training in Hyderabad.
 

Save

Different types of Alert And Popup Box in Selenium CSharp

Different types of Alert And Popup Box in CSharp

 

Different types of Alert And Popup Box in Selenium CSharp

Alert is a pop-up window that arises on screen. There are various user activities that can cause an alert on display. customer clicked on a button that displayed a note or when you entered a form. HTML web page asked you for some extra information. We understand to Handle kinds of Alert And Popup Container in Selenium CSharp.

Different types of Alert And Popup Box in CSharp

Alerts are different from regular house windows. The primary difference is the fact that alerts are blocking in nature. They will not allow any action on the root web page if they are present. So if an alert exists on the website and make an effort to access any of the factors in the fundamental page

Handling Alerts using Selenium WebDriver

Selenium provides us with a software called IAlert (It is an Interface).
It is present in the OpenQA.Selenium.IAlert package deal. Alert interface gives us following methods to deal with the alert:

  • Accept() To accept the alert
  • Dismiss() To dismiss the alert
  • Content material To get the text of the alert
  • SendKeys() To create some text message to the alert

Simple Alert

Simple alerts have an OK button on them. They used to display some information to an individual. The first alert on our test web page is a straightforward alert. The following code will browse the text message from the Alert and then allow the alert. the note that people swap from the main windowpane with an alert using the driver.SwitchTo().Alert().

Confirmation Alert

This alert possesses an option to accept or dismiss the alert. To accept the alert use IAlert.Accept() and also to dismiss use the IAlert.Dismiss().

Prompt Alerts

In prompt alerts, get an option to add text to the alert container. This used when some input is necessary from an individual. We use the SendKeys() method to type something in the Prompt alert box.

Different types of Alert And Popup Box in CSharp

 We provide Different types of Alert And Popup Box in CSharp by real time experts. We offer corporate and online training for selenium training in Hyderabad.

 

Save

Implementation of WebElement Extensions Method in Automation Framework

WebElement Extensions Method in Automation Framework

WebElement Extensions Method

Selenium WebDriver is a powerful framework for web test automation. there’s always room for improvement. this improvement produced by leveraging the prevailing features of Selenium WebDriver.

Let’s discuss the cases of modifying Selenium Actions.

 1: WebElement SendKeys

It observed that on some word fields principles are pre-filled. the Selenium SendKeys action work, it does not take away the old text and add or append content material to it.

 2: WebElement Click

There may be situations where Click action cannot work on any given aspect. In that case, we conclude clicking on the element with the aid of JavaScript or MouseHover click. To help make the code reusable we always create functions of reusable activities.

 3: Logging

Logging is an essential activity in any framework. Logging can be Step Level or Action Level. Action Level logging is difficult to control, as required to enter log after every action. it becomes an automation scriptwriter to keep up the reliable logging on the platform.

What are Extension Methods?

Extension Methods existing types without creating type, recompiling or modifying the original type. An extension method particular kind of static method. they called as though case methods on the extended type.

An expansion method static approach to a static class. where in fact the “this” modifier applied to the first parameter. The sort of the first parameter will be the type prolonged.

How exactly to Create Extension Method?

We create an expansion way for a WebElement type. so WebElement gave as a parameter for this extension method. that method called by the WebElement using the dot operator.

EnterText() instead of SendKeys()

This function is simple, it makes our code a little from concise. the original Selenium HANDY REMOTE CONTROL RC, SendKeys clear a wording field. then send the mandatory word. In Selenium 2, word fields aren’t cleared first unless carried out. the method EnterText(), were passing a IWebElement type with ‘this’. so that it called by any factor variable, in other words, an IWebElement illustration.

IsDisplayed() instead of Displayed()

Selenium’s default behavior is to throw an exception if a factor is not found. IsDisplayed method catches exclusion to test the visibility of the elements without execution program.

SelectByText of Select Class

This put into action every action of Selenium in own way. It logging for the reason that or use try capture stop or anything.

 WebElement Extensions Method in Automation Framework

Step 1: Build an Element_Extensions Class

1) Create a new folder and name it as Extensions.

2) Create a fresh C# course in the Extensions folder, name it as Element_Extensions.

3) Write the execution of the Component_Extensions class.

Feature and Property of Expansion Methods
  • It static method
  • This situated in a static class
  • The “this” keyword as the first parameter with a sort in.NET. which method called by a given type illustration on the client side.
  • An extension method in the same namespace as employed. import the namespace of the course by a using statement.
  • Any name for the course that comes with an extension method but the course should be static.
  • If add new solutions to a sort and do not have the source code for this. The solution is to use and install extension ways of that type.
  • create expansion methods that have the same personal methods. the type extending, expansion methods called.

WebElement Extensions Method in Automation Framework

We provide WebElement Extensions Method in Automation Framework in real time experts.We offer selenium training in Hyderabad by the real-time project.

 

 

Save

JSON  Introduction

Overview Of Json

JSON  Introduction

JSON is one of the most used Data-Exchange formats. It is a lightweight format represented as pure text. Due to the ability of almost all the languages to parse text. Json becomes independent of the programming language.

 Overview Of Json

JSON stands for JavaScript Object Notation.  It human and machine-readable format to represent data as Structured Data. JSON used to transfer data from one computer to different programs on the computer.

Key Value Pairs

Key-Value pairs in JSON used to represent a property of the Object. In the above example, we tried to represent a Person.
Key-Value in JSON we have to follow these rules

  • Key value pairs separated by a : (colon)
  • Key is always present in Double Quotes ” “
  • Value could be anything about the Data Type

Values can be of following data types

  • Boolean: True or False
  • Number: Numerical values
  • Object: An associative array of Key-Value pairs
  • Array: Associative array of values

Object in JSON

In JSON an object represented the collection of Key-Value pairs. This collection of Key-Value pairs grouped using (opening and closing curly braces}. Rules to writing an Object are

  • Key-Value pairs separated by a, (Comma)
  • Each Object should Start with an Opening (Opening Curly Brace)
  • Each Object should End with a Closing (Closing Curly Brace)
Array in JSON

Arrays are like Arrays that you know from any other programming language. In JSON an Array is the collection of Values separated by Comma. Here are the rules to write an Array

  • An Array starts with an opening [ (Bracket)
  • An Array ends with a closing ] (Bracket)
  • Values in the Array separated by, (Comma)

To understand an Array let us add one more property to the Person Object. Let us add hobby also, a Person can have many hobbies. This makes it suitable to represent hobbies as an Array.

Components of a JSON

See how many hobbies represented using an Array. Array starts and ends with [ ] and contains values separated by,
These are the various components of a JSON, using these components we can create complex JSON.

 Overview Of Json

We provide Overview Of Json in real time training. We offer classroom, online and project training for Selenium training in Hyderabad.

 

Save

Explicit Waits FluentWaits in Selenium C#

Explicit waits fluent waits selenium C-Sharp

 

Explicit Waits FluentWaits in Selenium C#

we call them explicit waits because they applied to await conditions. Also, each explicit holdout is different from the other one in the core waiting for logic.

We will solve this problem using pursuing waits

  1. WebDriverWait
  2. DefaultWait 

Explicit waits fluent waits selenium C-Sharp

The mentioned two waits, generally speaking, the explicit waits, are smart waits. They called smart because they don’t wait for the max periods. Instead, it waits for the time till the problem specified in .until method becomes true.

Once the until method named, pursuing things happen in this sequence

 1: This smart/explicit wait captures the delay start time.
 2: Smart/Explicit wait around checks the problem that mentioned in the .until() method
 3: If the problem is not attained. a thread rest applied with time from the value in the .pollingInterval property call. Inside the example above it is 250 milliseconds.
 4: After the thread sleeping of step three 3 expires, the of start time made with the current time.

wait condition

This process retains ongoing on till enough time either timeout expires or the condition comes out to be true. The important point here’s waiting around condition evaluated after the end of polling time duration. So we don’t already have to wait for the complete timeout.

WebDriver Wait

WebDriverWait is present in the OpenQA.Selenium.Support.UI namespace. This holdout is a particular form of DefaultWait category. We will discuss DefaultWait in the next section.

Here the complete logic of wait encapsulated inside the Func delegate. which is present in System namespace. We must cross Func delegate to the WebDriverWait.until method.

Func delegate

Func delegate like this Func<Type1, Type2>. where Type1 is the source parameter and Type2 is the output parameter. WebDriverWait tied to WebDriver, hence Type1 will always add up to WebDriver and Type2. which does the comeback type whatever want.

DefaultWait

The default delay is more universal put it off in the sense that it’s not destined to WebDriver. This wait around used to pass in an object to hold back on. Let’s make an effort to solve the above problem via DefaultWait now.

Explicit waits fluent waits selenium C-Sharp

We provide Explicit waits fluent waits selenium C-Sharp by real-time training. We offer classroom and online training for selenium training in Hyderabad.

Save

Implicit Wait Commands in Selenium WebDriver C#

Implicit wait Commands in C-Sharp

Implicit Wait Commands in Selenium WebDriver C#

The wait is a very important concept in any automation task. Waits are vital to any task due to the unpredictability that comes with automation. Sometimes might find that the component wants to perform an action on packed little late. this automation script breaks.
In case of Web software, this unpredictability boosts quite Implicit wait Commands in C-Sharp.

Implicit Wait following factors

  • Slow internet connection
  • Ajax calls created by elements
  • Database phone calls made by website
  • Slow browsers
  • Delay packed elements, which used to maximize bandwidth usage

There could be a great many other factors too. The main element indicates understand people focus on these delays and write code. so that any hold off taken care of, as well as testing scripts, don’t break. Because of this Selenium Webdriver includes some excellent inbuilt waits. We will see them one by one.

Test web application

Expect a test web application and in the application, there is a link. This link takes a differing amount of time to appear on the site. Some time its present on the web page as soon as the page tons. other times it seems on the web page after a hold off of some mere seconds. I write a simple IWebDriver.FindElement command word. it will sometimes pass with other times NoSuchElement exception in the application selenium training institutes in Hyderabad.

Implicit wait Commands in C-Sharp

The implicit wait employed to inform web driver. there situations when some elements on the website will not be present. In those instances to hold back for quite a while before trying to get the element. This called implicit hang on and below is the code to identify implicit wait.

Important points to keep in mind
  • The default value of implicit wait is 0 a few moments. This means that WebDriver will attempt to get the element only time and after that. it will toss an exemption if an element is not found.
  • Implicit hang on has a default polling time of 250 milliseconds. Which means that WebDriver will poll the Dom after each 250 milliseconds till. The aspect is available or the timeout specified it exhausted.
  • Implicit wait around applied lasts for the whole session. this implies till enough time IWebDriver subject is alive.
  • Implicit hang altered any number of times till the IWebDriver time is alive.
Page Fill Timeout

Purpose: Sets the amount of time to wait for a full page insert to complete before tossing an error. In the event the timeout is negative, web page tons can be indefinite.

Set Script PERIODS

Purpose:
 the quantity of time to hold back for an asynchronous script to complete execution an error. If the timeout is negative, then the script permitted to run.

Sleep Command

Purpose: That is rarely used, as it always drives the browser to hold back for a specific time. Thread.Rest is never a good notion. so in retrospect Selenium provides wait for primitives.

Implicit wait Commands in C-Sharp

We provide Implicit wait Commands in C-Sharp by real-time training. We offer selenium training in Hyderabad by classroom and project training.

 

Encapsulate Selenium Page Objects

 Encapsulation Page Objects in C-Sharp

Encapsulate Selenium Page Objects

Encapsulate Selenium Webpage Things understand the important Object Oriented Coding Rule. It very is necessary for us to put in place the same basic principle in the Test Framework as well. It helps to make the code more secure, readable and maintainable.

Encapsulation Page Objects in C-Sharp

Encapsulation in Java is a device of wrapping the info and code acting info single product. In encapsulation the variables of a course covered by other classes. It reached through the techniques of their current class, so also called data hiding.

To do encapsulation in Java

  • Declare the variables of a course as private.
  • Provide general population setter and getter methods alter and view the factors values.

Accessor – Get()

An accessor method employed to ask a subject about itself. In OOP, these are usually in the form of properties. that have, under normal conditions, a get method, which is an accessor method. But, accessor methods aren’t restricted to properties and any open public method. that provides information about the state of the object.

Mutator – Place()

Mutators are public methods. that used to change the state of a thing. While covering the implementation of exact data gets changed. Mutators are generally another part of the property reviewed, time around collection method. that let us the caller adjust the member data behind the moments.

Advantages
  • The fields of the class made read or write.
  • A course can have total control over stored in its domains.
  • The users of class do not know the category stores its data. A course can change the data kind of a field and users of the class do not need to change any of their code.
Encapsulate Selenium Web page Objects

Together with the above assumption in our Framework, we have to make all the Web page Items as Private.

[FindsBy(How = How.Identification, Using = “profile”)][CacheLookup] private IWebElement MyAccount get; place;

Execution of Encapsulation in Automation Framework

LogInTest.cs TestCase

HomePage PageObject Class

LogInPage PageObject Class

login page class Reason

 Login page class, we have not created any Accessor or Mutator for Username & Password field. Although all the properties have evolved to private now. The reason is, so far in the login test, we have not used Username & Password. The test calls the LoginToApplication() solution to do the thing. So the point could it be is not useful to create subject methods till the time test makes use of it. the PageObject course will end up with hundreds of object methods.

Encapsulation Page Objects in C-Sharp

We provide Encapsulation Page Objects in C-Sharp in real time training. We provide selenium training institutes in Hyderabad by project training.

Save

PageFactory CacheLookup

PageFactory CacheLookup in C-Sharp

 

PageFactory CacheLookup

PageFactory provides CacheLookup feature to cache the WebElements. This feature helps scripts to the InitElements method to cache the factor located. Any attribute marked will not search over and again. This is especially great for elements heading to be there PageFactory CacheLookup in C-Sharp.

PageFactory CacheLookup in C-Sharp

This means the elements of the site cached once searched. All elements found in the HomePage & login page static always present. So that it is way better to cache objects and save execution time of the test run selenium training in hyderabad.

How exactly to use PageFactory CacheLookup

If we know that element is actually present on the web page, it is advisable to use the next declaration:

[FindsBy(How = How.Id, Using = “account”)][CacheLookup] general population IWebElement MyAccount get; set;
 
PageFactory CacheLookup NameSpace

PageFactory features resides in OpenQA.Selenium.Support.PageObjects.CacheLookupAttribute.

How to Tool PageFactory CacheLookup in Framework

We will be using the same LogIn Scenario because of this. We enhancing circumstance and the end goal of the Selenium Automation Construction.

  • Change Web page Object

All we need to do here are to include PageFactory CacheLookup feature for every aspect. In HomePage school, we only need one component so far.

  • HomePage PageObject Class
  • LoginPage PageObject Class
  • Test for LogIN Functionality

The test case will stay same and continues to be as it is. It’s the benefit of pursuing Page Thing model that if there is any change in PageObject, the test remains same.

  • LogInTest.cs TestCase
  • Project Explorer
Notes
  1. If using the PageFactory, presume that the fields initialized. I don’t use the PageFactory, then NullPointerExceptions tossed. if make the assumption that the domains already initialized.
  2. List<WebElement> areas adorned if and only if they may have the @FindBy or @FindBys annotation. Default search strategy “by id or name”. that works for WebElement fields hardly well suited for lists. it rare to get several elements with the same id or name on a full page.
  3. WebElements evaluated. That never use a WebElement field in a PageObject, there won’t consider a call to “findElement” for it.
Advantages
  1. If the PageFactory initialized the proxies configured. the WebElements aren’t found at that time.
  2. Every time use a WebElement it’ll go and find. it again shouldn’t see StaleElementException’s.
  3. When using the @CacheLookup annotation. which is dropping the next benefit as it will find the factor. then keep a reference to it, actually far StaleElementExceptions. 
Dissimilarities between C# and Java Implementation
  1. In C# the PageFactory.InitElements returns void, while in Java it profits the Page Items.
  2. The PageFactory execution for C# only looks for elements using the Identification. It generally does not find the elements using the NAME property. While in Java it also will try to find the aspect of Name property, if it is unable to find it with ID.
  3. The Java implementation must locate the element even without the FindsBy attribute. This isn’t the case for C#.

PageFactory CacheLookup in C-Sharp

We provide PageFactory CacheLookup in C-Sharp in real time training. We provide selenium training in hyderabad by real-time project training.

Save