Monday, December 14, 2009

How to handle popup window in Selenium?

Introduction
HTML provides window popup facility.A popup window is a web browser window that is smaller than standard window size and without some of the standard features such as tool bar or status bar. The popup window can have all basic html element like normal text, input fields, buttons ,etc.
The Web application contains the popup window and the tester has  to test the popup functionality.
In manual testing there is no problem. It is just a  click on the link and it will open popup window and verify its functionality.
In automation testing ,script should be able to detect popup window and keep it in AUT.


How to detect opened popup window ?
We can detect opened popup window based on their id, name and title


How to keep opened popup window in AUT ?
Selenium provide selectWindow method for keeping pop window in AUT.


If selenium is able to detect and select opened popup windows then what is the problem ?
Problem comes when developer use dirty code for popup window or title, name and id are auto generated.
Here is example where developer missed id, name and title


<a href="javascript:window.open('http://www.google.com','');void(0);" > popup window</a>
Here we don't have any identifier which can be used in selenium to select this popup window. If we click on the link then it will open a pop window which doesn't have any name or id or title.


If we open in selenium then it will give a auto generated identity but selenium doesn't provide any direct method to get auto generate identity. It means we cant select this window because it doesn't have any identifier.


How to work smartly:
To handle this problem we can use a custom method to get name of newly opened pop up window.
I have used Java but we can any other languages which is supported by Selenium.


Here is the custom method which detect any opened popup window and select it for further testing steps :


protected selectWindow(String windowIndenifer ) {
if (windowIndenifer==null ||windowIndenifer.length() <= 1)
windowIndenifer = selenium
.getEval("{var windowId; for(var xWindow in
selenium.browserbot.openedWindows ) {windowId=xWindow;} }");
if(windowIndenifer == null || windowIndenifer.length <=1)
System.out.prinln("There is no popupWindow in current AUT")
else{
selenium.selectWindow(windowIndenifer);
System.out.prinln("Selenium found a popup Window : " + windowIndenifer);
}
}

Thursday, July 9, 2009

Web Based Interface of Mainframe


Introduction

Searching and downloading a file (COBOL or EZT source, Cob copy Eztmac ,Proc, JCL) from mainframe, either for modification or for reference is a very tedious job. Many times we come across a situation where in for analyzing a particular job , we need to analyze related procs, programs, copybooks, parmcard , subroutines. To complete the analysis we need to go to different libraries and download respective file, which needs time as well as huge amount of patience. 

Here comes into picture the need of Web based Interface of Mainframe


How to work smartly:

Web based Interface is a platform where in we can visualize different components pertaining to a job as a normal window file. With the presence of search box on the screen, there is no need of going to a specific library and searching a particular component. All you need to do here is give the requisite component name and the system will display all related components and the location where it is residing in mainframe. Not only is this, downloading these components for any kind of modification also, is just a matter of one click.


Why Web based? Why not Standalone tool?


Here is the answer!

  • No need to install any extra tool.

  • Work on normal browsers.

  • Easy maintenance.

  • Easy Updation

  • Easy to add security

  • Single point to access Mainframe.

How it works ?

This approach contain following modules.

  1. Connectivity to Mainframe: To connect with mainframe we may use FTP.

PS : We are already using FTP connection to upload and download files from Mainframe.

This module will contain two sub-modules.


    • Front End: This is the Login screen. Here user needs to enter their username and password, and then system connects them to mainframe via FTP.

    • Back-End: This module will start working after successful login. It will generate different index file for different libraries used such as Proclib, Joblib, MITDEV, PROD etc. Index files for one particular library will contain all the files present in that respective library.


PS : These index file will be auto updated by user at a definite time interval .


How can we connect to FTP via programming language??

Once we are able to deal with the above issues, the next step is to establish a link to FTP via a programming language. Here is the solution:

FTPClient ftp = new FTPClient();

ftp.connect("ftp.domain.com");

ftp.login("admin", "secret");


How can we display the list of file from different area of Mainframe ??

Once we are done with establishing a link to FTP via a programming language, the next task is to list the file names from different regions of mainframes. Here is the solution:

