Extracting Substring using Javascript

In previous blogs here , I have explained how we return a XML response using mountebank. However , most of the time, we will have to make some modification to the template response before returning a response. Say for example, we may have to replace details like timestamp, or use an input from request parameter and update that in response etc. One of the easiest way to do this without using other frameworks like xml2js etc is to extract the substring between the node values and replace it . Below is a code snippet which will help to achieve this ...

July 21, 2017

Predicates In Mountebank

Predicates in Mountebank imposter files is a pretty powerful way to configure stubs. It helps us to return different responses based on the request parameters like type, query string , headers, body etc. Let us have some quick look at extracting values from request Based on Query String Below is an example of extracting the records based on query string. If the request is like path?customerId=123&customerId=456&email=abc.com Note: This is slightly modified version of code in mbtest.org ...

July 15, 2017

Galen Framework - Getting started

In previous post, I mentioned that we can use Galen for automated lay out testing. Galen offers a simple solution to test location of objects relative to each other on the page. Galen is implemented using Selenium Web driver. Hence we can use it for normal functional automation testing as well. Documentation of Galen Galen has its own domain specific language to define Specs. Detailed documentation can be found here. Galen has its own javascript API which provides a list of functions which make writing test cases easier. Detailed documentation can be found here. Galen pages javascript API is light weight javascript test framework. Details are available here. Details of galen test suite syntax are here. Galen framework has a detailed documentation of its usage and functions here. ###Installation### ...

June 25, 2017

Automated testing of CSS for Responsive Web Design

In a world where mobile first seems to be the norm, testing of look and feel of websites on various mobile/tablet devices are essential. More businesses are now adopting Responsive Web designs for developing their web applications and sites. ###What is Responsive Web Design### According to Wikipedia, Responsive web design (RWD) is an approach to web design aimed at allowing desktop webpages to be viewed in response to the size of the screen or web browser one is viewing with. In addition, it’s important to understand that Responsive Web Design tasks include offering the same support to a variety of devices for a single website. A site designed with RWD adapts the layout to the viewing environment by using fluid, proportion-based grids, flexible images, and CSS3 media queries, an extension of the @media rule, in the following ways: ...

June 21, 2017

How to Squash Commits in Git

Very often we will be committing smaller pieces of work in our local machine as we go. However before we push them to a centralized repository, we may have to combine these small commits to single large commit, which makes sense for rest of the team. I will explain how this can be achieved by using interactive rebasing. To start with, let us assume the initial commits history look like below. It have 4 minor commits done to the same file. ...

June 15, 2017

Migrating To Octopress

Over the past weekend, I noticed that my blog is not available since azure has disabled hosting of my WordPress blog. It happened because I ran out of my free credits for the current month. I started looking for alternate options for hosting WordPress. That’s when I came across (Static Generator is All a Blog Needs - Moving to Octopress). I decided to give it a try. Below are the main steps which I followed for migrating to Octopress ...

May 20, 2017

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