try...catch...finally...bloggg....: Conditional Compilation to Help

try...catch...finally...bloggg....

Thursday, April 21, 2005

Conditional Compilation to Help

I have been using this technique for quiet some time wanted to make this available to everyone who may be facing the problem. We used Canoo webtest for doing the functional and regression testing. I would say its pretty easy to write reusable testcases in the Canoo webtest as its based on XML. The tag set used is also relatively small and easy to get testcases written. Its one of the free tools which will get you started on the budget and is relatively stable than most other tools I evaluated. One of the problem I faced using Canoo webtest was it didnt support the link buttons which we were using in the site. I decided to go this way making all the site buttons to be got from a common base class which when compiled with the BUTTON as true will yield normal buttons which were supported in Canoo webtest and when compiled with BUTTON as false will yield the link buttons which was looking good in our site. Below is the code I use to acheive this.

1 using System;
2 using System.Web.UI;
3 using System.Web.UI.WebControls;
4 using System.Web.UI.HtmlControls;
5 using PeterBlum.VAM;
6
7 namespace KenPeople.JobBoard.Controls
8 {
9 /// <summary>
10 /// This is the button class used through out the project.
11 /// Since canoo webtest doesnt support link buttons we are
12 /// using this technique to test the application. When
13 /// compiled with the BUTTON value defined as true regular
14 /// buttons are rendered in the site. When deployment to
15 /// production after QA is completed compile without setting
16 /// the BUTTON variable so that link buttons are displayed.
17 /// </summary>
18 #if (BUTTON)
19 public class JobBoardButton : System.Web.UI.WebControls.Button {
20 #else
21 public class JobBoardButton : PeterBlum.VAM.LinkButton {
22 #end if
23 }
24 }

0 Comments:

Post a Comment

<< Home


·