Monday, 29 August 2011

Rock & Roll With Http Level Testing

Article written by Sreenivas Mothukuru

In continuation to my previous topic (My approach towards automation)

There are many tools available on web to test at http level. However, I explored Web Inject tool and found the tool very handy & simple to impliment http level testing.

Follow below steps to run http level tests to check form validations and apache redirections for http://www.blogger.com/ web site.

1) Download “webinject-1.41.win32.zip - MS Windows Executable + Source Code” from http://www.webinject.org/download.html location).


2) Un-zip “webinject-1.41.win32.zip” and copy folder to some drive/location.

3) In Config.xml (within Web Inject folder), replace entire content with
********************************************************
<testcasefile>sampleTest.xml</testcasefile>
********************************************************
4) Create a file named “sampleTest.xml” (within Web Inject folder) and copy below content to the file.
********************************************************
<testcases repeat="1">
<case
    id="1"
    description1="Accessing
www.blogger.com/ web site"
    description2="User is seen redirected to another page (i.e.
www.blogger.com/home)"
    method="get"
    url="
http://www.blogger.com/"
    verifyresponsecode="302"
/>

<case
    id="2"
    description1="Accessing
www.blogger.com/home"
    description2="User is seen redirected to
https://www.google.com/accounts/ServiceLogin? ... "
    method="get"
    url="
http://www.blogger.com/home"
    verifyresponsecode="302"
/>

<case
    id="3"
    description1="Accessing
https://www.google.com/accounts/ServiceLogin? ..."
    method="get"
    url="
https://www.google.com/accounts/ServiceLogin?service=blogger&amp;passive=1209600&amp;continue=http://www.blogger.com/home&amp;followup=http://www.blogger.com/home&amp"
    verifyresponsecode="200"
    verifyresponse="Email"
    verifyresponse1="Password"
    verifyresponse2="Don't have a Google Account?"
/>

<case
    id="4"
    description1="Form validation - both Email & Password fields left blank"
    method="post"
    url="
https://www.google.com/accounts/ServiceLoginAuth"
postbody="ltmpl=start&pstMsg=1&dnConn=https%3A%2F%2Faccounts.youtube.com&continue=http%3A%2F%2Fwww.blogger.com%2Fhome&followup=http%3A%2F%2Fwww.blogger.com%2Fhome&service=blogger&dsh=2093325602420315311&ltmpl=start&ltmpl=start&timeStmp=&secTok=&GALX=lfJvJ5-NTRI&Email=&Passwd=&PersistentCookie=yes&rmShown=1&signIn=Sign+in&asts="
    verifyresponsecode="200"
    verifyresponse="Enter your email address."
/>

<case
    id="5"
    description1="Form validation - Password field left blank"
    method="post"
    url="
https://www.google.com/accounts/ServiceLoginAuth"
postbody="ltmpl=start&pstMsg=1&dnConn=https%3A%2F%2Faccounts.youtube.com&continue=http%3A%2F%2Fwww.blogger.com%2Fhome&followup=http%3A%2F%2Fwww.blogger.com%2Fhome&service=blogger&dsh=-5106055381980639771&ltmpl=start&ltmpl=start&timeStmp=&secTok=&GALX=lfJvJ5-NTRI&Email=heysreeni&Passwd=&PersistentCookie=yes&rmShown=1&signIn=Sign+in&asts="
    verifyresponsecode="200"
    verifyresponse="Enter your password"
/>
<case
    id="6"
    description1="Form validation - Invalid user name and password field"
    method="post"
    url="
https://www.google.com/accounts/ServiceLoginAuth"
postbody="ltmpl=start&pstMsg=1&dnConn=https%3A%2F%2Faccounts.youtube.com&continue=http%3A%2F%2Fwww.blogger.com%2Fhome&followup=http%3A%2F%2Fwww.blogger.com%2Fhome&service=blogger&dsh=-5106055381980639771&ltmpl=start&ltmpl=start&timeStmp=&secTok=&GALX=lfJvJ5-NTRI&Email=heysreeni&Passwd=dsfsfsdfsd&PersistentCookie=yes&rmShown=1&signIn=Sign+in&asts="
    verifyresponsecode="200"
    verifyresponse="The username or password you entered is incorrect"
