Sunday, May 31, 2009

Software Testing - Test Harness

Test Harness or Automated Test Framework is a collection of software and test data configured to test a program unit by running it under varying conditions and monitoring its behavior and outputs.

It has two main parts:
1. Test execution engine and
2. Test script repository.
Test harnesses allow for the automation of tests. They can call functions with supplied parameters and print out and compare the results to the desired value. The test harness is a hook to the developed code, which can be tested using an automation framework.

A test harness should allow specific tests to run (this helps in optimizing), orchestrate a runtime environment, and provide a capability to analyse results.

The typical objectives of a test harness are to:
  • Automate the testing process.
  • Execute test suites of test cases.
  • Generate associated test reports.

A test harness typically provides the following benefits:

  • Increased productivity due to automation of the testing process.
  • Increased probability that regression testing will occur.
  • Increased quality of software components and application.

Friday, May 29, 2009

Using generic ArrayList

JDK 5.0 provides typed array list. Before JDK 5.0 Array List store the objects of type Object. But now type of the elements of an ArrayList can be specified.

Syntax:
ArrayList list = new ArrayList();

Example:

import java.util.ArrayList;

public class MyArrayList {

public static void main(String[] args) {

Seller sel = new Seller();
Buyer buy = new Buyer();

// declare an array list of type Seller
ArrayList list = new ArrayList();
list.add(sel); // add object of type Seller which is permisible
list.add(buy); // this statement will give an error
}
}


source: java-tips.org

Wednesday, May 27, 2009

List of Windows xp Dos Commants part 2

Here is list of Remaining Windows xp Dos Commands:

NET Manage network resources
NETDOM Domain Manager
NETSH Configure network protocols
NETSVC Command-line Service Controller
NBTSTAT Display networking statistics (NetBIOS over TCP/IP)
NETSTAT Display networking statistics (TCP/IP)
NOW Display the current Date and Time
NSLOOKUP Name server lookup
NTBACKUP Backup folders to tape
NTRIGHTS Edit user account rights

PATH Display or set a search path for executable files
PATHPING Trace route plus network latency and packet loss
PAUSE Suspend processing of a batch file and display a message
PERMS Show permissions for a user
PERFMON Performance Monitor
PING Test a network connection
POPD Restore the previous value of the current directory saved by PUSHD
PORTQRY Display the status of ports and services
PRINT Print a text file
PRNCNFG Display, configure or rename a printer
PRNMNGR Add, delete, list printers set the default printer
PROMPT Change the command prompt
PsExec Execute process remotely
PsFile Show files opened remotely
PsGetSid Display the SID of a computer or a user
PsInfo List information about a system
PsKill Kill processes by name or process ID
PsList List detailed information about processes
PsLoggedOn Who's logged on (locally or via resource sharing)
PsLogList Event log records
PsPasswd Change account password
PsService View and control services
PsShutdown Shutdown or reboot a computer
PsSuspend Suspend processes
PUSHD Save and then change the current directory

QGREP Search file(s) for lines that match a given pattern.

RASDIAL Manage RAS connections
RASPHONE Manage RAS connections
RECOVER Recover a damaged file from a defective disk.
REG Read, Set or Delete registry keys and values
REGEDIT Import or export registry settings
REGSVR32 Register or unregister a DLL
REGINI Change Registry Permissions
REM Record comments (remarks) in a batch file
REN Rename a file or files.
REPLACE Replace or update one file with another
RD Delete folder(s)
RDISK Create a Recovery Disk
RMTSHARE Share a folder or a printer
ROBOCOPY Robust File and Folder Copy
ROUTE Manipulate network routing tables
RUNAS Execute a program under a different user account
RUNDLL32 Run a DLL command (add/remove print connections)

SC Service Control
SCHTASKS Create or Edit Scheduled Tasks
SCLIST Display NT Services
ScriptIt Control GUI applications
SET Display, set, or remove environment variables
SETLOCAL Control the visibility of environment variables
SETX Set environment variables permanently
SHARE List or edit a file share or print share
SHIFT Shift the position of replaceable parameters in a batch file
SHORTCUT Create a windows shortcut (.LNK file)
SHOWGRPS List the NT Workgroups a user has joined
SHOWMBRS List the Users who are members of a Workgroup
SHUTDOWN Shutdown the computer
SLEEP Wait for x seconds
SOON Schedule a command to run in the near future
SORT Sort input
START Start a separate window to run a specified program or command
SU Switch User
SUBINACL Edit file and folder Permissions, Ownership and Domain
SUBST Associate a path with a drive letter
SYSTEMINFO List system configuration

TASKLIST List running applications and services
TIME Display or set the system time
TIMEOUT Delay processing of a batch file
TITLE Set the window title for a CMD.EXE session
TOUCH Change file timestamps
TRACERT Trace route to a remote host
TREE Graphical display of folder structure
TYPE Display the contents of a text file

