Thursday, January 25, 2007

How to unit testing Asynchronous Threads in Multithreaded Enviornment

Unit testing thread using one of the unit test frame like JUnit, NUnit etc. is really good exercise and quite simple to do. Some people have posted about it in the following places

here, and here

and many other places.

But I think following is much simple and easy to understand
To test single threaded or synchronous or blocking request
1) You will call some function of some class from your main function. In the calling function, set the value of it's member variable as current thread's thread id. Compare this value with current thread's thread id in the main method. They should be same.

Main Method


TestClass's execute request method


TestClass's getRequestId



Similarly for asynchronous or not blocking request in which we spawn another thread to server our async request, it will return different id and it should not match with main thread's threadId.

Isn't it simple to test asynchronous (non-blocking) and synchronous (blocking) threads?

Tuesday, January 16, 2007

testing feed flare again

let see whether it works or not

Monday, January 15, 2007

Testing feedburner flare code

Testing feed flare

Embedding music in your blog

Today when I was reading this article from Cyber -Knowledge.net, I thought to share the same.

RadioBlogClub allows you to embed songs from number of artist on your blog. It is quite simple to add something from there, just search for your favorite artist, it will list down all the songs available for that artist. Click on the blue arrow button and it creates a snippet of code for you to just copy and paste on your blog. I have pasted the code for linkin park's numb



It seems to be quite cool but I will do some more research about it's usage and legal issues and not sure till what time we will be able to use this. But till then enjoy music on your blog