29 July 2004

Web Page Unit Tests

Web page Unit Tests is the process of testing your pages, to validate the controls state and the scripts developed.
You need to bypass the browser and access your site from the test code.
Tools for developing unit tests for web pages are available for the most common languages. These tools emulate the browser behavior and allow you to examine the pages contents.
Web pages unit tests are hard to develop. Before you start to implement them, first decide if they are really necessary.
Tools:
1)ASP.Net
HttpUnit.NET - Port of HttpUnit for .Net - Not yet available
nHttpUnit - Port of HttpUnit for .Net - Not yet available
CSHttpUnit - C# API for accessing web sites without a browser
NUnitASP - ASP.NET web pages Testing
2) JavaScript
jsUnit - Testing framework for client-side (in-browser) JavaScript
3) HTML and JavaScript Tests with JUnit
htmlUnit
actiWATE
3) IE
Samie - IE test automation with perl scripts

ieUnit - Test logical behaviors of web pages
4) ASP
ASPUnit

26 July 2004

Database Refactorings

Database refactoring is the process of modifying the database schema (tables, stored procedures, triggers, ...) to improve the design, while retaining both its behavioral and informational semantics.
The database refactoring is implemented as:
1) After application coded and database schema is developed and unit tested,  a refactoring is detected because of an error or a new requirement.
2) Choose the database refactoring
3) Determine data cleanup
4) Write Unit Tests
5) Implement the changes
6) Run Tests

The most common database refactorings are:
1) Add Default Value
2) Add Nullable Column
3) Drop Column
4) Make Column Non Nullable
5) Remove Default Value
6) Add Foreign Key Constraint
7) Add Unique Index
8) Drop Table
9) Make Column Nullable
10) Add Non Nullable Column
11) Update Data
12) Delete Data
13) Insert Data
14) Move Data

Database testing tools
spUnit - Stored Procedures Unit Tests
tsqlUnit - Transact-SQL Unit Tests
DBUnit - JUnit extension
utPLSQL - PL/SQL Unit Tests


References
Agile Data 
List Of Database Refactoring - Martin Fowler

Books
Agile Database Techniques

21 July 2004

Refactoring

Refactoring is the process of restructing the code, without changing its behavior. 
The process will improve the design of existing code.
There are some patterns, look in look in Martin Fowler Refactoring site  http://www.refactoring.com/catalog/index.html for a comprehensive list.

The most common patterns are:
Extract Method
: Group related pieces of code into a method.
Rename: Rename any symbol (namespace, type, method, class, package,field,...) to an understanding name
Move Type: Nove types between namespaces/packages
Extract type to a new file: Move code, implementing it in a new file
Change Signature: Add/remove/reorder/rename/change parameters of a method
Introduce Variable: Create a local variable to make code more readable
Inline variable: Inverse of introduce variable refactoring. Replace variable with its initializer.
Convert method to property
Convert property to method 
Unit tests should also be refactored, since they are implemented as code.

Tools
There are some Refactoring tools available, look at http://www.refactoring.com/tools.html for a complete list.
c# free tools
http://opnieuw.com/
http://softwarestudio.smartcoding.org

Exercises:
http://www.xp123.com/rwb/
References:
http://www.refactoring.com/
http://www.xp123.com/

20 July 2004

TDD

Test Driven Development (TDD) is a lightweight programming methodology, in witch the tests are implemented before writing code. The steps are very simple:
1) Write a small test
2) Run the test
3) Write enough code to make the test succeed
4) Refactor: Clean up the code
5) Repeat
TDD Mantra
The TDD mantra is very simple: red/green/refactor (like a traffic light).
Red - Test Fails
Green - Test succeeds
Refactor - Clean up
This is the xUnit terminology.

xUnit can be seen has the language for writting tests. The xUnit is a framework that makes possible to define assertions.
xUnit is implemented in all main computer languages. The first was sUnit, for Smalltalk.
There are others like nUnit, clrUnit, and csUnit for Microsoft .Net framework, jUnit in Java and vbUnit for Visual Basic.

References:
http://www.testdriven.com/
http://www.xprogramming.com/

xUnit:
nUnit
csUnit
clrUnit
jUnit
vbUnit
sUnit
VB Lite Unit
Open Source Testing: The open source testing site
http://www.opensourcetesting.org/

18 July 2004

XP Part I

What is XP?
XP stands for Extreme Programming. XP is a new approach to software development that
makes every thing seem simple and more efficient.
 
XP Values
In 1996 Kent Beck started a project at DaimlerChrysler using new ideias in  software development. Those ideas resulted in the Extreme Programming (XP) methodology. 
The XP four values are: Communication, Simplicity, Feedback, and Courage.
Improve communication, seek comunication, improve simplicity and  get feedback on the progress.
 
 Core Practices
1) The Planning Game
2) Small Releases
3) System Metapor
4) Simple Design
5) Continuous Testing
6) Refactoring
7) Pair Programming
8) Collective Code Ownership
9) Continuous Integration
10) No work after hours
11) On-site customer
12) Coding Standards
 
The bible
After reading the article, you must be thinking: "Where can i learn from the master? Where is the XP bible?"
Well, Ken has written the definitive guide to XP Extreme Programming Explained: Embracing Change. Read the book and may the force be with you!!!

References:
http://www.extremeprogramming.org
http://www.jera.com/techinfo/xpfaq.html - XP FAQ
http://www.objectmentor.com/processImprovement/index