USRSTAT List domain usernames and last login

VER Display version information
VERIFY Verify that files have been saved
VOL Display a disk label

WHERE Locate and display files in a directory tree
WHOAMI Output the current UserName and domain
WINDIFF Compare the contents of two files or sets of files
WINMSD Windows system diagnostics
WINMSDP Windows system diagnostics II
WMIC WMI Commands

XCACLS Change file permissions
XCOPY Copy files and folders

Note: To Know the Syntax for Each Commands type help followed by that Command name in DOS Prompt"

e.g., "help color", help del, help copy etc..,

Monday, May 25, 2009

MVS SYSTEM CODES -S322

Description:

The time limit was exceeded for a job or job step.

Possible causes:

1. An endless loop occurred in the executing program.
2. The time parameter on the job card did not allow enough time for the job to complete.
3. The time parameter on the exec card did not allow enough time for the step to complete.
4. If the time parameter was not specified, the default time limit was exceeded.

Resolution:
1. Check for program errors, especially endless loops that cause the job or job step to exceed the time limit.
2. Verify that the time limits for the given job are realistic.
If necessary, specify a longer time in the time parameter, and rerun the job.

Ref: www.ibmmainframes.com

Saturday, May 23, 2009

Renaming and Appending in a file using CF

Using ColdFusion's cffile tag, you can rename a file on the server and you can append a file on the server.

Example of Renaming a File


The following code renames the source file with the name specified with the destination attribute.

action="rename"
source="C:\docs\accessLog.txt"
destination="C:\docs\oldAccessLog.txt">

To append a file, you simply use action="append" (instead of action="write").

The contents you specify in this tag are appended to the end of the existing file.If the file doesn't already exist, it is created.

Example of Appending a File

This example declares a variable, assigns the current date and time to it, then appends the result to a file.

dateAccessed = "This page was accessed at this time: " & now()>

action="append"
file="C:\docs\accessLog.txt"
output="#dateAccessed#">

Source : http://www.quackit.com/coldfusion/tutorial/coldfusion_append_file.cfm

Thursday, May 21, 2009

FireFox Browser

1. When we have opened so many tabs in FireFox Browser, we do not want to click on each tab by using our mouse to view the pages. Each time we press Ctrl + Tab Keys, all the opened tabs will be highlighted sequentially, We just need to press Enter Key, in the highlighted tab to view the respective page.

2. Press Ctrl + Shift + tab keys to view the previous tab.

3. When we have some 8 tabs opened and when we need to open the 3rd tab, then we need to press Ctrl + 3 to open the respective page. This works for 1 to 9 tabs.

Tuesday, May 19, 2009

Third Party API’s

Never completely believe any third party apis.

While debugging issues in programming code I used JLogManager.

It has some perfomance issue while writing the log files in server.

If its thread is unable to write its directly kills the current executing transaction.

Sunday, May 17, 2009

FireFox Browser Shortcut Keys

The below are some of the FireFox Browser, Shortcut Keys.

1. Ctrl + L –> To keep the cursor in the Address Bar.

2. Ctrl ++ –> To increase the text size

3. Ctrl + - –> To decrease the text size

4. Ctrl + W –> To close a tab

5. Alt + Home –> TO view the Home page

Friday, May 15, 2009

MVS SYSTEM CODES -S30A

Memory error
1. The EZTVFM file is not large enough for the report being generated.
2. You have a subscript or index that is going out-of-bounds on an table or occurs clause .
3. A file or table size is greater than the JCL/file LRECL.
4. DCB mismatch.



Ref: www.ibmmainframes.com

Wednesday, May 13, 2009

Excel API — POI.jar

Jakarta POI is an excellent api for manipulating excel operations using Java.

Neve use wrap text and autosize column methods on sheet class.

Use HSSFPalette class for better User Interface.

Monday, May 11, 2009

Don’t leave a trace while Private Browsing

A major feature was added to the pre-versions of IE 8.0 Beta and Firefox 3.1 called Private Browsing. As you know while browse the web, your browser will record all the data which will be later be used to improve the browser expirence,for example if you visit your history in your browser, you can view the browse history, so that later if you need help remembering a site you visited a while back it can assist you.

Finding the site. That is a good job, but it have a downside, this can be used to trace your online activity, like if another person’s uses your computer they can trace your online activity, which may not be you want. If you don’t want others to trace your online activity, one option is that you can clear the history, cookies, cache etc., But the problem is that this action will also remove the parts of your online activities data which you don't want to hide, so the history that browser records can no longer be used to find a web site you had visited a month before. Private Browsing will help you here.

