Archive

Author Archive

Read Write into excel through Java by JExcel

June 23rd, 2010 8 comments

JExcelApi allows Java developers to read Excel spreadsheets and to generate Excel spreadsheets dynamically. In addition, it contains a mechanism which allows java applications to read in a spreadsheet, modify some cells and write out the new spreadsheet.

This API allows non Windows operating systems to run pure Java applications which can both process and deliver Excel spreadsheets. Because it is Java, this API may be invoked from within a servlet, thus giving access to Excel functionality over internet and intranet web applications.

Download JExcelApi JAR files from

http://jexcelapi.sourceforge.net/

Reading Spreadsheets

Here is the sample program which uses the javaexcel Read more…

Categories: Uncategorized Tags:

Use of environment variable in Java

June 20th, 2010 No comments

In this post we will talk about environment variables in java , their role and how to use them in windows and Unix environment.

Reading environment Variables in Java

System environment variable can be used in the java application to set the system related values for ex: application path, database environment etc..,

In standalone application, start the JVM with the “-D” switch to pass properties to the application and read them with the System.getProperty() method.

SET myvar=Hello world

SET myothervar=nothing

java -Dmyvar=”%myvar%” -Dmyothervar=”%myothervar%” myClass

Then in myClass do the following

String myvar = System.getProperty(“myvar”);

String myothervar = System.getProperty(“myothervar”);

Read more…

Categories: Uncategorized Tags:

Custom Annotation in Java 5.0

June 3rd, 2010 5 comments

Overview

Previous versions of Java provided a limited and ad-hoc mechanism for annotating code through JavaDoc comments

Java 1.5 allows both runtime and compile-time processing of annotation data. Annotations are said to annotate a Java element. A good example is the @deprecated JavaDoc tag. The @deprecated tag is used for documentation purposes. This tag has no effect on the code it describes, but causes the compiler to produce warnings if any other code references the tagged element.

Annotations will also be used for compile-time checking such as to produce warnings and errors for different failure scenarios. An example of an annotation that is used at compile time is the new @Deprecated annotation, which acts the same as the old @deprecated JavaDoc tag.

How to define an Annotation?

Annotations are defined in following way: Read more…

Categories: Uncategorized Tags:

Load testing using Apache JMeter

May 25th, 2010 6 comments

JMeter is a desktop application used to load test functional behavior and measure performance. It is used to test performance both on static and dynamic resources (files, Servlets, Perl scripts, Java Objects, Data Bases and Queries, FTP Servers and more).

JMeter supports HTTP, HTTPS, FTP, SOAP, POP3, JDBC, thus enabling its use to test most of the applications. It has record and playback capability which enables easy test case creation. But, it can directly record only HTTP requests and supports HTTPS spoofing which is not completely reliable.

Steps to setup JMeter and create test plan :-

  1. Download the latest version of JMeter from the website http://jakarta.apache.org/
  2. Run the batch file in JMeter folder -> bin -> jmeter.bat

Below is the snap shot of the Apache JMeter Tool.

Apace Jmeter Read more…

Categories: Uncategorized Tags:

Invoking browser functions with JavaScript

May 14th, 2010 2 comments

Browser functionality can be disabled using the JavaScript. JavaScript has the ability to capture and handle the key events. We will look at couple of examples on how to trigger browser functionality using Java script.

Disabling new page event and ctr key event in browser

Following is the example which shows how to disable the ctrl + N (new page event) and back button in the browser.

<html>

<body onkeydown=”return
fnDisableNewPage(event)” >

<p>Test</p>

<script> Read more…

Categories: Uncategorized Tags:

Selenium – Web application testing tool

May 12th, 2010 15 comments

What is Selenium ?

Selenium is an open source, robust set of tools that supports rapid development of test automation for web-based applications. This tool is primarily developed in Java Script and browser technologies and hence supports all the major browsers on all the platforms. Most of the time, we will not need to change our scripts for them to work on other platforms. Selenium provides a record/playback tool for authoring tests without learning a test scripting language.

Selenium Components

There are three variants of Selenium, which can be used in isolation or in combination to create complete automation suite for the web applications. Each one has a specific role in aiding the development of web application test automation.

Categories: Uncategorized Tags:

Working with JSON CSS

May 2nd, 2010 3 comments

In our last tutorial JSON Javascript tutorial , we had covered about basics of JSON . In next couple of  posts,  we will talk about some of smart tricks and tips while using JSON.

CSS JSON

Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents. JSON (JavaScript Object Notation) is a lightweight data-interchange format. CSS may easily be expressed in JSON notation (CSS JSON). CSS JSON is a powerful and flexible approach allowing for inheritance and logical constructs within CSS.

CSS JSON Structure

{

“selector-1″:{

“property-1″:”value-1″,

“property-n”:”value-n”

}

} Read more…

Categories: Uncategorized Tags:

Introduction to JavaFX

April 29th, 2010 5 comments

Overview

JavaFX is a rich client platform for building cross-device applications and content. Designed to enable easy creation and deployment of rich internet applications (RIAs) with immersive media and content, the JavaFX platform ensures that RIAs look and behave consistently across diverse form factors and devices.

The JavaFX1.2 platform release includes the following components:

  • JavaFX SDK which includes the JavaFX compiler and runtime tools, graphics, media, web services, and rich text libraries to create RIAs for the desktop, browser and mobile platforms.
  • NetBeans IDE for JavaFX which provides a sophisticated integrated development environment for building, previewing, and debugging JavaFX applications. The editor features a drag-and-drop palette to quickly add JavaFX objects with transformations, effects and animation. This IDE also comes with its own set of Building Block samples and the JavaFX Mobile Emulator, a mobile phone simulator.
  • JavaFX Production Suite is a suite of tools and plugins that enable designers to export graphical assets to JavaFX applications.  (Example:: JavaFX Plugin for Adobe Photoshop and JavaFX Plugin for Adobe Illustrator)

JavaFX Vs Swing Read more…

Categories: Uncategorized Tags: