Tag: C#

bddwithspecflow

FindInSet an best way to verify Collection with Specflow Table

In this post we will discuss about working with FindInSet method of Specflow 2.1 (earlier versions don’t have this method).

FindInSet of Specflow v2.1

With Specflow v2.1, we now have a very handy method to verify an Specflow Table against an collection, which comes very handy while working with large set of data collection and verifying the same against an feature file specflow table something like this

Here is the complete video of the above discuss along with code demo

Here is the complete source code of the above video

Read more

022416_1540_NewsExecute1.png

Udemy course of ExecuteAutomation is chosen as BestSelling course

Hi Friends,

I am very happy to announce that our “Automation framework development with Selenium C# (Advanced)” course is chosen as the bestselling course.

The course has served many professionals to get their daily job done, since it has an ready-to-use framework along with many ancillary features (like reporting, test harness etc)

If you are not aware of the course content, here is a sneak peek video of the same

Here are the other courses released by ExecuteAutomation

Thank you once again !

Karthik KK

brokenlinks

Identifying broken links with Selenium C#

In this post we will discuss one of the common question asked by many readers of ExecuteAutomation, which is the topic name.

Its actually fairly very simple though, I just wrote 10 lines of code to achieve it (you might have even better solution than one I have)

So, here is the pseudo code

  1. Navigate to the URL of site you are interested in
  2. Get all the links of page using FindElements(By.Tag(“a”)) method
  3. Iterate through the page URLs and get the attributes href using GetAttribute(“href”) method
  4. Use Simple WebRequest and HttpWebResponse class to get the page response and status code.

So, here is the output

Here is the source code

Thanks for reading the post and watching the video!!!

Please leave your comments and let me know if there is anything I should update in this post.

Thanks,
Karthik KK

specflow

Parallel execution with Specflow 2.0 + NUnit + Selenium

In the last post we discussed how to work with Specflow 2.0 parallel execution, in this post we will discuss how to run Multiple tests in parallel in multiple browser same time using Specflow + NUnit + Selenium.

Problem with Selenium WebDriver object while running Specflow test in Parallel

Since we will be using selenium webdriver object in many Specflow step definitions and while running tests in parallel, we will encounter NullReferenceException , in order to resolve the problem, we need to use two important techniques

  • Context injection (dependency injection)
  • IOC Container

IOC Container

  • In software engineering, inversion of control (IoC) is a design principle in which custom-written portions of a computer program receive the flow of control from a generic framework.
  • A software architecture with this design inverts control as compared to traditional procedural programming: in traditional programming, the custom code that expresses the purpose of the program calls into reusable libraries to take care of generic tasks, but with inversion of control, it is the framework that calls into the custom, or task-specific, code.

-Source : Wikipedia

So how code looks like for IOC Container?

Here is the complete source code in GitHub https://github.com/executeautomation/SpecflowSeleniumParallel

Here are the complete videos of the above discussion

Video 1

Video 2

Thanks for reading the post and watching the video!!!

Please leave your comments and let me know if there is anything I should update in this post.

Thanks,
Karthik KK

dockerSElenium

Code to run Selenium grid test on multiple docker containers

In the last post we discussed how to setup selenium grid containers with Docker, in this post we will discuss how to run test on multiple docker containers in parallel using docker command.

Here is the complete source code of this article

https://github.com/executeautomation/SeleniumParallelSample

Sample snippet

Here is the complete video of the above discussion

Thanks for reading the post and watching the video!!!

Please leave your comments and let me know if there is anything I should update in this post.

Thanks,
Karthik KK

dockerSElenium

Introduction to Selenium grid with Docker

In our last few posts, we discussed how to working with docker, containers and working with multiple containers. In this post we will discuss how to work with Selenium grid using Docker.

What is Selenium grid?

SeleniumGrid allows you run your tests on different machines against different browsers in parallel. That is, running multiple tests at the same time against different machines running different browsers and operating systems. Essentially, SeleniumGrid support distributed test execution.

Selenium grid architecture with Docker

Getting things ready for selenium test

We need to have following installed in our machine before starting selenium grid test

  • 1. Docker for Windows
  • 2. Pulled the latest Selenium hub container
  • 3. Pulled the latest Selenium node for firefox/chrome
  • 4. Visual Studio 2015 (any edition)

Here is the complete video of the above discussion

Introduction

Initiating docker selenium grid container setup 

Thanks for reading the post and watching the video!!!

Please leave your comments and let me know if there is anything I should update in this post.

Thanks,
Karthik KK

C#

Working with methods in C#

In the last post we discussed how to work with different types in C#, in this post we will discuss how to

  • Work with methods
  • Methods with different parameters (method overloading)
  • Methods with return types

Here is the complete videos of the above topics

Methods with return types

Thanks for reading the post and watching the video!!!

Please leave your comments and let me know if there is anything I should update in this post.

Thanks,
Karthik KK