Friday, August 20, 2010

Knowing the bug

Testing involve many activities like finding issues,reporting status,exploring,understanding  your application and may be more. Among all I personally like  debugging or troubleshooting the bug. Some people might say that it is not tester's job and tester's job is to just report the issue. I don't want to argue on that but I would like to say that knowing and finding root cause of bugs help me in following ways,


-That experienced can be used when you test similar set of application.
- If you are aware that you are going to hit same bug with newly design feature, you can very well give your input at design time.
-You will get to know more about internals of AUT, which will help you to isolate bugs  and make your bug report stronger.

I love to find the root cause of bugs  before reporting the bug. I have developed some debugging experience  but if some new features going to come I always like to question developer. Question will be "How they will go about debugging if they found some bug in the new feature". We can use that information as much as possible until it is not that related to code debugging. I would like to put some debugging experience with web application which can be used in general. I also use this technique to isolate bugs. Suppose you hit issue while testing web based application.


-First thing will be to divide it in two parts. Issue can be either server side issue or client side issue .
Server side debugging can be started started with server logs. There can be two types of server logs for web based application
  • Web Server logs :-Sometimes these logs are useful to identify what type of HTTP request is coming to server. There are status code for each type of HTTP response, So if your application works over HTTP then status code can help you to check if every request coming from client is fine. You can make out from this logs that issue is client side or server side.
  • Application server logs :- Logs generated by application and often Application server  logs + Web server logs are combined to form one log. Logging in debug mode helps to find out any exception or error. Exceptions throws stack trace, which highlight origin of error. You can follow the stacktrace and if you have little bit idea of the code you can find the actual root cause of issue.
If you cannot find issue in server side then you can try debugging in client side.For web based client side application you will find most issues related to javascript.To debug that
-Firefox has Error console or you can use Firebug as Firefox extension, which gives fare amount of understanding of script errors.
-Chrome comes with embedded developer tools for debugging javascript errors.

It is always good to question your developers about debugging. Tester are the one to see the issues in first place, so they can be one of best person to debug and this can help you avoid getting "bug not reproducible" responses  from development.









Wednesday, August 4, 2010

Browser compatibility what i understood

Now a days most of desktop based application moving towards web based. I guess everyone sometime or other get to test web applications.

Assuming your web AUT(application under test) has lot of features which will result in huge number of testcases.  Let's say  AUT has hundreds of testcases as it has been the case for me, most of time. Basic requirement for test team is to make sure all features works fine on every web browser we support. Best way to achieve this is to run every testcase on every browser which will be an exhaustive way. I really don't like this way and I feel there should be a way to optimize this. Validating your web application for all web browser is callled cross-browser compatibility thats what i am going to focus on .


From my experience what  I have discovered is that there are two areas where behavior of your application changes from browser to browser. If I concentrate on those two areas then I can optimize  on testing for browser compatibility.


 Those areas are
  1. CSS 
  2. Javascript
  • CSS  is guidelines which tells browser how to display your page. These guidelines are stored  in a file( with .css extension) with web pages.There are standard for these guideline but different browser interpret these files differently, which causes your web pages  to display incorrectly. Most common issue you will find  due to CSS are,
    • label size not proper.
    • Text font vary across browser.
    • pop-up menu does not render properly. In general you can say all UI rendering issues.
         To find CSS issues,
    • navigate through  all pages/dialog box  and popup menus  on your web application.If there is any UI problem  due to CSS  you will easily observe it .
  •  Javascript is scripting language for browsers  to perform some dynamic operation on browser.Usually inputs given by user can be processed immediately on browser itself rather getting it processed from server .Every browser has there own javascript engine and browser sometimes fail to execute these javascripts in runtime.  Issues mostly due to javascript  are,
    • WebElements(links,buttons and images etc ) calling javascript does not work at all
          To find issues related to javascript,
    • Test all links which call javascript or uses javascript in some way .You can use developer tool like firebug .Firebug is add-on to firefox which helps you see internal of web pages you are browsing

According to me, if you attack these two areas you  can optimize on browser compatibility and avoid  running every  testcase on every browser.

Tuesday, July 13, 2010

When to automate? is equally important

