Wednesday, December 26, 2007

Developers and unit testing

Do developers hate testing ? Strange!
How do developers say the code works and how do they explain about the components they developed ?
To me 'Unit testing' is the only way. Documentation works, but is not enough.

How do you measure your unit tests ?

I write my unit tests for 2 reasons:
1. Unit testing the individual components to assess the working code.
2. As a documentation to other developers who would need to integrate other components with my developed components.
Does it mean the unit tests follow certain order and are coded properly with proper test data. A big YES.

This is 'team work'. No unit tests or poorly coded unit tests mean 'team without work'. Chaos.

One of the Projects I was working on required a lot of integration with other developers' developed components and hence required understanding of those components. How ? Well, an easy answer , bug my co-developers 10 times a day.

The other answer is follow the 'unit tests for this component'. Simple.
The unit test must be able to provide 90% of what the component is all about. It can answer - what, why, when and how. Run the unit tests for yourself and see what it does. This is what a lot of Developers miss about unit tests and unit testing.

This provides a lot of information regarding the other components. The interface to such components, design issues, design patterns and the basic object oriented nature of such compoemnts.

Wednesday, October 31, 2007

Continuous builds and Continuous Smoke Tests

Continuous builds and Continuous Smoke Tests - developers and testers perspective:

What is the purpose of continuous builds ?

1. To check if the source files are compiling properly as they are checked in by the team of developers. This does not seem to add value to the development methodology.
2. Is it to check if the unit tests are executing successfully ? Well certainly unit tests add a lot of value during development to test a successful integration. But consider during the initial stages of development (I will not talk about Iterations or Sprints), where developers are working on requirements and checking-in sources to the repository. This way the developers are adding functionality piece-by-piece in iterations and one is not able to complete the functionality end to end. Unit testing and coding are a developer's responsibilty.

But having continous builds and tests as part of the builds isin't going to add MUCH value to the overall development methodology. Yes, it is certainly going to help the developers a lot with their code integration. We (stakeholders) keep asking to involve testers right throughout the development phases. How can this happen ?

In Agile and RUP, functionality gets added in iterations and phases or in Sprints.
Does it mean we ignore the testing of the Project or Product until some of the initial functionality has been developed and marked done by the developer ?
Well, I am talking of the initial stages...Take for e.g (a trivial one) a login screen has been developed by developer D1 and where one has to enter a user ID, but no password is required to login into the application or product. The reason, is that the developer D1 or Developer D2 will work on the Password stuff later on in the coming iterations.

So what ?

Well, I do see we already started our continuous builds ( maybe three to four builds a day) and I see that the Application or the product has some working functionality as per the requirements and some shape is taking place with some other bits of functionality (NOTE: as per the requirements, well you do not throw away what you have developed so far).

So what is new ?

My thoughts are dragging towards the 'Smoke test(s)' that should be in place. I would recommend one smoke test a day very early in the project/product development.
Smoke tests are by definition are correct but interpreted with a narrow mind by managers and testers. Smoke tests must be manual ( DO NOT Automate Smoke tests in first release or milestone).

Why ?

This is where tester(s) get a chance to understand and see visually what is being developed from on paper. Is that all ?

No, testers get a chance to:


1. Understand the requirements and coordinate with the developers. Improved and better communcation.


2. Will be able to provide feedback on the developed functionality. This is a significant point where the testers get a chance to check back with the requirements if 'we are doing the right thing'. Discuss and refine the developed functionality sitting across the table with the developers.




3. Once we are done with smoke tests , testers will benefit from the interaction while functional testing. This sort of interaction would provide the testers better insight into the functionality and the requirements.




4. Testers get a chance to provide a feedback on 'future enhancements' , specially useful in case of product development.




Overall this improves and adds vaue to the development methodology.




Later and after the first milestone or even after the first major release, we can automate the smoke tests for the current release and execute these in the coming milestones, releases or phases.


Tuesday, June 5, 2007

Weblogic etc..

Pre Compile Java Server Pages (JSP) using ANT :



<java classname="weblogic.jspc" fork="true" failonerror="true" dir="${war.home}">
<jvmarg value="-Dcom.sun.xml.namespace.QName.useCompatibleSerialVersionUID=1.0"/>
<jvmarg value="-Dweblogic.jsp.windows.caseSensitive=true"/>
<classpath>
<pathelement path="${weblogic-related.jars}"/>
<pathelement path="${application-related.jars}"/>
<pathelement path="${java.class.path}"/>
</classpath>
<arg line="-depend -compileAll -keepgenerated -d WEB-INF/classes ."/>
</java>





Weblogic.9.2 and JDK 1.5.0_011.
Weblogic 9.2 comes with JDK 1.5.0.04 version. If you need to point to JDK version 1.5.0_011, then you need to use a parameter:
-Dcom.sun.xml.namespace.QName.useCompatibleSerialVersionUID=1.0

Make sure the domain is using the right JDK version. Make use of this parameter in startWeblogic.cmd/.sh files. Also can be used when running Ant tasks.