Articles On Testing

Wecome to http://www.articlesontesting.com !!!

Articles On Testing

Wecome to http://www.articlesontesting.com !!!

Articles On Testing

Wecome to http://www.articlesontesting.com !!!

Articles On Testing

Wecome to http://www.articlesontesting.com !!!

Articles On Testing

Wecome to http://www.articlesontesting.com !!!

How do you Test a database split

What is a database split ?
When do we really come across with such a business scenario in our enterprise business ?
What is it that holds paramount importance in planning and strategizing the testing activities in such an application ?
How does the test related timelines impact the overall estimation in such a project ?
What are the areas of scope which have scope of optimization in test estimation of such project ?

I hope this post is best suited for your expectation to be met in case these are the areas of your interest when browsing through this post .

Database split is nothing but separation of a single entity into two child entities just the similar way an amoeba fission is known to occur. Here in the risk involved may be as high as ad infinitum in case there is some legal aspects involved .
So the best approach to test is validate the data that has been entered in the child databases. Only relevant data should get loaded into each of the respective sinister databases.
Bring in the approach of database test automation for validation of data content using the rowcount and datacheck as we discussed in a previous article listed as under.

http://www.articlesontesting.com/2012/06/etl-testing-in-business-intelligence.html

By following the approach mentioned in this article you can reduce heavily in test execution timelines. Scripting of the queries is a one time activity and you can use it in all subsequent cycles. Also the script preparation is a parallel activity and can be done during the course of development pahse itself. there is no need to maintain any test case document as well as the dbunit test scripts are themselves self explanatory. however in some cases depending on customer's expectation, some comments in the dbunits test script itslef can be provided.
Do you know how long it takes for the scripts to run ?
One script runs in times of milliseconds.
I ran close to ten databases split operation testing in five minutes and results were logged into TFS.
This included close to 450 tables validation with close to query counts in the range of 1275 odd !!!
And all was done in minutes. However you would have taken close to four man days for validation of tables to extent of these by manually executing these queries in sql management studio.

Enjoy smart test execution technique by implementing the dbunit test of visual studio 2010, while in 2012 version has been separately labelled as SqlDatabaseUnit test and you need to install the SSDT along with the Visual Studio 2012 IDE.

You will really have a ease of time handling this project, but without this approach the time taken for verification is just way high and not a feasible approach in the current trending industry.

Do post your queries and I shall help you get them answered herein asap.

AJAX Tab container control: For displaying content in tab style

A very common scenario  in web disign is to display two or more form in tab format.
Means instead of filling one form completely and then proceeding to next form we can access multiple form at a time using 
AJAX Tab container control.
We need to write below code.

  
ASPX page:

  <asp:TabContainer ID="tabCont" runat="server" ActiveTabIndex="0" Width="100%"  AutoPostBack="true"
                onactivetabchanged="tabCont_ActiveTabChanged" >
              <asp:TabPanel ID="tab1" runat="server"  HeaderText="General Details">
                <ContentTemplate>
                                   ..........
                 </ContentTemplate>
              </asp:TabPanel>
              <asp:TabPanel ID="tab2" runat="server" HeaderText="EmployerDetails" >
                <ContentTemplate>
                                     ..................
                 </ContentTemplate>
              </asp:TabPanel>
  </asp:TabContainer>


ASPX.CS page:

  protected void tabCont_ActiveTabChanged(object sender, EventArgs e)
      {
          if (tabCont.ActiveTab.HeaderText == "General Details")
          {                    
              tabCont.ActiveTabIndex = 0;
          }
          else if (tabCont.ActiveTab.HeaderText == "EmployerDetails")
           {
          tabCont.ActiveTabIndex = 1;
           }
      }

Dynamically adjust the size of a drop-down list in c# .net using javascript


A very common scenario  in C# programming for web controls we come across is the topic of description in this article. 
How do I dynamically adjust the size of a dropdown list using Javascript ?

There are many possible ways to visualie a working solution for the same but let us go through the one I prefer the most.

