tag:blogger.com,1999:blog-20523939261044129942024-02-18T21:07:38.659-08:00howilearned automationtestingprateek goyalhttp://www.blogger.com/profile/12759918229607838781noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-2052393926104412994.post-73523540920779605972015-10-02T04:56:00.000-07:002015-10-02T04:56:18.207-07:00Test Automation Framework<div dir="ltr" style="text-align: left;" trbidi="on">
<i><span class="_Tgc">This post is outcome of my reading of one case study about frameworks in book "<b>Experiences of test automation</b>" by Dorothy Graham and Mark Fewster. The case study is written by Lars Wahlberg, who has more than 10 years of experience in building test automation frameworks.</span></i><br />
<span class="_Tgc"><br /></span>
<span style="font-size: large;"><b><span class="_Tgc">What is Automation Framework?</span></b></span><br />
<span class="_Tgc">According to Wikipedia, the <b>framework</b> provides the basis of <b>test automation</b> and simplifies the <b>automation</b> effort.It contains APIs (Abstraction layer), Test Engine, some coding guidelines.</span><br />
<span class="_Tgc"><br /></span>
<b><span class="_Tgc">Abstraction Layer:</span></b><span class="_Tgc"> </span><br />
<span class="_Tgc">Abstraction layer is very important factor for a good framework. This layer should be very optimal, i.e. automation engineer should be able to automate testcases without knowing technical details of system under test(SUT). And at the same time it should not be so thick that it itself becomes complex and maintenance cost is increased.</span><br />
<span class="_Tgc">API names should be self explanatory.</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgW74WmqzHSOQn-r2cAvryA9SQx27goteJQVP7R_uW1Uc61ts_OmkC0qPDLDzXRBp0au0_afPzIUxFnslWFQgxIcVvfnH9XQTJP0c4K0ztJH8hyphenhyphenONa4XQbCN-54Jl5Xj5IN2S4DOz_DOcI/s1600/frameowrk.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgW74WmqzHSOQn-r2cAvryA9SQx27goteJQVP7R_uW1Uc61ts_OmkC0qPDLDzXRBp0au0_afPzIUxFnslWFQgxIcVvfnH9XQTJP0c4K0ztJH8hyphenhyphenONa4XQbCN-54Jl5Xj5IN2S4DOz_DOcI/s1600/frameowrk.jpg" /></a></div>
<br />
<br />
<br />
<b><span class="_Tgc">Test Engine:</span></b><br />
<br />
<span class="_Tgc">Test engine does following things:</span><br />
<span class="_Tgc">1. Selects tests to be executed</span><br />
<span class="_Tgc">2. Summarizes test results</span><br />
<span class="_Tgc">3. provides methods for setup, cleanup, reporting and assertions.</span><br />
<br />
<span class="_Tgc">Example can be taken as Junit or Xunit. An example can be seen, when I'll compare these definitions with my project framework.</span><br />
<br />
<b><span class="_Tgc">Coding Guidelines:</span></b><br />
<span class="_Tgc">If coding guidelines are followed then framework can be extremely beneficial.</span><b><span class="_Tgc"> </span></b><br />
<br />
<span class="_Tgc"> </span><b><span class="_Tgc"><br /></span></b><br />
<b><span class="_Tgc"> </span><span class="_Tgc">My learning from the case study: </span></b><br />
<span class="_Tgc">1. <b>Abstraction level</b> should be optimal. It should not be too thick or too thin.</span><br />
<span class="_Tgc">2. <b>Independent testers</b> are required although developers can also right the test cases and execute them.</span><br />
<span class="_Tgc">3. If <b>configuration is also version controlled </b>with test scripts, it can be beneficial to test system with different configurations, which can lead to explore more defects.</span><br />
<span class="_Tgc">4. We should have separate <b>testers </b>and <b>automators</b>.</span><br />
<span class="_Tgc">5. <b>Domain Knowledge</b> is necessary for test design.</span><br />
<span class="_Tgc">6. Test script implementation language plays a great role in automation. It should be chosen wisely keeping the design of system under test in mind.</span><br />
<span class="_Tgc">7. There are different roles in software test automation:</span><br />
<blockquote class="tr_bq">
<div style="text-align: left;">
<blockquote class="tr_bq">
<span class="_Tgc"><b> Roles:</b></span><br />
<br />
<span class="_Tgc"><b> Test Engineer:</b></span><br />
<span class="_Tgc"><b> 1. </b>A test engineer should have technical skills to understand the system at API level.</span><br />
<span class="_Tgc">2. He should know a programming language.</span><br />
<span class="_Tgc">3. It is good to have test design training.</span><br />
<span class="_Tgc">4. Knowledge of test methodology is necessary.</span><br />
<span class="_Tgc"><br /></span>
<b><span class="_Tgc"> Reviewer:</span></b><br />
<span class="_Tgc">1. He is senior test engineer.</span><br />
<span class="_Tgc">2. He usually has more than 5 years experienced in domain. Good reviews can also find defects.</span><br />
<span class="_Tgc"><br /></span>
<b><span class="_Tgc"> Test Automation Architect:</span></b><br />
<span class="_Tgc">1. A test automation architect is responsible for developing and maintaining of test framework.</span><br />
<span class="_Tgc">2. He defines best practices and coding standards for automation.</span><br />
<span class="_Tgc">3. Trains test engineers to do minor changes in abstraction layer, so that he does not become a bottleneck.</span><br />
<span class="_Tgc"><br /></span>
<span class="_Tgc"><br /></span>
<span class="_Tgc"><b> Daily build Engineer:</b></span><br />
<span class="_Tgc">1. Executes test batch</span><br />
<span class="_Tgc">2. Does first analysis of results</span><br />
<span class="_Tgc">3. we can use tools for daily builds, and continuous builds. e.g. Jenkins, Hudson</span></blockquote>
</div>
</blockquote>
<span class="_Tgc"> 8. use object oriented programming, coding standards, and some good examples.</span><br />
<span class="_Tgc">9. Always check for the configuration, if it is not present then skip the test.</span><br />
<span class="_Tgc">10. Test automation ROI is measured on worth of rapid deliveries and worth of each passed test.</span><br />
<span class="_Tgc">11. test automation is cost is total of cost maintaining:</span><br />
<span class="_Tgc"><b> Test tool + Framework + Test Scripts</b></span><br />
<span class="_Tgc">12. Each test suite maps to some functionality.<b> </b></span><br />
<br />
<span class="_Tgc"><br /></span>
<span style="font-size: large;"><b><span class="_Tgc">Comparison with My Current Project:</span></b></span><br />
<span class="_Tgc"><br /></span>
<span class="_Tgc"><b>Framework</b> : Our framework is developed using Perl and Selenium Remote Driver module written in Perl.It is for web-based application. OS interactions are done using AutoIT scripting.</span><br />
<span class="_Tgc"><br /></span>
<span class="_Tgc"><b>Abstraction Level : </b>Framework APIs use Object Oriented Perl. Thus it provides a fair abstraction level. One API handles many arguments, and we can give arguments or parameters as needed.</span><br />
<span class="_Tgc"><br /></span>
<span class="_Tgc"><b>Development life cycle</b>: Following Agile</span><br />
<span class="_Tgc"><br /></span>
<span class="_Tgc"><b>Team Size:</b> 17. We have automation team of 13 people. 4 people maintain framework. QA team is different, which include manual testers.</span><br />
<span class="_Tgc"><br /></span>
<span class="_Tgc"><b>Application Domain: </b>SSL VPN solution, web-based</span><br />
<span class="_Tgc"><br /></span>
<span class="_Tgc"><b>Test Engine:</b> Xunit. We are using Xunit(Junit type engine for perl). We have modules written in perl for this: Test::Class and Test::More. These follow TAP (Test Anywhere Protocol). We can select test to be executed. It also summarizes the results in following way:</span><br />
<br />
<pre style="-webkit-text-stroke-width: 0px; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 1; word-spacing: 0px; word-wrap: break-word;">ok 1 - ....</pre>
<pre style="-webkit-text-stroke-width: 0px; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 1; word-spacing: 0px; word-wrap: break-word;">not ok 2 - ......</pre>
<pre style="-webkit-text-stroke-width: 0px; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 1; word-spacing: 0px; word-wrap: break-word;"> </pre>
<pre style="-webkit-text-stroke-width: 0px; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 1; word-spacing: 0px; word-wrap: break-word;">We have methods for setup, cleanup etc in this test engine. </pre>
<span class="_Tgc"><br /></span>
<span class="_Tgc"><b>System Configuration</b> : system config is created in form of XML. For now it is not version controlled. It can be imported by the application.</span><br />
<span class="_Tgc"><br /></span>
<span class="_Tgc"><b>Manual Test Procedures:</b> These are written by QA team. Test suites and test cases are managed by Zephyr. We can also use HP ALM for that, which was being used in my previous project. We save these manual procedures in Perldoc. And then start automating them. Thus we do not need to document tests.</span><br />
<span class="_Tgc"><br /></span>
<span class="_Tgc"><b>Technical skills needed:</b> Product is SSL VPN. So domain knowledge includes networking, TCP/IP layers, and VPN tunneling protocols, SSL VPN etc.</span><br />
<span class="_Tgc">Programming skills are required and object oriented programming is must. Should have some knowledge about selenium. </span><br />
<span class="_Tgc">Test design skills are good to have.</span><br />
<span class="_Tgc"><br /></span>
<span class="_Tgc"><b>Daily build execution:</b> On Jenkins. Batches are run. </span><br />
<span class="_Tgc"><br /></span>
<span class="_Tgc"><br /></span>
<span class="_Tgc"><br /></span></div>
prateek goyalhttp://www.blogger.com/profile/12759918229607838781noreply@blogger.com0tag:blogger.com,1999:blog-2052393926104412994.post-33587738494851570992015-09-22T22:20:00.002-07:002015-09-27T00:34:38.912-07:00Simple Example of Object Oriented programme in Perl<div dir="ltr" style="text-align: left;" trbidi="on">
This is the example from the book "Intermediate Perl" and it is the easiest one I could find.<br />
<br />
First of all, the final script we want to write is:<br />
<br />
<b><i>use strict;<br /><br />use horse;<br /><br />my $tv_horse = horse->named('Mr. Ed');<br /><br />$tv_horse->set_name("Mister Ed");<br />$tv_horse->set_color("grey");<br /><br />print $tv_horse->name, ' is ', $tv_horse->color, "\n";</i></b><br />
<br />
<br />
We can see method invocation, as we have used arrow operator(->). Therefore we can conclude that this script is using APIs from an OO module (<span class="_Tgc">A <b>Perl module</b> is a reusable package defined in a library file whose name is the same as the name of the package (with a .pm on the end).</span>). That module is <i><b>horse.</b></i><br />
<br />
<i><b>we can think of above program as written below in non-OO Perl:</b></i><br />
<br />
<i><b><br /> Horse::named(Horse, 'Mr. Ed');<br /> $tv_horse::set_name($tv_horse, 'Mister Ed');<br /> $tv_horse::set_color($tv_horse, 'grey');<br /> $tv_horse::name($tv_horse); </b></i><br />
<br />
Following is explanation of above program line by line :<br />
<br />
<i><b>use strict;</b></i><br />
Good for debugging, it is recommended to use.<br />
<br />
<b><i>use horse;</i></b><br />
This line is to load the module horse, which has APIs(or Methods) defined or inheriting APIs from another module.<br />
<b><i> </i></b><br />
<br />
<b><i>my $tv_horse = horse->named('Mr. Ed');</i></b><br />
This line creates a new object instance of horse with name 'Mr. Ed'. <b><i>named </i></b>can be thought of as an API, although in Perl we call it as a <b><i>constructor</i></b>. It'll be explained when we take a look at <i><b>horse</b></i> module.<br />
<br />
<b><i>$tv_horse->set_name("Mister Ed");</i></b><br />
This line uses API<b><i> set_name, </i></b>which, as name says, sets the name for horse object. It is a good practice to use self explanatory names.<br />
<br />
<b><i>$tv_horse->set_color("grey");</i></b><br />
This line also explains itself the functionality.<br />
<br />
<b><i>print $tv_horse->name, ' is ', $tv_horse->color, "\n";</i></b><br />
This line is using 2 APIs- <i><b>name</b></i> and <i><b>color</b></i>. But these are somehow different, we'll see that later.<br />
<br />
<br />
Now the file horse.pm (Module which was loaded in previous program):<br />
<br />
<i><b>package horse;<br /><br />use animal;<br /><br />use strict;<br />use vars qw(@ISA);<br /><br />our @ISA = qw(animal);<br /><br />1;</b></i><br />
<br />
There are no APIs defined in this package. However it is inheriting APIs from another package 'animal':<br />
<br />
<i><b>@ISA = qw(animal);</b></i><br />
This line will give error with <b><i>use strict</i></b> . So we have to use line:<br />
<br />
<i><b>use vars qw(@ISA);</b></i><br />
<br />
<a href="http://stackoverflow.com/questions/5293246/why-the-1-at-the-end-of-each-perl-package" target="_blank">In a package we should always return 1. </a><i><b> </b></i><br />
<i><b><br /></b></i>
Now file <i><b>animal</b></i>.pm, which contains all APIs:<br />
<br />
<i><b>package animal;<br /><br />use strict;<br /><br />sub named<br />{<br /> my $class = shift;<br /> my $name = shift;<br /> my $self = {<br /> name => $name,<br /> color => $class->default_color<br /> };<br /> bless $self, $class;<br />}<br /><br />sub default_color { "brown" }<br /><br />sub set_name<br />{<br /> my $self = shift;<br /> $self->{name} = shift;<br />}<br /><br />sub set_color<br />{<br /> my $self = shift;<br /> $self->{color} = shift;<br /><br />}<br /><br />sub name<br />{<br /> my $self = shift;<br /> ref $self ? $self->{name} : $self;<br />}<br /><br />sub color<br />{<br /> my $self = shift;<br /> ref $self ? $self->{color} : $self;<br />}<br /><br />1;</b></i><br />
<br />
if we think of our final script as follows, then it is very simple to write animal.pm:<br />
<br />
<i><b><i><b>Horse::named(Horse, 'Mr. Ed');<br /> $tv_horse::set_name($tv_horse, 'Mister Ed');<br /> $tv_horse::set_color($tv_horse, 'grey');<br /> $tv_horse::name($tv_horse); </b></i></b></i></div>
prateek goyalhttp://www.blogger.com/profile/12759918229607838781noreply@blogger.com0tag:blogger.com,1999:blog-2052393926104412994.post-82296049926828153672015-09-17T11:04:00.003-07:002015-09-17T11:04:33.788-07:00Choosing the right tool<div dir="ltr" style="text-align: left;" trbidi="on">
<br />I was reading a case study about choosing the automation tool for Google webmasters site in book "Experiences in Automation Testing". The team consisted only 2 members, out of which one was 90% involved in manual testing. They initially chose eggplant to automate their tests. Eggplant is a tool, which compares the captured images of GUI, and compares bit by bit. This was time consuming as well as posed some problems like:<br /><br />1. Whenever some text is changed in font, test fails, although there is no fault in product<br />2. If browser windows size is different at the time of testing, test will fail, even if everything is correct on product side<br />
<br />At the last they had to throw away all automation to change to new automation tool. So they chose web-driver (A tool developed in Google itself).<br />
<br />
<br />
<br />
Web driver is a part of Selenium 2.0.<br /><br />
Learning:<br /><br />1. Choosing automation tool greatly depends on System under test (SUT)<br />2. Unit test tests a small fragment of code, and does not access any external resources such as database.<br />
3. A good review of code can also also reduce bugs.<br />4. A good automation strategy focuses on the most important objectives for the automated tests.<br />5. Tool language plays great role in good automation.<br />6. tests that give immediate feedback to developers are the most useful to them, because that time they remember the most of they have developed.<br />7. Web-driver(part of selenium 2.0) works by examining HTML source returned from web server and by manipulating JavaScript. Most of testing involves finding HTML elements and then doing string comparisons looking for expected text.<br /><br /></div>
prateek goyalhttp://www.blogger.com/profile/12759918229607838781noreply@blogger.com0tag:blogger.com,1999:blog-2052393926104412994.post-7403590411533552302015-09-12T03:03:00.000-07:002015-09-12T03:03:26.748-07:00How browser works<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Where I learned:</b><br />
<br />
<b>Tali Gabriel</b>, an Israeli web developer, researched about browsers and went through many open source web browser's source code, and came up with the document about how browser works.<br />
<br />
She also studied about Web-Kit and Gecko, the browser engines. <br />
<br />
Browser is user interface for getting resources from web.<br />
How browser interprets and displays HTML file.<br />
<br />
<br />
<b>Mostly used Terms:</b><br />
<br />
Resources<br />
URI<br />
HTML5 and CSS specifications<br />
<br />
<b>Common things in all browsers:</b><br />
Address bar<br />
back and forward button<br />
favorites bar<br />
bookmarking options<br />
refresh and stop buttons<br />
home button<br />
<br />
<br />
<br />
<b>Browser high level architecture:</b><br />
User Interface<br />
browser engine<br />
rendering engine<br />
HTML parser<br />
HTTP<br />
JavaScript<br />
Back end UI<br />
networking<br />
Data persistence<br />
<br />
<br />
networking - to get the HTML document from server<br />
HTTP - protocol for transfer<br />
HTML - language browser understands<br />
<br />
<br />
<br />
DOM tree<br />
<br />
HTML is very forgiving language. It is not a context free grammar, so it needs a different parser.<br />
Other languages like JavaScript, XML etc. have context free grammar, that's why their parsers can be made from parser generators.<br />
<br />
There is a formal format for defining HTML, that is DTD (Document Type Defifnition)<br />
<br />
DOM tree is made by parsing of HTML. It is a object model representation of HTML. We can see this object representation in FireBug, a plugin for firefox.<br />
<br />
In my project, we do not use DOM tree much. It is used mainly in Web programming.<br />
<br />
In selenium, XPATH is of much importance. With almost all APIs we have to give Xpath to locate the object on web page.<br />
<br />
A good tutorial is on w3c site:<br />
<br />
http://www.w3schools.com/xsl/xpath_intro.asp<br />
<br />
I'll highlight main points of Xpath in other post. <br />
<br />
</div>
prateek goyalhttp://www.blogger.com/profile/12759918229607838781noreply@blogger.com0tag:blogger.com,1999:blog-2052393926104412994.post-81817079569201500882015-09-07T03:32:00.000-07:002015-09-20T09:33:03.025-07:00Object Oriented Perl<div dir="ltr" style="text-align: left;" trbidi="on">
<ul style="text-align: left;"></ul>
<b>All about OO in Perl:</b><br />
<ul style="text-align: left;">
<li>Perl's built-in OO system is very minimal. </li>
<li>Object oriented Perl is all about <b>"method invocation </b>(using '->' operator)<b>"</b>. </li>
<li>Perl's OO system is class-based, which is fairly common.</li>
<li><span style="background-color: white; display: inline ! important; float: none; font-family: "Helvetica Neue",Arial,Helvetica,Geneva,sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">In Perl, any package can be a class. The difference between a package which is a class and one which isn't is based on how the package is used.</span> </li>
<li><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">An <b>object </b>represents a single discrete thing.</span></li>
<li><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;"><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">A<span class="Apple-converted-space"> </span></span><b style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">class</b><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;"><span class="Apple-converted-space"> </span>defines the behavior of a category of objects.</span></span></li>
<li><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;"><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;"><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">All objects belong to a specific class.</span></span></span></li>
<li><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;"><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;"><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;"><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">When we want to create a specific object, we start with its class, and<span class="Apple-converted-space"> </span></span><b style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">construct</b><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;"><span class="Apple-converted-space"> </span>or<span class="Apple-converted-space"> </span></span><b style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">instantiate</b><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;"><span class="Apple-converted-space"> </span>an object.</span> </span> </span> </span></li>
</ul>
<br />
<b>Blessing:</b><br />
<br />
<ul style="text-align: left;">
<li><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">most Perl objects are hashes, but an object can be an instance of any Perl data type (scalar, array, etc.).</span></li>
<li><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;"><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">Turning a plain data structure into an object is done by<span class="Apple-converted-space"> </span></span><b style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">blessing</b><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;"><span class="Apple-converted-space"> </span>that data structure using Perl's<span class="Apple-converted-space"> </span></span><code class="inline" style="-webkit-text-stroke-width: 0px; background: rgb(238, 238, 221); border: 1px solid rgb(204, 204, 204); color: #515151; font-size: 1.2em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">bless</code><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;"><span class="Apple-converted-space"> </span>function.</span></span></li>
<li><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;"><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">we sometimes say that </span></span><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;"><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;"><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; display: inline !important; float: none; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12.8px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">an object has been "blessed into a class". </span> </span> </span></li>
</ul>
<b>Constructor:</b><br />
<br />
In Perl, constructor is just another method. <b>new </b>is used mostly as constructor name, but any other name can also be used.<br />
<br />
Class-based OO system terminology:<br />
<br />
Object (Instance of a class) = Data + Subroutine<br />
Attribute = Data<br />
Method = Subroutine <br />
<br />
Suppose there is a package "File". And there is subroutine in this package called "getname".<br />
<br />
If we are not using OO feature, then we have to call subroutine as:<br />
<br />
use File;<br />
File::getname(); <br />
<br />
<br />
If we are using OO feature, then File->getname(), invokes subroutine method in subroutine "File". Thus "getname "is object oriented version of subroutine:<br />
<br />
use File;<br />
File->getname(); <br />
And internally it is always invoked in the form of:<br />
<br />
Class::method('Class');<br />
<br />
And if there are some arguments, then:<br />
<br />
Class::method('Class', \%args);<br />
<br />
That's why, we write the methods as follows;<br />
<br />
Constructor example:<br />
<br />
Suppose there is a class or package Browser.pm and the constructor of this class is:<br />
<br />
sub new<br />
{<br />
my $class = shift;<br />
my $self = {<br />
sel => undef,<br />
JT => undef,<br />
DSID_CHECK => 1,<br />
proxy => undef,<br />
capabilities => undef,<br />
};<br />
bless( $self, $class );<br />
return $self; <br />
}<br />
<br />
<br />
Now we create an object of Browser as follows:<br />
<br />
use Browser;<br />
my $objBrowser = Browser->new();<br />
<br />
Now suppose there is one method login() in browser.pm and in other file we call it as:<br />
<br />
$objBrowser->login(\%args);<br />
<br />
Now internally, it will be called as:<br />
<br />
Browser::login($objBrowser, \%args); #object is passed as first argument<br />
<br />
So we have to write the login method in Browser.pm as follows:<br />
<br />
sub login<br />
{<br />
my $self = shift;<br />
my $args = shift;<br />
........<br />
........ <br />
}<br />
<br />
<br />
<br />
So we can define OO in perl as following simplae points:<br />
<br />
<b>1. A call like $obj->method(\%args) is internally called as: </b><br />
<b> $obj::method($obj, \%args)</b><br />
<b>2. bless $self, $class.</b><br />
<b> "bless", blesses $self into object of class $class, and returns $self.</b><br />
<b> $self contains reference data of object. </b><br />
<br />
The above 2 points will make OO understanding easy.</div>
prateek goyalhttp://www.blogger.com/profile/12759918229607838781noreply@blogger.com0Bengaluru, Karnataka, India12.9715987 77.59456269999998312.4764182 76.949115699999979 13.4667792 78.240009699999987tag:blogger.com,1999:blog-2052393926104412994.post-20413150610332804632015-09-04T08:08:00.002-07:002015-09-04T08:08:26.961-07:00Selenium and web driver API Introduction<div dir="ltr" style="text-align: left;" trbidi="on">
First Learning of Selenium as IDE:<br />
==========================<br />
I got first glimpse of Selenium in one video tutorial, when I wanted to change my profile from manual testing to automation testing. This tutorial was about Selenium IDE (A plugin for mozilla firefox browser to automate web testing, by recording the steps and rerunning them). That time I thought that Selenium was about "record and play" only.<br />
<br />
Selenium Webdriver<br />
===============<br />
But in my second project I came to know about selenium web-driver APIs.We use Selenium webdriver with perl.<br />
<br />
Webdriver APIs use native support for automation provided by browsers. I have to get the knowledge about this native support.<br />
<br />
A good resource can be the following:<br />
<br />
<a href="http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/" target="_blank">How Browsers Work</a><br />
<br />
<br /></div>
prateek goyalhttp://www.blogger.com/profile/12759918229607838781noreply@blogger.com0tag:blogger.com,1999:blog-2052393926104412994.post-57708201203667093792015-08-31T09:07:00.004-07:002015-08-31T09:07:45.515-07:00My first testing project<div dir="ltr" style="text-align: left;" trbidi="on">
My first project was CPE-QA for NetApp client. I was working in Tata Consultancy Services. My responsibility was to execute automated and manual test cases. It was functional testing and regression testing(black box testing), which we used to perform, therefore most of the test cases were automated and only few were to be performed manually. I worked on many features related to admin interfaces like RSH, SSH, Telnet, SNMP; licensing for storage product. But later I was also included in load and stress testing, debugging automated scripts written in Perl.<br />
<br />
From that point I got interest in learning Perl to get fully into Perl automation. I started reading scripts related to my area. These scripts were written in core perl.<br />
<br />
But, that time I was unable to understand the syntax, regular expressions, Perl idioms(small phrase like code in perl for doing something specific). So I started learning perl from some video tutorials on youtube, on google. Then I came to know about the reference book "Programming Perl"written by creator of perl, Larry Wall. It was of great help. from initial 4 chapters, I got to know most of the syntax of perl.<br />
<br />
Then I started doing some practice of perl from "Learning Perl" written by Randal Schwartz. Then I started fixing scripts in my project.<br />
<br />
But to practice creating new scripts, I wanted a project only for perl automation. So I left the project and started practicing perl at home. I did many exercises on internet, contributed in CPAN pull request challenge.<br />
<br />
Then I got a new project for client ""Pulse secure" (A company spin-off from Juniper). The product was SSL VPN gateway device and software. There, I automated many testsuites, related to SSL VPN client, SSO, Kerberos and licensing.<br />
<br />
I used following things in this project:<br />
<br />
Perl<br />
Selenium<br />
Eclipse<br />
Git<br />
AutoIT scripting<br />
<br />
We mainly used Framework APIs. Framework was created using selenium web driver APIs, using Perl module <a href="http://search.cpan.org/~gempesaw/Selenium-Remote-Driver-0.27/lib/Selenium/Remote/Driver.pm" target="_blank">Selenium::Remote::Driver</a>. </div>
prateek goyalhttp://www.blogger.com/profile/12759918229607838781noreply@blogger.com0