Category: C#

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

Running Specflow test in Parallel using Specflow 2.0 and NUnit 3.x

In this post we will discuss one of the cool new feature introduced by Specflow 2.0, which is Parallel execution support out-of-box along with NUnit 3.x.

Does NUnit 3.x support parallel execution?

Yes it does, NUnit parallel execution support is discussed in greater details in Selenium automation with C# video series of ExecuteAutomation youtube channel

Parallel execution consideration

In order to achieve parallel test execution, there are some important consideration needed to be taken care before you ensure your test runs properly

Parallel execution with memory isolation (AppDomain)

  • Ensure your test code executing the application is not depends on static states (e.g. external cache, databases etc), if so then
  • This can be achieved by isolating test into AppDomain, this ensures that every test execution thread is hosted in a separate AppDomain and that each thread’s memory

Parallel execution without memory isolation (AppDomain)

  • If your tests do not depend on any static states (ie. do not store any test-specific information in static fields), you can run the tests in parallel without AppDomain isolation

What’s the code change in existing specflow code ?

It’s fairly very simple, just one line of additional change in AssemblyInfo.cs file and you are good to go and the change is this

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

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

Working with Types in C# for Automation testing

In our last post we discussed about working with classes and objects of C#, in this post we will discuss about types in C#.

Types

Types are like blueprint of what we create, again more like classes that we discussed in previous post

Custom Types

As we already discussed in previous videos, classes are Types, but since the class in Program.cs is something you customized and created its called custom types

Pre-defined Types

In C# there are many predefined types as well for instance

1. Int
2. String
3. bool
4. double etc

Here is the complete video of the above discussion

Type casting

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

Advanced automation reporting system with EARS

ExecuteAutomation has released an all new course in Udemy on advanced reporting system for automation system called ExecuteAutomation Reporting System (EARS). ExecuteAutomation Reporting System (EARS) is going to be an unified reporting system for any type of automation testing. EARS is built using ASP.Net technology.

EARS will support any kind of automation tools/technology you use like

  • Selenium
  • Coded UI
  • Appium/Robotium etc

As that said, EARS is going to have following features built right into it

  • Single point reporting for automation testing
  • Historical test report maintenance (EARS_DB)
  • Historical search (EARS_DB)
  • Historical store for external reports like Pickles (EARS_DB)*

EARS

You can find the complete course from here https://www.udemy.com/creating-automation-reports-with-ears

Here is the introduction video

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

Introduction and getting started with C# for automation testing

In this post we will discuss a very brief introduction of C# and getting started with C# using Visual Studio 2015 for automation testing. This post and upcoming post are part of C# for automation testing course.

What is the motivation behind this course

ExecuteAutomation is trying to help people from different background in automation testing world, especially people from Manual testing .There are 100’s of questions I get each months (not day yet) from people asking on the importance of C# for automation testing.

Here is the complete video of the above discussion

Introduction

Getting started

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