About Me

My photo
a Dynamic and Energetic guy.....

Sunday, December 20, 2009

BlackBox testing Vs. WhiteBox testing

White box testing refers to testing that works with the application's internals (or code). White box (or glass box) testing is typically done by developers using the IDE, debugger, and unit tests. This is going into the deep of logic & verifies the function.

Integration testing is considered functional, or black box, testing. Testers write test cases that indicate a given input into the application. Based on this input, they make assumptions about the output of the application. The testers then execute these integration tests as a black box. That is, they do not care about what happens inside the box (the code); they simply care that they get the expected results based on the given input.

Source:- 70-547 training kit book

Friday, December 18, 2009

Testing Our Code (As a Developer I Should)


Success baseline Start by defining a unit test that represents a common, successful path through your code. This test should represent the most likely scenario for executing your code.

Parameter mix Create a unit test that provides a varied mixture of parameters for a given method. This will ensure that more than just the success path works effectively. Consider creating this scenario as a data-driven unit test.

Bounds checking Create one or more unit tests that test the upper and lower limits of your code. That is, if your method takes a numeric value, you will want to test that method with values that represent both the upper and lower range of the data type.

Null values Make sure your unit tests measure what happens when null values are passed to a given method or property.

Error conditions Create unit tests that trigger error conditions in your code. You can tell the unit test that you expect a certain error as a result. If that error is not thrown, then the test will fail.

Code coverage scenarios Make sure that all the code in your method is called by one or more unit tests. You do not want untested code sitting inside of conditional statements. If this happens, write tests that hit those conditions inside your application code.



Best Practices

  • Write one test for each scenario you should test each outcome or scenario independently. If your method has a number of expected outcomes, write a test for each scenario.
  • Create atomic unit tests your unit tests should not require others tests (or a sequence of tests) to be run prior to their execution or as part of their execution.
  • Cover all conditions your unit tests should cover all cases. An effective set of unit tests covers every possible condition for a given method, including bounds checks, null values, exceptions, and conditional logic.
  • Run without configuration your unit tests should be easy to run (and rerun). They should not require setup or configuration. You do not want to define tests that require a specific environment every time you run your tests (or they will not be run). If setup is required, code that into a test-initialize script.
  • Test a common application state your unit tests should be run against a common, standard, good state. For example, if your application works with data, this data should be set to common state prior to the execution of each unit test. This ensures that one test is not causing an error in another test.

Source:- 70-547 training kit book

Sending Email Using Web.Config Entries in .NET

// Web.Config sample




<smtp from="website@website.com">

<network host="mail.website.com" password="" userName=""/>





// Code sample

using System.Net.Mail;

MailSettingsSectionGroup mailSettings = WebConfigurationManager.GetSection("system.net/

mailSettings") as MailSettingsSectionGroup;

protected void SendingEmail()


// Sending E-Mail

MailMessage message = new MailMessage(mailSettings.Smtp.From, WebConfigurationManager.AppSettings["RecipientList"], "Sending E-mail using web.config", "");

message.Priority = MailPriority.High;

SmtpClient smtp = new SmtpClient(mailSettings.Smtp.Network.Host);



Monday, December 7, 2009

Multi-tier Architecture in application development

We can categorize our n- tier architecture into 3 sections

  1. User Interface


    User interface code

    Business logic interaction code

  2. Middle Layer

    Business layer

    Application layer

    Database layer (This layer abstracts the retrieval and storage of data in your database)

  3. Database Layer

    Database layer

    Stored procedures

    Integration services

    Database tables, logs & indexes



MCPD (70-547) Designing and Developing Web-Based Applications Using the .NET Framework

Time Update using AJAX Controls







style="width: 100%; height: 100%; vertical-align: middle; text-align: center;">

<p>Current Time using AJAX control:</p>










function updateTime()

var label = document.getElementById('currentTime');

if (label) {

var time = (new Date()).localeFormat("T");
label.innerHTML = time;
window.setInterval(updateTime, 1000);



ASP.NET Concepts & theory

ASPX page execution order


Friday, December 4, 2009

Partial Methods in C#

This is a cool feature that comes with C#.
We can define a method & can omit the logic of that method, that is called Partial method.

If the implementation is not supplied, then the method and all calls to the method are removed at compile time.
This is useful as a way to customize generated code & the developer can work of same method without run-time problems. Because it is separated. We can validate data before it executes using these types of partial methods.

* Partial method should inside Partial Class
  • Partial method declarations must begin with the contextual keyword partial and the method must return void.

  • Partial methods can have ref but not out parameters.

  • Partial methods are implicitly private , and therefore they cannot be virtual.

// Code-generating tool defines a partial class, including
// two partial methods.
partial class ExampleClass
partial void onFindingMaxOutput();
partial void onFindingMinOutput();

// Developer implements one of the partial methods.
// Compiler
discards the signature of the other method.
partial class ExampleClass
partial void onFindingMaxOutput()
Console.WriteLine("Maximum has been found.");

My Masters