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

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
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.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.

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

Next reports can be generated using the coverage information obtained.

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

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_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 @!