Monday, March 27, 2006
Data Driven Unit Test
You will hear a lot about it in the VSTS era
Test driven development :
It is not testing software ,NO
It is aligning the developers to write more code efficient from customer
point of view
So life cycle would be :
- Write test (what ? Without having a code to test it) yes , write test
projects first . Think from customer point of view: what I need this
software to behave like . For example : I need my method to return
InvalidCustomerIDException when someone passes a null of invalid ID, and
I begin writing the test for the method that doesn't exist yet. So I
force the production in this way to follow the behaviour that I have
already designed in the test
- run test and see it fails . In this way I know that there is something
that must be done in the production code to make the test succeed
- write production code that make the test pass
- run test and see it pass
Ok here comes the main goal for this feed entry :
When I write a unit test , I am writing a static expected value and
calculate the actual value and then compare by Assert .what if I need
these values to be dynamic or having many values ? I will write an array
of course in the test method and loop through the array and invoke the
production code, WRONG.
There is another smart way: Data Driven unit test
I will create a table in the DB , and fill the table with data and tell
the test engine : please invoke my test method number of times equals
the no of rows in the table and pass the value for each row to the test
method every time. Wowwwwwwwwwwwwwwwwwwwwwwwwwwwww magnificent
So any time I can go to the table and change the test data and have
another punch of tested values.
Visual Studio 2005 Web Application Projects
Now we have two environments for building ASP.NET II web sites
1- Visual Studio 2005 Web Application Projects Model (Similar to VS
2- Visual Studio 2005 Web Site Projects Model (the new 2005
You can download the web app model from here :
This VS 2003 model style will be merged with VS 2005 SP1
And please no one ask me why we have two models ?
From my point of view : it is left for your flavour .
And one more thing :
Migration from VS 2003 web projects to VS 2005 web projects will be
straight forward as they are the same model .
Sunday, March 05, 2006
Deploy Web Part in GAC or in /bin
There is only 1 difference : Security
Web parts deployed in GAC run always under full trust without any CAS
Web parts deployed in /bin follow any of the five CAS trust levels
defined in web.config .
BTW : "Trust Levels" is a feature provided by ASP.NET II
Is Runnable DLL taking over EXE ?
Till the launch of .NET 1.1 there were some difference between DLLs and EXEs
1- you cannot reference /r an EXE in your project but you can reference a
2- you cannot deploy an EXE in GAC (Gacutil) but you can do so with DLL
3- DLL never meant to be runnable (has an entry point) but EXE does
After launching .NET 2.0 everything have changed now :
1- you can reference an EXE as well as DLL
2- you can Deploy EXEs in GAC
3- you can have a runnable DLL, yes you heard me , you can have a complete
project(like a windows forms APP) inside a DLL and run it .although this is
not documented, but it can be easily done .
So the question now is :
are DLLs taking over EXEs ? It can if it wants to
Are EXEs taking over DLLs ? It can if it wants to
There is still only one difference between them , which is the concept of
"Stand alone runnable APP". If I have a windows or a web or a mobile control
as EXE , I wouldn't know if I need to double click on it to make it run or
just add a reference to it in my app. So the logical meaning beyond the
extension is still there .