Test Automation – How Selenium WebDriver works?

Welcome to brand new series on Test automation with Selenium. In this series, we will have a look at how we can automate testing of web application with Selenium.

Selenium is popular open source test automation tool. With Selenium, we can automate test scenarios related to black box testing, compatability testing, system testing, api testing, and regression testing.

Selenium Project has 3 flavours Selenium IDE, Selenium WebDriver, and Grid. Out of which WebDriver API is very popular in automation.Today I am going to focus on Selenium WebDriver.

How Selenium WebDriver works ?

Using WebDriver, we can drive browser and perform actions like Click, Open URL, Enter text, take screenshot etc.Typical test automation utilizes WebDriver API, language specific driver bindings, and test framework.

WebDriver does not directly interact with browser. Then how does WebDriver communicates with browser? It follows simple client server way of interaction. A proxy driver server sits between the client automation script in Java,Python, C# etc and browser. It is specific to the browser, such as ChromeDriver for Google’s Chrome, GeckoDriver for Mozilla’s Firefox, etc.

To run WebDriver script on chrome browser, we need to first start the ChromeDriver server by instantiating particular driver class.

using (IWebDriver driver= new ChromeDriver())

{ }

Then driver server launches the Chrome browser and starts listening on a particular port Listening on the port refers to accepting HTTP request which can be GET,POST etc.

For every selenium command, WebDriver creates a HTTP request and sends the request to the proxy driver server. All steps to be executed on browser are interpreted and executed by proxy driver server. It receives and sends back response from browser to client automation scripts.

