Friday, December 28, 2007

Continous Integration With CruiseControl

Continuous integration is a hot topic in the software development world. Although often linked with Agile processes, such as eXtreme programming, the concept and practices are nothing new -- just a variation on well-known software development best practices. It includes a cycle of checking out the latest code from repository, build , deployment and testing.

CruiseControl is a framework for a continuous build process. It includes, but is not limited to, plugins for email notification, Ant, and various source control tools. A web interface is provided to view the details of the current and previous builds.

It has provisions for
Checking out for modifications in the code Repository (SVN or CVS)

Interval based bulding( Eg : per hour basis or day basis in a week )

Conditional building based on modifications in Repoistory

The home grown build and deployment tools(processes) can be called from it which gets executed

Corresponding unit test cases & covearge frameworks can be executed .

Results can be intimated through messenger or emails.

JMX controls are provided which help in controling the entire process through the Webpage.

Dashboard is provided which gives detailed information about builds success, failure details , point of failure, time taken , latest modifications in repository from last successful build, unit test results , coding standars followed etc.

Although the process for Building and Deployment of the product depends on the individual , Cruisecontrol helps to integrate all these under one platform .

The product is available under the free licence and can be dowloaded from the following URL
http://cruisecontrol.sourceforge.net/download.html

It has Plugins for several of the following Additonal Frameworks.When Pluggins are not provided the results can be displayed from a link provided in the CI home page.(As Jettty WebServer is emmbedded woth cuisecontrol )

PMD : http://pmd.sourceforge.net/ - (Coding Standard Framework)

Emma: http://emma.sourceforge.net/ -( Java Unit Test Coverage FrameWork)

Clover : http://www.cenqua.com/clover/doc/tutorial/index.html -(Alternative to PMD)

Junit : http://junit.sourceforge.net/ - (Java Unit Testing Framework)

Utplsql : http://utplsql.sourceforge.net/- (PlSql Unit Testing Framework)

Jutex : http://sourceforge.net/projects/jutex - (PlSql Unit Test Coverage Framework)

Code Collaborator : http://smartbearsoftware.com/codecollab.php- (Code Review Tool)

Friday, November 30, 2007

Automated Functional Testing using Watij

Watij is framework providing API's which help in automating functional tests of Web Applications. It supports only Internet explorer in Windows platform.

It can be downloaded at http://www.watij.com/

Its simplicity makes it the first choice for simple web application functionality test automation.It also comes with a bean shell integrated which can execute the tests directly. For this to work replace the provided jniwrap.dll file in the windows installation directory.

Other frameworks line Sahi or Selenium also could be used for automated functional testing of web frameworks . More professional framework includes
Rational Robo – supporting visual basic like scripts
QTP
Rational Functional Tester(also supports scripting in java )

Both rational products are owned by IBM.

For simpler(non-professional) format, watij would be more useful because of its simplicity.Small load testing like hundred windows to be opened pointing at a particular URL,web applicationed being opened a few consecutive times could be easily achieved.

Since one cantnot purchase or spend much on these small activities Watij would server the purpose.A simple java code, as the following would open a Internet Explorer window and type the search string followed by a enter key hit.

IE ie = new IE();
ie.start("http://www.google.com");
ie.textField(name,"q").set("Watij");
ie.button("Google Search").click();

Also other supporting functionalities are provided on the IE object which could be easily used for simple applications.

Thursday, November 29, 2007

Junit,Emma & PMD with CruiseControl

Junit is a framework for java test cases .

The test cases have setup s teardown sections for initialization .Junit s can be executed using ant target junit fork .Individual classes can be executed or batch processing can be done.

Emma is open source code coverage generator.

http://emma.sourceforge.net/

Emma will instrument the jar , which are refereed by junit test cases for execution .

Instrumentation can be done by

java -cp emma.jar emma instr -m overwrite –cp abc.jar

This will produce a coverage file coverage.em(Also the size of the instrumented abc.jar will increase)

Exclude rmi classes(Stub and skeleton) by using –ix option while instrumenting the classes or jars.

Later the junit cases can be run with junit fork ant utility, pointing to the instrumented jar.

This will generate coverage information in the form of coverage.ec

Next reports can be generated using the coverage information obtained.

Java -cp emma.jar emma report -sp ${sourcecode} -r html -in coverage.em,coverage.ec"

Providing the {sourcecode} location will get the code in the result, which can be html , xml etc .

Coverage will be provided for any functionality which refers to the instrumented jar.

PMD is a framework for maintaining the coding standards in java files.

On proving the ruleset file(one which has the customised coding standards), the follwing command will generate the coding standards violations existing in the source code in the required format.



Cruisecontrol has pluggins for junit test cases and PMD execution .

In the configuration file , under the section is provided . On giving the xml logs obtained from the junit amd pmd executions ,gives a collaborated report for build and junit execution of the product code.

Wednesday, November 28, 2007

Utplsql ,Jutex(with resolved bug) and Ounit with CruiseControl

Utplsql,Ounit and Jutex are open source projects which can be configured easily for execution of utplsql test cases , and coverage of those tests in the junit report format along with cruisecontrol for continuous integration.


Utplsql is the frame work for execution of Plsql unit test cases.

Ounit is the user interface , enabling better representation of the unit tests cases run .(It uses utplsql for execution of test cases).

Note : Give sufficient privileges for creation of ut modules during installations . Also give execute privilege on dbms_pipe to the schema in which the tests execute.

Jutex is another source forge project which , uses


Jutex to install unit test cases

Utplsql to run the test cases

Dbms Profiler to get the coverage data

Sqlplus to connect to the database

JunitReport package for presentation of these results in the junit report format

Jutex provides a xml , with targets for each of these to be done

(it has a bug – coverage results are not shown for ut modules which are procedures or functions , but works fine with packages )

Solution : change the script install_jutex.sql in the jutex/Code/ folder .


UT_PACKAGE_SRC_PROFILING_V à add in the where clause
unit_type = 'PACKAGE BODY' or unit_type = 'PROCEDURE' or unit_type = 'FUNCTION')

make similar changes in

UT_PACKAGE_SRC_COVERAGE_V

UT_PACKAGE_SRC_PROFILING_V to include procedure and function.
This is because the coverage results are filled in the dbms_profiler table , but not picked up during the xml creation for report generation .

The above change should give the detailed coverage for the executed test results.



 
Free Domain Names @ .co.nr!