This blog had been move to http://fakhrulz.com

October 31, 2008

Hi all, I just had my own domain and web hosting now. You can visit my blog there.

http://fakhrulz.com


Selenium IDE – Web Testing Tool

October 8, 2008

 

I had been introduced by my colleague with a new kewl tool. Selenium IDE. It is a web testing tool and it is good for the web developer. What I need to do is just click a record button and start fill in my web form. After finish, then click stop and save my test case. Later, if I need to fill again the form, I just need to run the test case. It will repeat what had been record for me.


NHibernate Using Attributes Mapping

July 29, 2008

Today I will show how to use the NHibernate with the Attributes mapping. This example will use the Test Driven Development (TDD) technique, and the Domain Driven Design. I will use the NUnit framework for the unit testing.

Preparation

  1. Download NHibernate assemblies files.
  2. Download and install NUnit.

We will create 3 “Class Library” projects in this example.

  • “Example.Domain” – Contain the Domain Class, and the IRepository interface.
  • “Example.DataAccess” – Contain the Repository concrete class.
  • “Example.Test.Domain” – Contains the unit test.

Create an “Example.Domain” class library.

Delete the default Class1.cs file from the project and add refferences of

  • NHibernate.dll
  • NHibernate.Mappings.Attribute.dll

Add a new domain class name “Account.cs”. This class will have 4 properties.

  • Id – auto generate Guid (Primary Key)
  • Name – Account holder name
  • Type – Account type
  • Balance

Add a new interface name as “IAccountRepository.cs”. This interface should contain all the basic method to access the repository such CRUD.

3

Create an “Example.DataAccess” class library.

Delete the default Class1.cs file from the project and add the refferences:

  • NHibernate.dll
  • NHibernate.Mappings.Attribute.dll
  • Example.Domain.dll

Create a new xml file name “hibernate.cfg.xml”. This file will be used by NHibernate for it’s configuration such as connection string. Below is the xml.

Change the property of the “hibernate.cfg.xml” file to “Copy Always”.

Create the NHibernateHelper.cs, this helper will be use by the Repository concrete class to handle the session and transaction.

Create the AccountRepository.cs concrete class that implements the IAccountRepository interface.

Create an “Example.Test.Domain” class library. ”. This library will use for our unit test.

Add the references

  • NHibernate.dll
  • NHibernate.Mapping.Attributes.dll
  • NUnit.framework.dll
  • Example.Domain.dll
  • Example.DataAccess.dll

Create a new test class name “AccountTest.cs”.

Compile it and run the Nunit test. The unit test should throw an error because we not yet implement the Repository.

Now we will implement the AccountRepositry for “Add(Account acc)”

And then run the Unit Test.

Now it turns to green. If you notice that, there is no test method such as Assert.AreEqual(…) had been implement in here. But that is fine for now, because the nhibernate should thrown an exception if there is a problem. You can download the code here to continue the test unit.


Hello world of blogs!

April 24, 2008

“A blog (an abridgment of the term web log) is a website, usually maintained by an individual, with regular entries of commentary, descriptions of events, or other material such as graphics or video” wikipedia

This is my first blog in my life and also my first post, I hope this will be a good start for me and hopefully i can maintain the consistency of writing. Haha. Thanks to you for reading this and hope you will enjoy. yeah, let enjoys our life.

Before I started this blog, i just read my friend’s blog and others. After that I’m thinking that why shouldn’t I have once for me. Than I create this account and create this post.

So what should i put in my blog? Erm.. that is a good question.. the answer is everything.. yeah.. i will findout it later.. By the way. I want to continue my work.. Bye