For Ex : driver.Navigate().GoToUrl(“https://thealivecard.com/“);

Above command opens up specified Url in browser.

WebDriver uses JSON wire protocol for communicating between client and proxy driver server.

Test execution is facilitated by testing frameworks like NUnit, JUnit, MSTest etc. Testing framework provide features like test annotations, assertions which makes test automation easier.

For Ex : In NUnit, [Test] annotation marks method in test class to be executed as test

In NUnit, Assert class provides many methods to compare and verify test outputs

For Ex : Assert.AreEqual(link.Displayed, true);

Below is sample code assembled together to help you say Hello to Selenium 🙂

using System;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace SampleTest
{
public class HelloSelenium
{

private const string HomeUrl = “https://thealivecard.com/”;

[Test]
public void LoadApp()
{
using (IWebDriver driver = new ChromeDriver())
{

driver.Navigate().GoToUrl(HomeUrl);
Thread.Sleep(3000); driver.quit()’

}

}
}

}

Hope this post will help you to get started with Selenium webdriver Next time , we will explore some interesting scripts in selenium test automation

Till then, keep testing Keep sharing

Test cycle

Hello and Namaste…………Welcome to yet another post for software testing. In this post, we are going to know about how a typical test cycle functions.

After software requirements are understood and analysed well, developers write code. When development is completed, software developed is released to QA team for testing. A software is released as “build”. Build refers to process in which programs are compiled together to make tangible software component or product so that it can be tested for functional and non functional requirements.

A typical functional test cycle consists of smoke testing,testing change requests, regression testing, ad hoc testing, and retesting if applicable.

Smoke testing : Whenever software build with new features or enhancements or bug fixes is released, build is validated for critical functionality of application . If smoke scenarios aka critical functionality of application is working, then smoke test status is said to be pass and build is accepted for further QA examination. Otherwise if build fails smoke test is fail and build is rejected

Regression testting : In regression testing , software components influenced by new changes or features are tested in detail. Impact area is determined by scope of changes done. If changes done are limited to few components, then only relevant modules are tested otherwise whole system is tested to verify wheather changes done have affected any other functionality

Ad hoc testing : Ad hoc testing validates system in general. End to end scenarios are tetsed across application without focusing on any particular feature or module. Ad hoc testing is preferred if test cycle has limited time and impact of new changes is less

Retesting : Retesting of fixed issues is carried out for any of bug fixed and given for QA verification

Open Letter to Irrfan

Dear Irrfan,


What is success, stardom and fame ? Is it so unobtainable that there is a sense of invincibility attached to it. In a country like India where we worship our stars, came a man with a tinkering hope and a beacon of light that showed us that success is bound to hardwork and discipline.


Playing a Cab driver in Piku one of my favorite films you just showed the world that everyone has to sort their own problems. I reluctantly agreed to watch Paan Singh as I was tired of the zillion sports films that bollywood churns every year, but to my pleasent surprise your army officer turned sports person turned bandit king tragic story brought chills to my spine, I wonder if anybody else would have picked up this script.


You are not my most favorite actor because my criteria are wrong, I keep on looking at the sky when I should have known that the true star was always nearby. Gone too soon. But as Pi you only said, “The whole of life becomes an act of letting go, but what hurts the most is not taking a moment to say goodbye”

Yours Truly,
Rushi

Attention parents! You are under surveillance!

Got baffled by the title?? But yes, this is a fact. Your kids are watching you day and night. You may call your child ten times,  your kid may not respond and may seem engrossed in something. But you start talking with your husband or with your friend and you will find that their antenna is always directed towards you. If you are talking about the kids then they will not miss even a single word.

You try to sit comfortably and discuss something with your husband and I am ready to bet if your kid doesn’t come running towards you and occupy space between you and your husband. 

Once my kid was spending his vacation with his grandparents. After couple of days I received a call from my mother in law (MIL) asking whether we had a fight regarding who should clean the kitchen platform in the night. I was more embarrassed than surprised by this question. She narrated the afternoon’s incident. That day the kids were playing “Mummy Daddy” game. My kid was acting as the Daddy and our neighbour’s daughter was acting as the Mummy. During this role play the Daddy asked Mummy to clean the kitchen platform and the Mummy readily agreed. Now the little Daddy gave instructions to the Mummy, “Hey how come you readily agreed to clean kitchen platform?? You should say that it’s your turn to do it today and fight” My wizened MIL had guessed what must have happened and had called me. Plus I got a free advice that we should not fight in front of the kiddo. All I remember is my kid was engrossed in watching cartoons in other room when we were fighting. I am sure even you would have experienced similar thing.

I remember when I was a kid my mother used to have her college in the early morning (she was a teacher). She used to finish cooking and other chores before her college. She used to be in great hurry. If we sisters wouldn’t follow discipline she used to scold us. She used to get delayed. But I used to feel what’s there to scold us for such a small thing. When I would grow up I wouldn’t lose my temper by such a small thing. But alas! That’s not the case. When placed in similar circumstances unknowingly my reactions are exactly same as my mother and not what I always envisaged.

In my office it was normal for people to distribute chocolates on their birthdays. All the kids love chocolates. So did my kiddo. So used to bring those chocolates home and share with my kiddo. After few days I realised whenever kids used to distribute chocolates in his school he started bringing them home. He used open then only after I came home. Or when he used to fall sick I used to check his temperature after every 2-3 hours. Now when I fall sick he does the same without anyone telling him anything!

Jokes apart, but parents we are seriously being watched 24*7. Our kids are going to immitate us in similar circumstances. Our advices may not work. Actions speak louder than words.  Kids learn more by watching our behavior than what we tell them. We are the role model to our kids. I would like to conclude by saying be the man you want your child to become!

To read my other blogs please visit https://kinfolkclub.com or https://motherlab.blogspot.com

Making kids understand value of money! – Part 3

In earlier blog we read about how my son demanded a Nerf gun and I suggested him to buy it with his hard earn money. He had accepted the challenge, started ironing clothes and was waiting for his first pay.

In his first month he had managed to iron 55 clothes and he had earned Rs 330. He wanted to buy a toy for himself. We went to our usual toy shop. He immediately checked the price of Nerf gun. Its price range was from Rs 800 to Rs 20000. He was little disappointed. Then he started checking some other fancy toys. Alas!! They were very costly.

Finally he told the shopkeeper that his budget was Rs 330 and asked what could be purchased with this amount. The shop keeper started showing some card games, board games etc. When he made his first selection the total cost of the merchandise was Rs 336. He didn’t have sufficient money. I offered to give him extra Rs 6. But he refused. I offered him advance of Rs 6 and asked him to adjust it in next billing cycle. He rejected this proposal either. Finally he selected 2 items – Fletter cards and fidget spinner. This fitted well in his budget. He was very happy with his shopping. He was in euphoria. 

He started ironing his clothes with more gusto in the next month. In the second month his tally was around Rs 650- 700. Still the money was not sufficient to buy Nerf gun. He was little disheartened and asked me way forward. I advised him to save his money and spend it at a later date. It was very difficult for him to exercise control. But the attraction for Nerf gun proved to be stronger. Finally after 3 months of ironing he became proud owner of his Nerf gun!!

Few learnings from this exercise:

1. One has to really put in lot of efforts to earn even a small amount of money.

2. If you want to make big expenditure then you need to plan and save the money.

3. The kid has learnt one essential life skill which will never go waste.

Lastly I would quote 2 incidents which assured me the learning has indeed been etched into my son’s mind:

1. We have been visiting same toy shop in nearby locality for years. One day the owner specifically asked me, “Madam, what have you done? Earlier your son used to look for all costly fancy toys. But these days he has suddenly started asking for cheaper and simple toys. He comes with some budget as well?? Are you paying him any procket money??”

2. My son and his grandfather had been to movie. During break his grandfather thought of buying him popcorn. Dadaji was mentally prepared to spend the extravagant cost of Rs 220 for tub. But when my son noticed this price he flatly refused to buy any snacks as they were not worth the money.

What else one mother could want!!

For reading my other blogs please visit  https://kinfolkclub.com or https://motherlab.blogspot.com

Making kids understand value of money! – Part 2

Read Part 1

In last blog we read that my son wanted a Nerf gun. Giving Nerf gun was not a big deal for me but making my kid understand the value of money was very important. I had found the solution to this problem. I had suggested my son to buy the gun with his hard earned money. Read on to know how.

Me: That’s easy enough. I will give you a deal. If you like it then you can accept it. Why don’t you iron your own clothes? I pay outside laundry-man at the rate of Rs 6 per cloth. I will pay you at the same rate for the clothes you have ironed during the month. We can maintain a diary and note number clothes ironed on each day.

Son: But I don’t know how to iron clothes. 

Me: Oh! It’s not at all difficult dear. Me and your father would teach you how to iron.

Son: But what if I iron the clothes, earn the money and you refuse to buy whatever I say. 

Me: That’s a promise. I will not refuse or detain you from buying whatever you like. If I feel something is not appropriate as a mother I will tell you my opinion. But the final decision will be yours and it will be binding on me and as well as on your father.

I interlocked little finger of my right hand into little finger of his right hand. That was a gesture of promise which cannot be broken by either of the parties. This was sufficient to convince my son. But I was not done yet. I also told him one more condition that I would not hand over the cash to him. We would accompany him wherever he wanted to go for shopping and we would pay directly to shopkeeper. I had put this condition for 2 reasons. First, he shouldn’t carry money in school for showing off among his friends and fall victim to some untoward incident. Second to maintain transperancy. It shouldn’t so happen that we have disallowed something and he spends money on such things without our knowledge. We had full trust in our son but at such young age taking due precaution was our responsibility as parents. Let the kids venture far but not too far.

My son understood the full scheme. He was not too sure about whether he should go for it or not. Next 2-3 weeks went by without mentioning either of the Nerf gun or ironing. One Saturday my son declared that he was ok with my proposal and wanted to learn ironing. We immediately got a brand new Murphy Richards iron. My husband taught him how to lay table for ironing, how to adjust the temperature of the iron depending on material of the cloth and finally how to iron different types of clothes. We advised him to iron his clothes under our supervision only. We had to help him initially in turning the clothes and folding them. But in short time he mastered the art. He was now eagerly waiting for first pay day.

Follow my blog to know whether my son would be able to buy his beloved the Nerf gun with his hard earned money. (To be continued..)

Making kids understand value of money ! – Part 1

When we were kids we didn’t have so many toys and resources and yet we were so happy. Today’s kids have plenty many toys and still they always look dissatisfied with their lot. They always keep on demanding something more.

My son had turned 11. He had many toy guns. But now he wanted to own a Nerf gun. I knew that his enthusiasm for any new toy including this Nerf gun would remain for 2-3 days and then the toy would lie in some forgotten corner of the house for ages. So I was not very keen on buying the same. My past experience had taught me that outright denial leads to lot of dissatisfaction and opens up endless string of arguments. I wanted to avoid this scene but at the same time I wanted my son to understand the value money. 

But how to do it?? It was easily said than done.  I wanted some time to think. So when my son demanded Nerf gun I just gave him non-committal answer, “Let’s see”. Thereafter I was thinking on it for couple of days. One really does not appreciate the efforts required for earning money unless he himself has earned money. Oh yes! Eureka!! I found the solution. Now I needed to talk to my son. I called him and told him.

Me: You wanted a Nerf gun right?

Son: Yes.

Me: See you already have 2-3 guns. So I don’t feel like buying another gun for you. But still if you really want Nerf gun then you can purchase it with your own hard earned money.

Son: Hard earned money? What do you mean by hard earned money?? 

I had to be very careful while defining this term because my son had earned decent amount of prize money. Plus he was favorite of all and used to get gift money from family and friends on various occasions. 
Me: It means money earned by doing some real work. It will not include prize money or gift money that you have received.

Son: It will not include prize money or gift money?? Then how am I supposed to earn money Mamma? It’s impossible. (He looked little disheartened)

Me: That’s easy enough. I will give you a deal. If you like it then you can accept it. 

My son was listening with all attention. If I had proposed something then I had to show him practical way of achieving the same also. I had found out a solution which was “Win Win” situation for me. If he would accept my proposal he would learn a new life skill which would be useful to him throughout his life and plus learn the value of money. If he would not  accept my solution I would not purchase this Nerf gun also.

Stay tuned to find out what this solution was and whether my son accepted my proposal. (To be continued…)

To read my other blogs please click on https://motherlab.blogspot.com

What you sow comes back to you 😄

Now my kiddo had entered primary school. He was learning new new things – formally from his school and informally from his friends. That day he had learnt new thing from his  friends was eating chewing gums. Now he was insisting on buying a packet of chewing gums. He knew that I didn’t approve of eating chewing gums. So he smartly approached his father and demanded chewing gums. 

My husband also didn’t much approve of chewing gums. But he also knew that banning it completely would not help. So he got a packet of chewing gums and insisted  on eating it under his supervision. Our son had never eaten chewing gum till then. My son was more than glad in complying with his Daddy’s directions. 

Now the next challenge was how to stop him from getting into this habit?? Now our son was a big boy and would not yield to our wishes unless he would be convinced about it. If we would have tried to convince him he would have felt that since both of us hate chewing gums we are simply trying to keep him away from it. We wanted some impartial judge. And here came our ally. The Internet!!

You will find information about anything you want. You need to just word your search phrase appropriately. After our son had his first chewing gum my husband gave search on the Internet “Disadvantages of eating chewing gums” Of course internet provided lots of information on disadvantages ranging from tooth decay to kidney problems to cancer. My son read these articles. He also found out that the chewing gums may contain controversial ingredients like Butylated Hydroxytoluene, Titanium Dioxide, Aspartame which if consumed in excess quantities may lead to cancer, metabolic disorders, head aches. Immediately he checked his own packet. He found one of such controlversial ingredients in his chewing gum. He immediately threw his remaining packet in dustbin. We were relieved by this action.

My husband and myself proceeded for doing night time chores and our son continued browsing internet. After some time he called both us. He told his father, “Daddy, these days you use too much of WhatsApp”

During that period my husband was working as coordinator and was using WhatsApp to a great extent for this coordination job.

Husband: Of course, I need to use it for work.

Son: But it is not good for you at all 

Husband: Means?

My son had googled on “Side effects of using WhatsApp” and he was showing some article where the author had mentioned extreme consequences of using WhatsApp. The author had mentioned that one may lose the eyesight by excessive use of WhatsApp!! I burst into laughing. My husband’s face was worth watching.  My kiddo was looking at both of us with a big question mark on his face. He was unable to understand why the elders were not taking such dire consequences seriously.

Afterall what you sow comes back to you!!

Happy boy who forgot to flush

Now the days of “हम दो हमारे दो” are over. These days most of the couples have single kids. Single kids who are greatly pampered, who get the best of everything and are yet unsatisfied. Many times they are very argumentative. Parent have to literally pursuade their kids to do small things. Kids don’t listen and the overall environment of the house gets heated.

For some time we were trying to teach our son that whenever he uses a bathroom he was supposed to flush and keep the bathroom clean. Sometimes he used to flush and sometimes he used to forget. There was no particular reason behind either forgetting or remembering. We were tired of constantly reminding and checking. He was not leaving his casual attitude behind. Persuasion, scolding, punishment all modes tried but in vain. One day my husband had a brain wave and he started narrating a story of a happy boy to our son.

“Once upon a time there lived a boy. He used to be happy at all times. He used to be happy during day, he used to be happy during night. He used to be very happy while brushing and doing potty also. His happiness knew no bounds.

In the fit of his happiness he used to do many crazy things. For example when he used to take bath he would sing and then leave wet towel on the bed. While going out he would change into new clothes and in the fit of happiness leave used clothes on the floor. When he used to come back from school he would leave his shoes and socks scattered in the room. He would throw his school bag on the sofa. But he used to be happiest when he used to go for potty. He would sing songs and then forget to flush. He used to be so happy, so happy that he used to turn deaf when people were calling his name. He simply would not respond to his Mum or Dad calling.”

My son was staring at my husband with mouth wide open. When my husband finished telling his story he just rushed into the bathroom and flushed the toilet. He came back and asked my husband, “Daddy, you are telling my story, aren’t you?” My husband didn’t reply. He was just smiling. 

This story proved to be a game changer. The term “Happy Boy” became sort of code word for us. The moment we would say today you seem to be very happy he would run around the house and check what he had done rather I would say what he had omitted to do. Earlier when we used to have guests and he used to forget to flush we used to feel embarrassed while telling our son. But now we would just say “Happy boy” and immediately my son would pick up the hint and do the needful. All shouting business had reduced considerably. No pursuasion was necessary. Absolutely no embarrassment in front of guests. Overall environment became calm and pleasant. After all these years now my kid is trained and desciplined. But for occasional rare lapses the story of a happy boy comes handy.

Friends, I agree that this was not a planned and calculated trick. But I am sharing this experience to demonstrate that we need to be creative while dealing with our kids. Mere shouting and punishing does not help. This cannot be the readymade solution as every kid is different and different things would inspire different people. Just think what would inspire your own kid and try something new. When you get frustrated just remember that there was a happy boy who would forget to flush!