Powershell - Remove entire directory and it's content

The PowerShell command to remove an entire directory and its contents ( including sub folders and files) is below rm -Rf pathToDirectoryToBeRemoved/ R flag denotes to run “rm” command recursively . “f” flag denotes to run in forcefully. We can even replace “f” with “v” for verbose mode and “i” for interactive mode. Note: Above command can also be used to delete files which have long path ( more than 260 characters)

May 2, 2017

Stubbing XML responses using Mountebank

Previous two blog post talked about how we can use mountebank for stubbing where responses are in json format . They can be accessed (here) and (here). We can use same approach for stubbing SOAP services using XML as well. In this post, I will explain how we can provide XML response using Mountebank . Let us have a quick look into the files created. Before we begin, folder structure of various file as below ...

April 27, 2017

Zip and Extract zip files using Csharp

On corporate world, most of the times, the access required for installing applications and connecting to internet will be limited. There can be scenarios where access to install Mountebank using npm will not be available. In those circumstances, we can just unzip the zip file downloaded from self contained archive links in mbtest.org Below code snippet can be used for extracting the zip files on the fly , so that it can be used for running test cases on any machine. ...

April 20, 2017

Mountebank - Creating a response based on a file template and modifying it

This is an extension to my previous blog about how we can use mountebank to create a stubbed response based on a template file . You can read about it here. In this step by step example, I will explain how we will use mountebank to modify the response based on the request . Before we start, please ensure you are familiar with Part1 of the excercise. If you need to know more about mountebank and how to use mountebank , please read through how to install mountebank and service virtualisation using mountebank. ...

April 6, 2017 · Aby George A

Mountebank - Creating a response based on a file template and modifying it

In the previous two blog post, I have explained about how to setup mountebank (here) and how to create a virtualised respone(here) . Now coming to more detailed use cases which we might encounter in daily life. In this blog post, I will explain how we can use mountebank to create a virtualised response based on a template response stored in a file and modifying certain fields in response based on the request coming through. ...

April 6, 2017 · Aby George A

Creating HTML report for test execution result

How to create HTML report with details of test execution Very often , we will be required to create a report with details of test execution , so that it can be presented to various stakeholders. Specflow provides a feature to create HTML reports. Let us look into more details about how is this done Read through and understand details of reporting from specflow. Ensure packages for Specflow, Nunit, Nunit console runner are already installed. If you are using Nunit 3, install NUnit.Extension.NUnitV2ResultWriter package via nuget package manager. If this is not installed, we will get an error “Unknown result format: nunit2”. Follow setups required for running specflow test cases from command line. Details can be found here. Modify the bat file to create nunit2 reports. PathToNunitConsolerunner\nunit3-console.exe --labels=All --out=TestResult.txt "--result=TestResult.xml;format=nunit2" PathTo\AcceptanceTests.dll Add below command into Bat file. This will create HTML Report called “MyResult.html” PathToSpecfloPackage\specflow.exe nunitexecutionreport PathTo\AcceptanceTests.csproj /out:MyResult.html Final bat file will look like below. REM bat file to run test cases from console and create xml result file .\..\..\..\packages\NUnit.ConsoleRunner.3.8.0\tools\nunit3-console.exe --labels=All --out=TestResult.txt "--result=TestResult.xml;format=nunit2" .\AcceptanceTest.dll REM Generate html report from test output .\..\..\..\packages\SpecFlow.2.1.0\tools\specflow.exe nunitexecutionreport .\..\..\AcceptanceTest.csproj /out:MyResult.html EDITED: If it throws below error in newer version of Visual Studio then ensure MS Build tool 2013 is installed. It can be downloaded from https://www.microsoft.com/en-US/download/details.aspx?id=40760 ...

March 5, 2017

Running Specflow Test from command line using Nunit

How to run specflow test cases from command line We can use nunit console runner for running specflow test cases from command line. Running specflow test cases through nunit console runner will help to create test results in xml file, which can then be used for creating html reports. Procedure for command line test execution are Define Nunit as the test runner. This is done in config file <specFlow> <unitTestProvider name="NUnit"/> </specFlow> Include Nunit.Console.Runner package to solution via nuget package manager Run specflow test cases using below command. We can create a bat file with below command and execute them as required. pathToNunitConsoleRunner\nunit3-console.exe PathToProject.dll example will be .\..\..\..\packages\NUnit.ConsoleRunner.3.8.0\tools\nunit3-console.exe .\BDDFramework.dll

March 4, 2017

Mountebank - Your first service Virtualisation

In current development world, there will be scenarios were both API and its consumers are developed in parallel. Inorder to decouple their dependencies, we can mock an api response using mountebank. In this example, I will explain how to get started with your first service virtualisation using mountebank. After installing mountebank as mentioned in here (Install Mountebank), we will proceed with configuring mountebank. It can be done in few ways. The method which I explain below is by using file based configuration. This involve setting up an imposter file and a stub response ...

March 3, 2017 · Aby George A

Service Virtualisation Using Mountebank

What is Mountebank? In short mountebank is a open source service virtualisation tool . Mountebank uses imposters to act as on demand test doubles. Hence our test cases communicate to Mountebank and mountebank responds back with relevant stubs as defined. How to Setup Mountebank ? Installation can be done via two methods npm Mountebank can be installed as a npm package. Node.js should be installed for this option to work ...

February 13, 2017 · Aby George A

UI Testing- decoupling back end dependency

The traditional approach for automating UI test cases is to create selenium web driver based ( or any UI testing tools) scripts for exercising complete end to end flow. However, it comes with its own challenges. It will have multiple steps as pre-requiste for reaching required UI page and hence it behaves as an E2E integration test rather than UI test. A typical web application architecture will have one or more front-end application, which will talk to multiple back-end services, API’s etc. They will, in turn, talk to other back-end services or to different databases. On High level , architecture looks like below ...

February 12, 2017