First we will try the use of “oncontextmenu”, this event gets fired when the we click on the control. Once we click the control, we invoke a Javascript function to increase the width of the drop-down list. If the width is initially less, then we increase it to the maximum. If the width is currently maximum, then or right-click we need to again resize the control .

<html xmlns="http://www.w3.org/1999/xhtml">
  <head id="Head1" runat="server">
  <title>Dynamic Size of ddl</title> 
 <script type="text/javascript"> 
function fnSize(ddlobj)
 { 
 if(ddlobj.style.width != "100px")  
{
ddlobj .style.width = "100"
 }
 else 
{
 ddlobj.style.width = "50"
 }
 } 
 </script>
  </head> 
 <body> 
 <form id="form1" runat="server">
<asp:DropDownList  id="ddlSize" runat="server" oncontextmenu="fnSize(this);"></asp:DropDownList>
 </form>
  </body> 
 </html>

 Above mentioned function will increase or decrease the width of ddl but size will be static, means not dependent on the listitem while binding dynamically from datatable or any other datasource. 

So, we will replace the above mentioned method as follows:

The select object has many events. we will use onmouseover,onblur and onchange.
 
onchange event is fired when the contents are committed(object or selection have changed.) and not while the value is changing. This event is executed before the code specified by onblur when the control is also losing the focus.The onchange event does not fire when the selected option of the select object is changed programmatically.

onmouseover event fires only if the mouse pointer is outside the boundaries of the object and the user moves the mouse pointer inside the boundaries of the object. If the mouse pointer is currently inside the boundaries of the object, for the event to fire, the user must move the mouse pointer outside the boundaries of the object and then back inside the boundaries of the object.


The onblur event fires on the original object before the onfocus or onclick event fires on the object that is receiving focus.

on these three events we will call our function to manipulate the size of dropdownlist dynamically.

<html xmlns="http://www.w3.org/1999/xhtml">
 <head id="Head1" runat="server">
  <title>Dynamic Size of ddl</title> 
 <script type="text/javascript">
 var spacer = null;
        var curObj = null;
        function openSize(obj) {
            if (spacer) return;
            spacer = document.createElement("span");
            spacer.style.width = obj.offsetWidth;
            spacer.style.height = obj.offsetHeight;
            spacer.style.display = "none";
            obj.parentNode.insertBefore(spacer, obj);
            obj.style.left = getSize(obj, "Left");
            obj.style.top = getSize(obj, "Top");
            obj.style.position = "absolute";
            obj.style.width = obj.scrollWidth;
            obj.focus();
            spacer.style.display = "inline";
            curObj = obj;
        }
        function close() {
            if (spacer) {
                spacer.parentNode.removeChild(spacer);
                spacer = null;
            }
            if (curObj) {
                curObj.style.width = "100px";
                curObj.style.position = "static";
            }
        }
        function getSize(o, p) {
            var i = 0; while (o != null)
            { i += o["offset" + p]; o = o.offsetParent; }
            return (i + 4);
        }
 </script>
  </head>
 <body>
 <form id="form1" runat="server">

  <asp:DropDownList ID="ddlSize" runat="server"  onmouseenter="openSize(this)"
                                onchange="close()" onblur="close()">    </asp:DropDownList>

 </form>
  </body>
 </html>
 

 Using above code, we can adjust size of drop down list at the time of selection dynamically.
Enjoy learning !!!

Default button in asp.net with master page

One of the most important thing in developing web pages is handling the "Enter key" for form submission or making the button which we provide Button to click on as default button, there are many easiest ways but sometime its becomes a little tricky using master page with button in panel.
ASP.NET introduces "defaultbutton" property to the ID of the Button, whose event we want to fire, our job is done. By using this property we can make our button as default button.
In page load we need to just write the below code:

 protected void Page_Load(object sender, EventArgs e)
    {

         this.Page.Form.DefaultButton = yourbuttonid.UniqueID;
    }