Archive

Posts Tagged ‘.net’

Test-Driven Devlopment (TDD)

April 12, 2010 Leave a comment

Please don’t think that Test-Driven development(TDD) is relevent to Testing. Because the name suggest you to think like that. It’s absolutely far away from testing. Okay, keep reading and you will have an idea on TDD. Here i just describing it on the basis of some documents got from BASIS OOP training programs. i am lucky because i completed that course. Now i am going to explain

what is Test-Driven Development :

Is a Test-First approach (Write the test-code first and then write the dev-code)
It leads to think about ‘How to use a component’ first and then about ‘How to implement’.
As much about design technique as testing TDD technique.
As much about (executable) documentation as testing

so, that’s the summary of TDD. TDD is about writing the development code through test code. At the very beginning we there are some story(User Story) and depending on those story we  will implement. So from the story we should find out the components and then implement the application on those components. please don’t write any code by thinking  what will happen in future? Then you are not in TDD. Because TDD insists to write exactly what we need not what we will need.Thsee are almost the principle of TDD.

Principles of TDD

Kent Beck defines:

• Never write a single line of code unless youhave a failing automated test.
• Eliminate duplication.

Red (Automated test fail)

Green (Automated test pass because dev code has been written)

Refactor (Eliminate duplication, Clean the code)

well  those are the principles of TDD. Think, you are yet confused. Trying to make it clear.

Actually  Red/Green/Refactor defines the process for implementing each test in the test list. The goal of this process is to work in small, verifiable steps that provide immediate feedback. William Wake, in his book Extreme Programming Explored (Addison-Wesley, 2001), details the programming tasks as follows: Read more…

Categories: Software Crafting Tags: , ,

ASP.NET Tracing

March 25, 2010 Leave a comment

With tracing, you can access data from a running application, with the help of a browser. In ASP.NET, you can access to the following information:

  • The details of the request
  • Trace information: performance information of the Web page’s life cycle events
  • Control tree: size information about controls.
  • Session state: displays session variables and values
  • Application state: displays application variables and their values
  • Request cookie collection: list of cookies passed to the server as part of the request
  • Response cookie collections: list of cookies passed to the browser as part of the response
  • Headers collection: the list of HTTP headers sent with the request
  • Form collection: postback values.
  • QueryString collection: the variables of the query string.
  • Server variables: all server variables.

To enable tracing, you have two options: enable tracing for single pages, or for the whole application. To enable page tracing, you should set the Trace property to true in the @Page directive. Also, you can set it in code-behind, with the Page.Trace.IsEnabled = true; syntax. At page level, you can also include a TraceMode property, which sets the sort order of trace information, by time, or by category. When you set tracing at the page level, the trace output will be added to your page, so never implement this behavior in production applications.

To enable tracing for the whole application, you should modify the web.config as follows:

<system.web>
<trace ebabled=”true” requestLimit=”100” pageOutput=”false” ceMode=”sortByCategory”  localOnly=”true” mostRecent=”false” />
</system.web>

Attributes of Trace
Enabled Enable or disable tracing on the application level. This behavior can be overridden by independent pages, using the @Page directive. To enable tracing on specific pages, when application-level tracing is disabled, set the pageOutput attribute accordingly.
traceMode The possible values are SortByTime, which sorts the tracing information by time, or SortByCategory.
localOnly Decides whether tracing information should be provided just for local clients, or everyone else. Always set to true when publishing your application.
pageOutput Determines whether the tracing information should be included for pages or not. When set to false, you can view trace data in the Trace.axd site on the root level.
requestLimit Specifies the number of HTTP requests to be traced. Maximum us 10.000. Works only when application level tracing is enabled.
mostRecent Determines whether the most recent number of HTTP request should be stored in the trace information, or only the first requsetLimit number of requests.
writeToDiagnosticsTrace If set to true, tracing information will be forwarded to any trace listeners signed up to your application.

When enabled, application-level trace information can be viewed by requesting Trace.axd in the root of the application.

You can add your own tracing messages to the output, simply calling Trace.Write(string Category, string Message) or Trace.Warn(string Category, string Message). The only difference between the two is that Trace.Warn shows your message written with red letters.

Categories: ASP.NET Tags: ,
Follow

Get every new post delivered to your Inbox.