ISTQB Certified Software Test Engineer

Wednesday, July 27, 2011

Mock Objects for quick Unit Testing

For large or smalle Code of Applications it is Programmers job to test their code.Unit Testing one of the levels in Software Testing is purely for the developers.They have to write unit tests and they have to examine(test) their code.

A good unit test case is a small piece of code(mostly written in a single method)which is for testing specific functionality.In Large,complex well designed systems different objects have to work together to accomplish a particular task.
For example in order to write a simple test case to verify Login functionality user name and password has to be taken from database and using these as inputs test case has to be executed.

So if we are using database we have to create many objects(eg:Objects for Prepared statements,Result Set,DB Connection etc..).It is a complicated task to create some 'N' objects for testing simple unit test case.Creating these 'N' doesn't make our unit test to be completed in quick time.

Mock Objects are the Objects which Pretended to be as Real Objects makes this process easier.A mock object is a replacement for a real object that we create for the express purpose of testing. Mock objects were championed by Tim Mackinnon, Steve Freeman, and Philip Craig


There are Many Frameworks for effective usage of mock objectes in our unit tests like JMock,Mockito,EasyMock etc..

Tuesday, July 26, 2011

FITNESSE A USER ACCEPTANCE TESTING TOOL


What is User Acceptance Testing?

User Acceptance Testing is often the final step before rolling out the application. Usually the end users who will be using the applications test the application before ‘accepting’ the application. This type of testing gives the end users the confidence that the application being delivered to them meets their requirements.
User Acceptance Testing – How to Test?
The user acceptance testing is usually a black box type of testing. In other words, the focus is on the functionality and the usability of the application rather than the technical aspects. It is generally assumed that the application would have already undergone Unit, Integration and System Level Testing.
However, it is useful if the User acceptance Testing is carried out in an environment that closely resembles the real world or production environment.
The steps taken for User Acceptance Testing typically involve one or more of the following:
.......1) User Acceptance Test (UAT) Planning
.......2) Designing UA Test Cases
.......3) Selecting a Team that would execute the (UAT) Test Cases
.......4) Executing Test Cases
.......5) Documenting the Defects found during UAT
.......6) Resolving the issues/Bug Fixing
.......7) Sign Off
What is Fitnesse?
FitNesse is a web server, a wiki, and an automated testing tool for software. It is based on Framework for Integrated Test (FIT). FitNesse is designed to support acceptance testing. Fitnesse allows users of a developed system to enter specially formatted input. This input is interpreted and tests are created automatically. These tests are then executed by the system and output is returned back to the user. The advantage of this approach is very fast feedback from users. The developer of the system to be tested needs to provide some support (classes named "fixtures").

Monday, June 27, 2011

IE Script Error while running Selenium RC


Today while running Selenium RC in IE8 in windows 7 i have got this error.I googled to find a solution for the above error and atlast i was passed.
1.Open command prompt and run it in adminstartor mode.
Right click on CMD and click on Run as Administrator




2.Run Selenium server jar and continue running your tests.

Script error will be fixed and we will get a result

Friday, January 7, 2011

CSS Conditional comments

Cascading style sheets(CSS) conditional comments are used to fix browser issues.They work only for windows ie.Other browsers treat these lines of code as commnets except ie due to their syntax.Here is the example
<!--
<!--[if IE 6]>
.header{
width:600px;
}<![endif]-->
-->

The above piece of code should be added in head section of the html file.
For example if we set the width to 700px in ie6 the width will be reset to 600px due to this conditional comments.
So we can solve ie cross browser issues using this by writing styles individually for each ie.
U can have clear idea on this conditional comments with this example
<p><!--[if IE]>
According to the conditional comment this is Internet Explorer<br />
<![endif]-->
<!--[if IE 5]>
According to the conditional comment this is Internet Explorer 5<br />
<![endif]-->
<!--[if IE 5.0]>
According to the conditional comment this is Internet Explorer 5.0<br />
<![endif]-->
<!--[if IE 5.5]>
According to the conditional comment this is Internet Explorer 5.5<br />
<![endif]-->
<!--[if IE 6]>
According to the conditional comment this is Internet Explorer 6<br />
<![endif]-->
<!--[if IE 7]>
According to the conditional comment this is Internet Explorer 7<br />
<![endif]-->
<!--[if gte IE 5]>
According to the conditional comment this is Internet Explorer 5 and up<br />
<![endif]-->
<!--[if lt IE 6]>
According to the conditional comment this is Internet Explorer lower than 6<br />
<![endif]-->
<!--[if lte IE 5.5]>
According to the conditional comment this is Internet Explorer lower or equal to 5.5<br />
<![endif]-->
<!--[if gt IE 6]>
According to the conditional comment this is Internet Explorer greater than 6<br />
<![endif]-->
</p>


Copy the above code and save in html file and run the html file in different ie versions,so that u can clearly understand coditional comments

Friday, November 19, 2010

How to Block a website access in your machine

How can we block access to Orkut in our machine?Even if we are trying to access ,it should not open...

This is a doubt and order from one of my friends.So I have to answer him,googled and found a solution for this .Blocked orkut in my laptop.

Here is the solution
In
C:>WIndows>system32>drivers>etc

we will find a file called hosts.

Open this file with notepad.Just append this line at the end of file

127.0.0.1 (domain name or url u want to block)

for example 127.0.0.1 www.orkut.com.

Open any of the browsers and try to access orkut now,it will show oops the site u r trying to access is wrong(Not exactly this message,some kind of message like this)

It will work only if we access the site using domain name.If we are using ip this technique will not work.

Again if you want to give access to the blocked site just remove the added entry in hosts file.

Brb.... :)

Wednesday, November 17, 2010

Difefrence between Verify and Assert in Selenium

In selenium while using IDE or RC we will find two methods for

1.Verification
2.Assertion

We know that both are used to find whether a given text(input) was present or not in the loaded(opened)webpage,but why there are two methods defined when they are behaving in a same manner??

There is a difference between these two methods

When we are executing a testcase of 10 lines(assume a testscript of 10 lines in which we used both verify (4line)and assert(6 line)),When Verify text failed(means the input text was not there in the loaded page) it gives the test result as failed but all the steps after this Verify statement were executed till the end of the scrpit.

Coming to Assert if assertion failed, testcase aborted from that line and will stop executing the remaining statements in the script

:)

Monday, November 15, 2010

Test Automation Framework

A framework is an integrated system that sets the rules of Automation of a specific product. This system integrates the function libraries, test data sources, object details and various reusable modules. These components act as small building blocks which need to be assembled to represent a business process. The framework provides the basis of test automation and simplifies the automation effort.

These are the various types of automation frameworks

Data-driven testing:Test Scripts are executed based on the data

Modularity-driven testing :Test Scripts are created based on small and independent modules

Keyword-driven testing :
The keyword-driven testing methodology divides test creation into two stages:-

Planning Stage
A simple keyword (one action on one object), e.g. entering a username into a textfield

Implementation Stage

or test designers (who don’t have to know how to program) write test cases based on the keywords defined in the planning stage that have been implemented by the engineers. The test is executed using a driver that reads the keywords and executes the corresponding code.

Hybrid testing :The hybrid Test Automation Framework is what most frameworks evolve into over time and multiple projects


Model-based testing: Model-based testing is the application of Model based design for designing and executing the necessary artifacts to perform software testing. This is achieved by having a model that describes all aspects of the testing data, mainly the test cases and the test execution environment. Usually, the testing model is derived in whole or in part from a model that describes some (usually functional) aspects of the system under test (SUT).

Will update each approach in detail :)