Anand's profileDotNet NucleusBlogLists Tools Help
October 18

My New blog

Hi Dear Readers ,
I am not using this blog any more please visit my new blog https://anandkumar2004.wordpress.com/ 
June 23

VSTS-Team Build ( Part 2)

 
Hi All ,
 
Today I will talk about  how to create build ? .The initial step is to create  build type  this is nothing but 
 
1> Specify the solution(s) to build
2> Where to perform build
3> Where to copy the build output
4> Whether to perform unit test, code coverage or  code analysis or not , code etc
 
To create build type select Team Build option from  Team Explorer or from the Build menu this invokes the build type interface  , specify the name of your build ( it must be a unique  name ), the next step is to  select solution(s)  to  build .The solution(s) will be listed automatically  from the version control system  .One important thing to note here is ordering of your solutions  for build lets say project A is depend on Project B to build before it  then  you need to  move  project B on top and then Project A .After this operation you need to specify build configuration for each solution ( Release or Debug mode).The next step is to specify the build machine  nothing but where to build the application the  key note is the build machine must running  with  Team Foundation Build Service .Build service is a windows service that accepts requests from the team foundation server to execute a specified build type. The next sequence is to specify the build verification test  the short name is BVT .This nothing but  to execute a set of unit cases ( unit test project ) , run code coverage and code analysis tool to validate your  code quality and logical  errors. Now the final step is to execute build for this Select Build | Build (<Your Project Name>)  this displays Build Configuration dialog box , select build type which you want to run this trigger a request to  team build machine  ( via team foundation server ) the type you have selected  for build  and start execute the build process .
 
After the build process completes the result can be view through team builds report  ,it displays the build requests that have been processed,  success/failed  status for each solution(s) etc. Overall this is one of the key thing  in  SDLC and team build makes our job very  easy …..
 
June 20

VSTS-Team Build

Till now we have seen various development tools ship with VSTS  which help to  leverage our  development practices and maintain better code quality ,today I am going to talk about  another very important tool called “Team Build” which meant to build your project and perform some other tasks automatically as instructed while creating the  build .
 
Team Build is a part of Visual Studio Team Foundation and accessible to every  one. Broadly it is a new build engine that executes builds based on a set of instructions and tasks defined in an XML-based script  , run  unit cases, maintain versioning  and extensible etc (like Nant)  which makes our deployment process much more easy .MSBuild is extensible , flexible and tightly integrated with other VSTS tools and user friendly  wizard interface helps to create your initial build types  ,
the supported build types are
 
• Full Builds
• Partial Builds
• Nightly Builds
• Incremental Builds
 
Apart from this you can specify  the list of tasks to be perform as instruction for your build process as
 
1. Get the latest source  code  from version control
2. Compile sources
3. Run static analysis tool
4. Execute unit tests
5. Update work items
6. Perform code coverage
7. Calculate code churn
8. Produce  build reports
9. Drop  exe /output  into predefined location
 
These data (output) can be mentor through  team build report  , as you progress in your project development  you can analyze the report data of multiple version of build to check  & track  your project quality and health .
 
In my next article  I will explain how to  create build type .
 
Cheers
Anand
June 09

VSTS-TDD

 
Test Driven Development is the process to implement unit testing before a piece of code or application written .This helps in many ways like easily trace the code defects , reduce time spend in debugging the code , avoid logical errors , maintain code quality  and it gives confidence that  your code can handle any kind of critical  execution path  i.e. .it  builds confidence that the code  will works without any error .
 
TDD implemented through unit tests , this is nothing but  a series of  test cases that’s checks whether the business logic is functioning correctly and whether inputs produce the expected outputs. VSTS provides in-built support  for writing  unit test cases for  your code  by simple right click on your code and select Create Tests .This operation creates a test project with  skeleton of a unit test is generated for you the next step is to  add the test code that will be used to test the functionality of your code. You can view & manage test cases  from Test Manager window  ( Select Test| Window and select Test Manager ).The main purpose of test manager window is to view information about the tests in your solution. You can customize this view in various ways to see specific tests like view all the tests in your solution or just a filtered subset or  can group them by properties  or view them arranged in test lists. The final step is execute the test project the Test Result window show you  the result of your test cases.
 
Implementing unit test does not gives fully confidence that your code is a quality one ,. along  with writing the unit case its very important that your unit test must cover all code path this can be validated through  another tool called code coverage ,  job of this tool is to demonstrates which areas of your code were not covered by the unit tests. Once you run this tool just open your source code  the uncovered line highlighted in red and  code that was executed by a unit test highlighted in green. One important pointer most commonly we face is   your unit case execute a if condition of a piece of code and the else part marked in  red ( as uncovered ) so its important that your unit case project must covers all possible execution path of your code .
 