// Change Mainframe directory
ftp.setDir("
PROD0.JOBLIB");

/* Obtain a list of filenames in the current working directory. When

* no file found an empty array will be returned.

*/

String[] names = ftp.listNames();

for (String name : names)

{

System.out.println("Name = " + name);

}

Here is mock screen shot for login.


  1. Search For File In Mainframe :

This module help user to search a file in mainframe using web based interface.

Here is mock screen shot for the Search.


  1. Downloading File/Files :

After a successful search user will get a download link . After clicking on the link a popup appears asking “ Do you want to download related file ? ” In case user select ‘yes’ button then beside the particular file which was being searched , it also downloads all related file pertaining to that, else it downloads only the file which was being searched.

The next question which comes is how are we going to know all related file/files of a particular component.This problem is soved by parser which read download file/files and find out all related cobol sources, ezt sources, cobcopy, eztmac, production proc, parmcard etc and download it.

  1. Upload File/Files :

We can also upload files in batch mode in different libraries and from different folder of local machine.

Here is mock screen shot for Upload.


Enhancement : We can also make a tool in such a way that it also copies related Data file/Files (VSAM) to working library for testing purpose.


Tuesday, January 6, 2009

How to add PPM Repositories?

How to add PPM Repositories?
  • What is PPM Repositories ?
    • Repository Types
      • PPM Server 3
      • PPM Server 2
      • Web Repositories
      • FTP Repositories
      • Local Repositories
  • Why add new Repositories ?
  • Add PPM Repositories
    • PPM Version 3
    • PPM older versions
  • Manage PPM Repositories
  • Repositories Resources
    • Default Repository
    • Additional Repositories
      • Perl 5.10
      • Perl 5.8
        • My PPM has AS Servers:
        • Other 5.8 only:
        • May also work for 5.6:
      • Perl 5.6
  • Installing non-ActiveState modules:

What is PPM? PPM is the package management utility for ActivePerl. It simplifies the task of locating, installing, upgrading and removing Perl packages. The PPM client accesses PPM repositories on the Internet or on a local network. It is also used to update previously installed packages with the latest versions and to remove unused packages from your system.

What is PPM Repositories ?It is collections of Perl packages/modules.

Repository TypesPPM3 supports several types of package repositories:

1. PPM Server 3
ActiveState's SOAP-driven package server. Because all searches are done server-side, the server can deliver much richer information about packages t
han other repositories.

2. PPM Server 2

The SOAP server designed for PPM version 2. PPM 3.1 ships with the PPM2 repository as well as the PPM3 repository, so you can use either. Simple searches are performed server-side. If your search is too complicated for the server, PPM 3.1 will download the package summary and search by itself.


3. Web Repositories
Older versions of PPM used non-SOAP r
epositories (directories full of PPD files accessible using a web browser). Over the history of PPM, there have been several different ways of organising the files so that PPM can search for packages properly. PPM3 tries to download a summary file first -- if that fails, it gets the directory index. It parses the summary or the index, and caches it. Searches are done from the cache.

4. FTP Repositories
FTP is another way of exposing a directory full of PPD files. PPM3 consideres FTP repositories a subset of Web repositories. Treat them as identical: PPM3 downloads the summary or the "index" (file listing in this case), parses it, and then searches from it.

5. Local Repositories

To support installing packages from the ActiveCD, a local directory can be a repository. PPM searches the files in the directory. All valid path formats are supported, including UNC paths.

Why add new Repositories ?
If you are using PPM (Perl Package Manager) from ActiveState, you may only be using ActiveState own repository to grab and install CPAN modules. However, there are many more repositories around the world, which hold many modules and packages tha
t ActiveState haven't yet loaded into their repository.
By adding these extra repositories, when you type 'install ', instead of just looking in the ActiveState repository, PPM will search all the repositories in your list to find ''. Below are instructions of how to add the repositories to your version of PPM.

Add PPM Repositories

PPM Version 3:The latest version of PPM now uses a different syntax to add repositories, so if using an older version see the next section.
Start your copy of PPM, either from the command line or via Start->Run and typing in PPM3. You should then get a nice command window (the DOS window)

To add new Repositories type
rep add [name]
[Location]
where
[name] is user define name for repositories and is Location URL of that repositories

Example :
PPM> rep add DevelopHelp http://ppd.develop-help.com/ppd/

PPM older versionsOlder versions of PPM use a different syntax to the current release.

PPM> set repository [name] [Location]
where
name is user define name for repositories and Location is URL of that repositories.

Example:
PPM> set repository DevelopHelp http://ppd.develop-help.com/ppd/

PPM> set save


Manage PPM Repositories
PPM Provide many commands to manage Repositories. Some are following.

rep delete Deletes specified repository
rep describe
Displays information about the specified repository
rep rename
Renames the specified repository to the given name
rep on
Activates the specified repository
rep off
Removes the repository from the active list
rep up
Moves the specified repository up one
rep down
Moves the specified repository down one

Note :

  • The needs to be put inside double quotes if it contains any spaces.
  • The *repository* (or *rep*) command controls two lists or repositories:
    1. The list of "active" repositories. This is the list of repositories used by *search*, *install*, and *upgrade*.
    2. The list of all known repositories. You can designate a repository "inactive", which means PPM will not use it in any commands.
  • If no arguments are given, the rep command will list the active repositories defined in the PPM settings.
  • The order is significant:
    • When searching, PPM merges the results of all the repositories together, so the order is less important (see the *search* command).
    • When installing a package, PPM will try the first repository, then thesecond, and so on, until it find the package you asked for.

Repositories Resources

Default Repository

Additional Repositories

Perl 5.10

Perl 5.8

My PPM has AS Servers:

Other 5.8 only:

May also work for 5.6:


Perl 5.6

Installing non-ActiveState modules:You can now access a larger number of PPM packaged modules, including mod_perl :
PPM> install mod_