Private browsing will help you to make sure that it will not leave any trace of your browsing in your computer. This is not a tool .Private Browsing is only about making sure that browser doesn't store any data which can be used to trace your online activities, no more, no less.

How can you use this feature?

IE 8.0 Beta:

1.Go to top menu of your browser

2.select => Tools =>InPrivate Browsing

3.or Press Ctrl+Shift+P


Firefox 3.1:

1.Go to top menu of your browser

2.select => Tools =>Private Browsing

Saturday, May 09, 2009

MVS SYSTEM CODES -S413

An error occurred in opening either a direct access or a magnetic tape data set.
1. An input/output error occurred in processing a tape data set.
2. The specified data set could not be located.
3. The label or DCB parameters were incorrect.
4. A requested device was unavailable.


1. No unit was available for mounting the volume which contained the data set being opened.
2. The volume on the allocated unit (as specified by ser) could not be demounted because it was either reserved or permanently resident.

The volume serial number was not specified on the DD statement for a data set which was opened for input.
An invalid volume sequence number in the JCL specified a value greater than the number of volumes contained on the data set.
An error occurred while opening a magnetic tape data set.
The density specified in the DEN sub parameter was incompatible with the recording density of the device allocated.
An error was caused by a subsystem interface problem.
The mass storage system did not mount the requested volume.

Tape data set sequence number was specified greater than 1, but the volume serial number did not specify a tape data set.

1. Verify that the JCL is correct.
2. Rerun the job specifying a new volume or device.

Specify another device in the unit parameter of the DD statement. Determine how many volumes the data set spans, and request the appropriate volume.

Ref: www.ibmmainframes.com

Thursday, May 07, 2009

COBOL Compiler

As fresher we usually feel it as a tedious job to compile the COBOL program and submit the job for the load each time. So this is how we can modify the compiler so that the compiler itself can submit the load for the COBOL program.

All we have to do is add the following code at the end of the compiler

//STEP111 EXEC PGM=IEBGENER,COND=(0,LT,LKED)
//SYSUT1 DD DSN=FILE-NAME,DISP=SHR
//SYSUT2 DD SYSOUT=(A,INTRDR)
//SYSIN DD DUMMY
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*

The FILE-NAME would be the name of file to submit ( JCL for executing the Load)

The DDName SYSUT1 will point to the input, (i.e.) the JCL we want to submit.

The DDName SYSUT2 (output) will point to the internal reader.

The Internal Reader takes our input and sends it to JES so it can be processed.

Thus the compiler would be able to submit the JOB if the COBOL program was sucessfully executed (This is ensured by the the COND )

Tuesday, May 05, 2009

Getting a HTML elements absolute position

There might be a case where we may want a popup to be displayed near the anchor element that we click, in that case the popup's postion is difficult to set , here is the code how we get the position of the anchor tag so that we can set the popup's position near to it,


function getoffsetLeft(element)
{
if(!element) return 0;
return element.offsetLeft + getoffsetLeft(element.offsetParent);
}
function getoffsetTop(aItem2)
{
if(!aItem2) return 0;
return aItem2.offsetTop + getoffsetTop(aItem2.offsetParent);
}

var leftp=getoffsetLeft(document.getElementById('anchor'))+10;
var topp=getoffsetTop(document.getElementById('anchor'))-10;

alert(leftp);alert(topp);



In the above code 'element' is the anchor tag object ie.(document.getElementById('anchor')). The alert would display the required top,left values for the popup.The speciality of this code is that it would get the top,left values even if the anchor tags position is relative.

Sunday, May 03, 2009

Read a file from the JAR file of an applet

You can use the getResourceAsStream() method to get the file in the JAR as an InputStream:


import java.io.*;
import java.awt.*;
import java.applet.*;

public class Read extends Applet {

TextArea ta = new TextArea();

public void init() {
setLayout(new BorderLayout());
add(ta, BorderLayout.CENTER);
try {
InputStream in =
getClass().getResourceAsStream("read.txt");
InputStreamReader isr =
new InputStreamReader(in);
BufferedReader br =
new BufferedReader(isr);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
String line;
while ((line = br.readLine()) != null) {
pw.println(line);
}
ta.setText(sw.toString());
} catch (IOException io) {
ta.setText("Ooops");
}
}
}


Source: java-tips.org

Friday, May 01, 2009

MVS SYSTEM CODES -S513

An error occurred in opening two data sets on the same magnetic tape volume.
This only works with SYSOUT data sets.

1. Two data sets were assigned to the same device.
2. An open was issued for a second data set on the same tape device before the first one was closed.
1. Verify that the JCL is correct
2. Check the file usage in the program.



Ref: www.ibmmainframes.com
Computers Add to Technorati Favorites Programming Blogs - BlogCatalog Blog Directory