Unit testing and code coverage tools are very much useful  tool in our development activity , its gives strong confidence that your code will execute efficiently without any exception or runtime error.

Cheers
Anand
June 06

VSTS- Profiling

Profiling helps to analyze the bottleneck of  managed application like  how much  time taken to execute a particular method , where CLR took  major time inside your code, objects lifetime history , how much memory your application consumed and other performance related issues .This is the quickest way to check  health  of your application. Profiling  can be done in two ways
 
1. Sampling
2. Instrumentation
 
Sampling monitors the entire application and maintain the counter of  which method execute how many times , which method calls prior to the calling method (provide complete stack trace method call history) . Once you done with execution of application a sampling report will generates out of profiling data, this can be viewed through reporting feature  integrated within  IDE  .This approach helps to collect  the performance related  issue by simulating  the actual  production environment .The main disadvantages is that it can only get relative performance data for the method  that were sampled. It is possible that a method  you wanted to sample did not get sampled and therefore, no information is available about it.
 
The instrumentation method is more persistent than the sampling  In this approach  the profiler inserts enter and exit probes into specific method  of  your application i.e instrumentation provides the advantage of gathering exact performance data for specific portions of the application. During instrumentation, enter and exit probes are inserted into the application's functions.
 
To perform instrument or profiling click on Tool| Performance Tools and select Performance Wizard . Profiling can be view through  performance explorer . The Performance Explorer presents hierarchical structure to the user. This  has two node   Targets and Reports . Targets node contains one or more targets such as an .EXE, .DLL, or ASP.NET application. Reports node contains all the reports that are relevant to a particular Performance Session. Once the application finishes executing, a performance session report is automatically added to the Reports node.
 
While you are working with sampling or instrumentation both looks like the same but the main different is sampling captures program state by sampling at specified intervals  like  clock cycles or page faults where as instrumentation inserts probes into your code to catch every single function call made by your program.. Instrumentation profiler provides more specific and reliable information than the sampling method, this is one of  the key tool to use at critical intervals during the development process
 
Cheers
Anand
May 29

static analysis tool

VSTS  provides a very interesting tool called static analysis  tool  which helps to maintain better code quality .This tool is nothing but the advancement  of  FXCop . static analyzer examines managed  assembly  against a checklist know as rules , report the defects and poor programming practices based on these  rules. Static analyzer ships with variety of rules like design rules ,globalization rules , naming rules , performance rules and many more . These rules are extendable by the developer that means you can define your  application/project specific rules (custom rule)  and run against the code. This is not mandatory that your code must follow all  rules , its up to us to select all or few of  them  for  example  globalization is may not necessary/applicable to your application but naming convention or security rule is important then select these two rules and run against your code.
To specify the rules for you application , click on project property | Code Analysis Tab   .Select  all  or applicable rules  and make sure you have select enable Code Analysis check box .The next step is recompile your code and the code analyzer report the  defects in the error window.This tool is very much helpful to avoid bad coding practices .
 
Cheers
Anand
May 26

VSTS Tool -PREFast

 
VSTS provides  various analysis tool that helps developers to
1> Perform defect tracing and fix the code defects
2> Detect performance issues before setup  the application in production environment
This also helps the team to control the SDLC process efficiently and effectively
Analysis tools are broadly categorize into 2 parts
1> Code Analysis Tools
2> Performance Tools

VSTS  ships with various code analysis tools PREfast  is one of them .PREfast is a handy tool for C/C++  developers , this helps in tracking defect of C/C++ source code  such as buffer overrun ,un-initialized memory ,null pointer and memory /resource leaks . You can enable PREFast easily  by select YES/Prefast in the project’s property page
Once you enable PREFast  the errors and warnings are appear in ErrorList Windows during build process .Another advantages of PREFast is annotation support , its nothing but check the method parameters and return type for example
#include </prefast/SourceAnnotations.h>
[SA_POST(MultiCheck=SA_YES)]
int TotalVal(int nStartRange , int nEndRange)
{....}
[SA_POST(MultiCheck=SA_YES)] :- Returns caller to check the return value of Total Val .
Alternatively you can use PREFast  from command  prompt
C:\>ls /Prefast MySample.cpp
 
Cheers
Anand
May 25

Best Practices of Compact Framework

Recently I have compiled an article on performance optimization for compact framework click here to view the article

 

Cheers

Anand

October 21

Whats new in Enterprise Library 2.0

Microsoft P&P team is more focusing on  comparability issues of  Enterprise Library. We are facing  problems in running  application on FX 2.0 platform that builds on January 2005 release of Enterprise Library and the good new is June 2005 release of Enterprise Library eliminates this problem to know more about it click here
 
October 20

10 Things You Shouldn't Do with SQL Server

Nice article click here to view the article