/>

</testcases>

********************************************************
5) Test Cases 1, 2 & 3 validate apache redirections and Test Cases 4, 5 & 6 validate form validations for Blogger site.

6) To open Web Inject client application double click on “webinjectgui.exe” file (within Web Inject folder).


7) Now, click on “Run” button.

8) That’s all; you can see http tests running on the same window with results. You can monitor the response time while tests are running. Detailed test results can be viewed at “results.html” file (within Web Inject folder). Also, select “Response Timer Output” checkbox to know the response time for each http request.

Observations (form validation & apache redirection tests for blogger.com):

- "sampleTest.xml" http level test script took ~11 seconds to execute all cases.
- same tests at browser level (using Selenium) took ~25 seconds to execute all cases.

Note:
- Follow below links to know more about http level automation using Web Inject.

- Example mentioned in this blog is very basic and trivial. To make the example easy to understand I didn't use methods provided by Web Inject. Http tests can be well maintained if Test Engineers efficiently use all available WebInject methods.

------------------------------------------------------------------------------------------------
Feel free to ping me / email me if you have any questions regarding the usage of Web Inject tool
------------------------------------------------------------------------------------------------

Wednesday, 3 August 2011

Is it an ATTITUDE or qualification that matters?

Article written by Sreenivas Mothukuru

A few days back I went to a roadside stall with my friends. We all had Pani Puri and Mirchi Bajji. Stuff was very delicious; we all appreciated the stall owner for maintaining good quality. During the conversation with the shop owner, I was surprised to know that the person who is preparing/serving Pani Puri and Mirchi Bajji is an Engineering graduate! In another incident, while I was on my way to airport (Dubai trip) my cab driver was curious about my company and my work. When I asked the reason for his curiousness he slowly said that he is an engineering graduate, working part time as a cab driver and searching for jobs. These incidents made me think about the education system, any value added by bachelor/master degrees, opportunities within corporate offices, competency level with the so called degrees at workplace, etc.
Does a mere bachelor or masters degree add value to a person’s profile? Do the emerging Graduates really have the potential to meet corporate needs? Does the academic degree justify a person? Does an individual justify his/her degree?
Take for instance ... there are nearly 700 engineering colleges in Andhra Pradesh. Current year, the total Engineering seats available are around 3lakhs and students who managed to qualify the entrance exam are approximately 2.03lakhs. Out of 3lakhs seats nearly 2.1 seats have to be filled by students under government quota. Every student who qualifies the engineering entrance will get the seat and eventually become so called engineer. Fortunately, students have wide choice in choosing engineering colleges and ample time to complete studies. Unfortunately, the value of engineering degree is disgracing over time. To make the matter even worse, All India Council for Technical Education (AICTE) the apex body which controls technical education in India has tentatively approved the creation of another 40,000 seats this year. There are lots of newer and existing engineering colleges, most of which are not known for their academic excellence.
The crazy thing about engineering study is one can enjoy the freedom after coming out of controlled environment until 10+2. The funny part is most of the students pass out with insufficient percentage and have high expectations in life.
Unfortunately people here know more about Engineering compared to other faculty. Looking at the public interest towards engineering study number of engineering colleges came up with no standards. These days education has become more like a profitable business. Engineering is becoming a common degree, not a professional degree. If the same trend continues, one day there will be no value for such degrees.
Moreover, these days I see many IT companies giving preference to candidates with engineering degree compared to others. With over 8 years in IT industry, I see many non engineering students performing equal (or even more) with engineering students at all levels. To my opinion, it is not the degree that justifies a person but it is the person who justifies the degree. 
In fact, the quality of a person doesn’t depend on his/her qualification. It all depends on his/her attitude towards life, work or anything ...