Showing posts with label Automations. Show all posts
Showing posts with label Automations. Show all posts

Rational purify coverage for J2EE application deployed in Websphere

Code coverage for J2EE applications deployed in Websphere using Rational Purify plus

Rational's purify plus is one of the best code coverage tool I have seen till today, It has multiple capabilities in which I got a chance to work with is code coverage capability. Some times it is required for Developers and testers to know what part of the code is not getting executed, which part is getting executed during specific scenario of usage etc. In this case it is always good to use a code coverage too like purify plus to monitor our application while running and analyze the results of code run.  The general process of code coverage is simple for any normal java applications, but when comes to a J2EE applications deployed and running under Websphere application server as a service needs more settings and configurations. In the web we can find many documents for configuring simple Java applications and other for code coverage.

So this post main aim is to explain the steps to configure the code coverage for J2EE application deployed under websphere and running as a system service.

Environment description : 
 Operating system : Windows XP / 2003
 Webserver / Applicaiton server : Websphere
 Application : J2EE type
Running as : Windows service.

Collect data by changing the WAS configuration file
When the Java process for hosting WAS is initialized, it gets its command line options from the server configuration file. This file exists for every WAS node and every WAS server. The location and name of this file is defined as follows:
<WAS root>\profiles\<your active profile>\config\cells\< cell id>\nodes\<node id>\servers\<server name>\server.xml

For example, if WAS is installed in C:\WAS, the profile name is ‘MyProfile’, the cell id is ‘MyCellId’, the node id is ‘MyNodeId’, and the server name is ‘MyServer’. The configuration file path will be defined like this:

C:\WAS\profiles\MyProfile\config\cells\MyCellId\nodes\MyNodeId\servers\MyServer\server.xml

Ex :
C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\config\cells\ibm-b51282f6ec3Node01Cell\nodes\ibm-b51282f6ec3Node01\servers\CDSServer

For example:
<jvmEntries xmi:id="JavaVirtualMachine_1284026476671" verboseModeClass="false" verboseModeGarbageCollection="false" verboseModeJNI="false" runHProf="false" debugMode="false" debugArgs="-Djava.compiler=NONE -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7777" genericJvmArguments="-DPD_DT_ENABLED=true -XrunPureJVMPI:Coverage" executableJarFileName="-Xbootclasspath/a:%PPLUS_HOME%\Rational.jar" disableJIT="false">

The best way to change the profile is to use the WAS administrative console. However, if you do not have access to the console or do not have sufficient rights to edit the server configuration, you may edit the XML file directly. You should locate the jvmEntries element in this file and change the appropriate VM options by adding the JVMPI loading option: -XrunPureJVMPI:. 

After saving the file or applying these changes from the administrative console you should restart the server process. After the new instance of WAS starts, it will run with the appropriate profiler attached.

So to do the code coverage for any J2EE applications deployed under web sphere and WAS server is running as a system service. So if we edit prefilters in the default settings, this is not going to have any effect on the running service. This is because PureCoverage is saving the default settings in the folder named "c:\documents and settings\\application     data\rational\purecoverage\coverage.ini"                               
Whereas WAS running as a service is using the configuration file named "c:\documents and settings\localservice\application                    
data\rational\purecoverage\coverage.ini"                               
In other words, the service profile doesn't correspond to the          
PureCoverage profile, therefore they are trying to access different    
default INI files.                                                     

There are several ways to work around this problem:                    
1. Edit prefilters in the application settings, not the default        
settings.                                                              
2. Copy the coverage.ini file from your profile to the service profile 
(see above)                                                            
3. Run WAS as a user process, not as a system service.(User should be same the user with which purify was run)                  
4. Change the user associated with the service to be the same as the one
running the coverage.                                                  
5. Manually edit the coverage.ini file in the local service profile. 

so the best I followed after changing the server.xml file is 3rd one , run you websphere service as the user with which purify coverage was run ... 
Go to Windows 
Start > Run > services.msc > Locate your service ex  : 
IBM WebSphere Application Server V6.1 - CDSServer
> Right click on it > Properties > go to Log on Tab > Select This Account > Provide the user and passwords which is same as the user which is running Purify coverage. > Apply > Ok. 
  • Now launch the Purify coverage once. 
  • Empty coverage window opens up ... 
  • Then now re-strat the Websphere service. 
Now coverage should automatically pick up the chnages and pick the classed which you want to instrument.

How to apply filters in Purify plus / coverage : 
License issues in the Purify plus :

Read more


Adding messages to log file - RFT

Most of the RFT (Rational Functional Tester) users in the initial stages will get question in mind when they see the auto-generated log after executing their Functional script ... i.e
How to add more information/messages to log ? How to change logs ?
Its so simple. RFT provides the following functions to customize your final log file after executing the functional script.
We know that the logs can maintained in different ways in RFT say TestManager Log, HTML Log, or Text Log etc. What eve the kinda log we are using we can add our general messages or test status results say PASS / FAIL to the log file.
RFT provides the following functions to add more messages
Function name - Usage Example
logInfo - logInfo("Login button is clicked. - PASS");
logTestResult - Ex : 1
logTestResult("Text buffer comparison",TextField_text.equals(urloginName));
Ex : 2
if(getText_login.equals(UrloginName))
{
logTestResult("Text buffer comparison", true);
}

logError - logError("Exception e = "+e.toString());
logWarning - logWarning("Your warning message goes here.");

Read more


RFT8.1 Download Installation tutorials samples

This post is basically to help the software testers who are interested to start using the RFT-Rational functional tester as the automation tool for their needs to automate their test efforts.
So basically the first and foremost thing to start with is,
where can I get the RFT latest installer to download ?
It is Free for IBMers to use for their work purpose. Read the full rules and regulations to use.
You go to Xtreme leverege site and start downloading the installers mentioned below.
https://www14.software.ibm.com/webapp/dswdown/dswdown.wss/web/resultsActionDesc#anchor
It is only for IBMers to download. Need their intranet credentials to download.
The following are the required packages for installation along with their part numbers.
IBM Rational Functional Tester V8.1Multiplatform Multilingual eAssembly (Core) (CR93MML)
IBM Rational Functional Tester V8.1 Multilingual Multiplatform Part 1 (CZ3KXML)
IBM Rational Functional Tester V8.1 Multilingual Multiplatform Part 2 (CZ3KYML)
IBM Rational Functional Tester V8.1 Setup Multilingual Multiplatform Part (CZ3KWML)
IBM Rational Functional Tester V8.1 Multiplatform Multilingual Activation Kit (CZ3KVML)
Quick Start Guide for IBM Rational Functional Tester V8.1 Multilingual Multiplatform - READ ME FIRST (CZ3KUML)
The important Reading material to install and use the RFT is well explained in the following link.
It contains Installtion steps,Testing,Using,tours,Tutorials, Samples and trouble shooting as well here.
Information center for the RFT:
http://publib.boulder.ibm.com/infocenter/rfthelp/v8r1/index.jsp
Product Information:
http://www-01.ibm.com/software/awdtools/tester/functional/index.html


Read more

Popular Posts

Enter your email address:

Buffs ...

Tags


Powered by WidgetsForFree