Dhanasekar S's  recent blog which differentiates between importance of manual testing and automation testing triggered this blog. With all my automation experience I can say that there is one thing important in automation according to me.
That is 'When to Automate?'
As James Bach says "Test automation is any use of tools to aid testing". That is very much true, but to identify what are those tools and when to automate  is usually difficult job for me .So I came up with the following parameters to find out when to automate .  
  1. When I am doing any manual task repetitively , e.g.
    1.  Creating data set for my application.
    2.  Running same configuration every time after preparing the setup.
    3.  Even doing ssh(remote login) to same IP  frequently.
  2.  Smoke Testcases which need to be run  with every new build:- This case is also kind of a repetitive task where you need to run scripted testcases every time a new build comes. It is good to automate these as they give you more time to explore new areas in your application.


    I  would like to cite an example related to case 1 .
    Recently , I started writing testcases  for new features using mindmaps. Mind maps gives better overview of my testcases and their coverage.It also helps me getting quick review from development team .

    But the issue is when I need to write all my testcases again to my test management tool ie Testopia. Let me tell you about Testopia ,Testopia is awesome test management tool from mozilla which provide api's over XML::RPC  to update /modify  testcase database. 
    Anyways my above task was repetitive and obviously  boring which provoked me to  write a perl script to  parse test cases from mind map's file and directly update in Testopia. "Same script can be used in future" was also an another trigger point to automate the task. Scripts to achieve the above task got ready in just 45 minutes  and I updated 100+ testcases with the script to Testopia. In the above scenario I was not told to automate.When I felt bored with coping testcases , I decided to automate the Testopia update task and  that was my call .Many of my tester friends told me that they don't have any exposure to automation because management never told them to do any. According to me ,when to automate and what to automate  should come from tester and not from management. I usually see test managers  giving importance to the automation tools in a tester's skill set but according to me knowing when to automate is equally important as knowing the tools.

    Tuesday, June 8, 2010

    Selenium Webdriver running remotely

    Recently i started developing my automation code using Selenium2 code .Most of my code is for firefox driver .I need to confess that i liked Selenium2 really there are some stability issues in comparison to Selenium1 but it is good .

    Default usage of Selenium2 is that it will run server and client from same instance and that will control the browser elements,but Selenium2 provide a way to run server and client on remote location as you use to do in Selenium1.Remote Webdriver is the class which help you to run client and server separately .RemoteWebdriver provides a DriverServlet which if you add inside any servlet container you got your selenium server up.
    There are few examples for this in Selenium2 wiki site .As i have never ran servlet application before so i got in to little bit of issues following that .But finally i got it running and i used jetty as servlet container .Two ways you can include that in jetty

    1.Run jetty server on machine and put a war file on location pointed by jetty config file .
    2.Start jetty server from your application and add you servlet class to it .(I followed this method)

    I downloaded the selenium2 code and built remotewebdriver werver and client.
    command to built server
    ./go clean selenium-java selenium-server-standalone which will result in build/remote/server/server-standalone.jar
    command to built client
    ./go //remote/client:client:uber which will result in build/remote/client/client-standalone.jar
    *go is script comes with selenium2 code and code below i got it from wiki just made few changes .

    Server code
    AppServer.java
    =============================================
    import org.mortbay.jetty.Server;
    import org.mortbay.jetty.nio.SelectChannelConnector;
    import org.mortbay.jetty.webapp.WebAppContext;

    import java.io.File;

    import org.openqa.selenium.remote.server.DriverServlet;

    public class AppServer {

    public static void main(String s[]) throws Exception{
    Server server = new Server();


    WebAppContext context = new WebAppContext();
    context.setContextPath("");
    File st=new File(".");

    context.setWar(st.getPath());
    server.addHandler(context);

    context.addServlet(DriverServlet.class, "/wd/*");

    SelectChannelConnector connector = new SelectChannelConnector();
    connector.setPort(3002);
    server.addConnector(connector);

    server.start();
    }
    }
    ================================
    Add server-standalone.jar ,jetty-6.1.9.jar and jetty-util-5.1.9.jar(you can download from jetty site or selenium2 code also has in third_party folder) to classpath and run above code.
    Your server will up with following message ---
    2010-06-08 11:07:00.730::INFO: Started SelectChannelConnector@0.0.0.0:3002

    Client example code
    FirefoxClient.java
    ================================
    import java.net.URL;
    import org.openqa.selenium.remote.DesiredCapabilities;
    import org.openqa.selenium.remote.RemoteWebDriver;
    import org.openqa.selenium.WebDriver;

    public class FirefoxClient {

    public static void main(String s[]) throws Exception {

    URL url=new URL("http://127.0.0.1:3002/wd");
    DesiredCapabilities capabilities = new DesiredCapabilities();

    // ... but only if it supports javascript
    capabilities.setJavascriptEnabled(true);
    capabilities.setBrowserName("firefox");

    // Get a handle to the driver. This will throw an exception
    // if a matching driver cannot be located
    WebDriver driver = new RemoteWebDriver(url,capabilities);

    // Query the driver to find out more information
    //Capabilities actualCapabilities = ((RemoteWebDriver) driver).getCapabilities();

    // And now use it
    driver.get("http://www.google.com");
    }

    }
    =====================================
    Add client-standalone.jar to class path and run the above code .

    Friday, June 4, 2010

    motivation for Tester

    I was thinking what use to be the biggest motivation for me to deliver good quality of software i test .Is it appreciation from my manger or from my peers or from fellow developers when they appreciate about the how good the bug i reported.

    Yes these things motivate me too bu the thing which motivate me most is fixing of bug i reported .There how it goes whenever i file a bug(lets say critical) for any feature and if i try to find any other bug on that feature it is always difficult to find .Most of time i cannot go beyond my earlier bug i know it is not good for a tester but i guess it is psychological effect which does not allow me to see beyond .

    So keep me motivated i need my earlier bugs to be fixed and that is the biggest motivation for any tester .Once you get your bugs fixed you will be interested in testing more, to get more issues .