Thursday, October 16, 2014

Local Variables

A local variable in Java is a variable that’s declared within the body of a method. Then you can use the variable only within that method. Other methods in the class aren’t even aware that the variable exists.

Here’s a program that uses a local variable:

public class HelloApp
{
    public static void main(String[] args)
    {
        String helloMessage;
        helloMessage = "Hello, World!";
        System.out.println(helloMessage);
    }
}

You don’t specify static on a declaration for a local variable. If you do, the compiler generates an error message and refuses to compile your program.

Unlike class and instance variables, a local variable is fussy about where you position the declaration for it: You must place the declaration before the first statement that actually uses the variable.

You may also declare local variables within blocks of code marked by braces. For example:

if (taxRate > 0)
{
    double taxAmount;
    taxAmount = subTotal * taxRate;
    total = subTotal + total;
}

Local variables are not given initial default values. Thus, you must assign a value before you use a local variable.

One way to initialize a variable is to code an assignment statement following the variable declaration. Assignment statements have this general form:

variable = expression;

Here, the expression can be any Java expression that yields a value of the same type as the variable. For example, here’s a method that declares a local variable named i, and then initializes the variable before using it:

    public static void main(String[] args)
    {
        int i;
        i = 0;
        System.out.println("i is " + i);
    }

Another way to initialize a variable is to use an initializer, which lets you assign an initial value to a variable at the time you declare the variable. Here’s the general form:

type name = expression;

Here are some examples:

int x = 0;
String lastName = "Lowe";
double radius = 15.4;

In each case, the variable is declared and initialized in a single statement.

When you declare more than one variable in a single statement, each variable can have its own initializer:

int x = 5, y = 10;

When you declare two class or instance variables in a single statement but use only one initializer, the initializer applies only to the last variable in the list. For example:

static int x, y = 5;

Here, only y is initialized.

Tuesday, October 14, 2014

Regression Testing

Regression testing identifies when code modifications cause previously-working functionality to regress, or fail, ultimately allowing you to catch regression errors as soon as they are introduced. Most organizations verify critical functionality once, and then assume it continues to work unless they intentionally modify it. However, even routine and minor code changes can have unexpected side effects that might break previously-verified functionality.

The purpose of regression testing is to detect unexpected faults — especially those that occur because a developer did not fully understand the internal code correlations when modifying or extending code. Every time code is modified or used in a new environment, regression testing should be used to check the code's integrity. Ideally, regression testing is performed nightly (during automated builds) to ensure that errors are detected and fixed as soon as possible.

We've found that many development organizations often give up on regression testing because they find it complicated and difficult to maintain. But the major reason for failure with regression testing is the absence of a well-defined and implemented policy and an organizational commitment to that policy.

Recovery Testing

In software testing, recovery testing is the activity of testing how well an application is able to recover from crashes, hardware failures and other similar problems.

Recovery testing is the forced failure of the software in a variety of ways to verify that recovery is properly performed. Recovery testing should not be confused with reliability testing, which tries to discover the specific point at which failure occurs.

Examples of recovery testing:

1. While an application is running, suddenly restart the computer, and afterwards check the validness of the application's data integrity.
2. While an application is receiving data from a network, unplug the connecting cable. After some time, plug the cable back in and analyze the application's ability to continue receiving data from the point at which the network connection disappeared.
3. Restart the system while a browser has a definite number of sessions. Afterwards, check that the browser is able to recover all of them.

Source: http://en.wikipedia.org/wiki/Recovery_testing

Usage

- Recovery is ability to restart the operation after integrity of application is lost.
- It includes reverting to a point where integrity of system is known , then reprocessing up until the point of failure.
- The time taken to recover depends upon :
1. the number of restart points
2. volume of application
3. training and skill of people conducting recovery activities
4. tools available for recovery

Objectives

- To ensure operations can be continued after a disaster .
- Recovery testing verifies recovery process and effectiveness of recovery process.
- Adequate back up data is preserved and kept in secure location.
- Recovery procedures are documented.
- Recovery personnel have been assigned and trained.
- Recovery tools have been developed and are available.

How to Use

- Procedures , methods , tools and techniques are assessed to evaluate the adequacy.
- After system is developed a failure can be introduced in the system and check whether the system can recover.
- A simulated disaster is usually performed on one aspect of application system.
- When there are no. Of failures then instead of taking care of all recovery testing should be carried out for one segment and then another i.e. structured fashion.

Who uses it

- System Analysts
- Testing professionals
- Management personnel.

When to use

- When user says that the continuity of the system is needed inorder for system to perform or function properly.
- User then should estimate the losses, time span to carry out recovery testing.

Examples

- Loss of communication , loss of database integrity.
- Evaluate adequacy of back up data.

Monday, October 13, 2014

Selenium-X : Framework Features & Description

- Building XLS File Having Test Cases and Keywords
- Building XLS File Having Test Data
- Building Base class
- Reading XPATHS, Configuration from properties file
- Implementing WebdriverWait
- Implementing the keywords using the reflection API
- Implementing tests
- Assertions and Reporting Errors
- Parametrize tests using Data Provider and XL Files
- Repeating a test with different Data
- Running the framework through ANT
- Generating the reports
- Emailing test reports
- Creating a BAT file for project execution
- Database Testing