Love songs






Emantaaro........





Ninne ninne koraa....





Nuvvakkadunte....nenukkadunte....





Surah hua maddham....






Nenani...Neevani.....





Nee oohallo ekaantham....





Dil ne ye kaha hai dil se.....



























NInnu nannu...chero jagaalalo atoo itoo padesinaa.....
















kabhi kabhi mere dil mein khyal ata hai





O SATHI RE TERE BINA BHI KYA JEENA




Thuje dekh dekh sonaa.....

















Aanandhamaa....aaraatamaaa....


Konchem Ishtam Konchem Kashtam - Aanandama .mp3
Found at bee mp3 search engine



























Oke oka maata pedavopalenantha thiyyangaa....








Ekkada unna....





Nee jatha leka...

Tester everyday activities

Implement and Provide input for Test Plans.
Design Test Cases.
Create Test scenarios.
Check / Review the Test Cases (TC).
Keep track of the new requirements.
Perform functional testing duties.
Perform regression testing duties.
Report bugs, track defects, resolve issues with the developers.
Track problem reports using a bug-tracking system.
Produce test evaluation reports.
Participate in software walkthrough.
Design Test Plans.
Design Test Cases.
Create Test scenarios.
Check / Review the Test Cases (TC).
Keep track of the new requirements.
Escalate the issues about project requirements.
Perform functional testing.
Preparing test data
Perform regression testing
Track problem reports using a bug-tracking system.
Produce test evaluation reports.
Participate in software design reviews
Participate in software walkthrough.
Manage testing environment.
Lead and facilitate testing.
Provide support to junior team members.
Run and Maintain Test Automation Scripts for regression testing.
Perform CRUD database testing using SQL.
Conduct internal trainings
Provide test planning and assign task to all Testing Team members.
Verify that all Team members have sufficient work.
Organize the meetings.
Prepare the Agenda for the meeting.
Track and report testing activities.
Check for timely delivery of different milestones.
Design or evaluate Test plans
Verify content and structure of all Testing documents and reports.
Motivate team members.
Organize internal trainings
Provide cost/progress/test status reporting
Designed test scenarios for automation.
Create test scripts utilizing automated test tools.
Design concurrency, load and regression testing suits.
Design and Develop API test cases.
Design and write automated regression test packages using scripts, high level languages, and a commercial test tool.
Check / Review the Test Cases (TC).
Perform regression testing
Track problem reports using a bug-tracking system


check list

Test Case Review Checklist
Review Status Remark
Standards
1 Are the Test Case prepared as per the standard Test Case template
2 Do the test steps in the test case adhere to the established standard
Coverage
3 Are the Test Cases covering all aspects of the Functionality
4 Are all the Positive scenarios covered
5 Are all the Negative scenarios and error conditions covered
6 Are all the equivalence classes been defined to exercise input?
7 Are all the boundary tests been derived to exercise the software at its boundaries?
8 Are all the alternative path Test Cases covered
9 Are the Test Cases covering the Usability aspects
10 "Are the functionalities tested with all the relevant data sets ( e.g accounts , orders etc )
"
Traceability
11 Are the Test Cases mapped to Requirement Document or Use case
General
12 "Are the necessary pre-requisites mentioned
"
12 Are the grammatical errors checks and spell checks done
13 Are the Test Case Understandable and presentable
14 Are the Test Cases written as per the logical Flow of the functionality
15 Are the expected result for each Test step mentioned clearly.
16 Is the Test Data needed for testing the Test Case specified
17 Are the Critical Path , BAT and SBT Test Cases Identified

Technology

XML:

XML :-xml doc


XML:-xml

HTML:

html1
html2
html3

Java script:

javascript


selenium:

selenium1

selenim2

selenium3

selenium4

vbscript:

vb
vb2



SQL:

sql1

sql2

sql3

web browser:

web browser

Web server:

web server

java models:

java example

HTML

html COURSEl
html presentation9


html COURSE
html presentation

HTML good one
Html

JAVA SCRIPT
JAVA script presentation

Selenium

Selenium course
Selenium course
Selenium scripting standards
Selenium scripting standards

Selenium presentation
Selenium presentation

Selenium presentation2
Selenium presentation2

SELENIUM IDE
Selenium
IDE is an integrated development environment for Selenium tests. It is
implemented as a Firefox extension and it allows you to record, edit, and debug
tests. Selenium IDE is not only recording tool: it is a complete IDE. Selenium IDE includes the entire Selenium
Core, allowing you to easily and quickly record and play back tests in the
actual environment that they will run. You can choose to use its recording
capability, or you may edit your scripts by hand. With auto complete support
and the ability to move commands around quickly, Selenium IDE is the ideal environment
for creating Selenium tests no matter what style of tests you prefer.
Selenium IDE is also
the easiest way to use Selenium and most of the time it also serves as a
starting point for your automation. Since selenium IDE comes as an extension to
the Firefox web browser. This can be installed from either openqa or mozilla
distribution site. Selenium extension will be downloaded as XPI file. If it is
opened using fileàopen
in Mozilla, it should get installed.
Features:
Record and playback
Autocomplete for all common Selenium commands
Walk through tests
Debug and set breakpoints
Save tests as HTML, Ruby scripts, or other
formats
Advantages:
Selenium IDE is the easiest way to use Selenium
Simple
Easy to install
Easy to work with
only flavor of Selenium which allows you to
record user action on browser window
can also record user actions in most of the
popular languages like Java, C#, Perl, Ruby
It will not record any operation that you do on
your computer apart from the events on Firefox browser window.
During recording if you right click on any
element it will show all the selenium commands available.
You can also edit existing command, by selecting
it and editing on the boxes available.
You can also insert/delete commands by choosing
appropriate option after right clicking.
Choose appropriate run option - i.e walk, run or
test runner and review your results
Disadvantages:
limitation in terms of browser support
Installation:
It is easy to install selenium IDE.
Selenium IDE can be downloaded from the below site.
[http://selenium.openqa.org/]
4.5 Working:
Once the installation is successfully completed,
go to ‘Tools’ in the firefox window. You can find Selenium IDE.°
Click on Selenium IDE
The small red button on the right hand side
gives you an indication on whether Selenium is in recording mode or not. Click
the red button to start recording and click the red button again to stop the
recording.
Run will execute the tests with the
maximum possible speed
Walk will execute them with relatively
slow speed
In Step
mode you will need to tell Selenium to take small steps.
Green tilted triangular button is to execute the
test
Yellow button to pause while executing the test
Blue button helps to place checkpoints
And the final green button is the Selenium TestRunner
Test Runner gives you nice browser interface to
execute your tests and also gives summary of how many tests were executed, how
many passed and failed. It also gives similar information on commands which
were passed or failed. TestRunner is available to tests developed in
HTML only.
In selenium, there is option to start a new
test, save test and open the saved test
It is also possible to export scripts.
We have other self explanatory options like
encoding of test files, timeout under the Options tab.
When we access the Format tab under Options tab,
we have an option as to specify what kind of formatting we would like in the
generated code as Selenium IDE can generate code in variety of languages.
Consider the following example.
Suppose we select
HTML as our language choice for automation under OptionsàFormat, Then an
additional tab called Table appears on the Selenium IDE called the Table. Table
has 3 columns under it, namely, Command, Target and Value.
For any element
present in the browser, selenium maps its action in all the columns
E.g.: you want to
type user name in the user name text box
Selenium will
translate it as:
+Command=type,
Target=username text box and value=your username+





Table of Contents
1.0 Change Log 3
2.0 About Selenium 4
2.1 What is Selenium? 4
2.1.1 What is Selenium IDE? 4
2.1.2 What is Selenium RC? 5
3.0 Installing Selenium 5
3.1 Selenium IDE 5
3.2 Selenium RC 6
4.0 Working with Selenium 7
4.1 Understanding Selenium Script 7
4.2 CVS Checkout 7
4.3 Recording Test Cases 7
4.4 Playing back Test Cases 11
4.5 Data Externalization 13
4.6 GUI Externalization 16
4.7 Library 17
4.8 Test Suites 18
4.9 User Extension 19
5.0 Executing Test scripts 20
5.1 Selenium RC 20
5.2 Test Runner 21
About Selenium
What is Selenium?
Selenium is an acceptance and functional testing tool for web applications. Selenium tests run directly in a browser, just as real users do. And they run in Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintosh.
Link: http://www.openqa.org

What is Selenium IDE?
Selenium IDE is an integrated development environment for Selenium tests. It is implemented as a Firefox extension, and allows us to record, edit, and debug tests. Selenium IDE includes the entire Selenium Core, allowing us to easily and quickly record and play back tests in the actual environment that they will run.
Features:
Easy record and playback
Autocomplete for all common Selenium commands
Walk through tests
Debug and set breakpoints
Save tests as HTML, Ruby scripts, or any other format
Support for Selenium user-extensions.js file
Link: http://www.openqa.org/selenium-ide/



What is Selenium RC?

Selenium Remote Control is a test tool that allows us to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser. Selenium RC provides a Selenium Server, which can automatically start/stop/control any supported browser .It works by using Selenium Core, a pure HTML+JS library that performs automated tasks in JavaScript.
The Selenium Server acts as a client-configured HTTP proxy, to stand in between the browser and the website you want to test. This allows a Selenium-enabled browser to run JavaScript on arbitrary websites.
Visit http://www.openqa.org/selenium-rc to study more about Selenium RC.
Visit http://release.openqa.org/selenium-core/nightly/reference.html to explore Selenium RC Commands
Installing Selenium
Selenium IDE
Pre-requisites:
Firefox version 1.5 or more.
Steps to install:
Open Firefox browser.
Go to http://www.openqa.org/selenium-ide/download.action and download version 0.8.0
Allow for popups and click Install now button.
Selenium IDE gets installed as a Firefox extension.
Re-start Firefox (close all existing Firefox browser windows and open) and choose Tools menu.
Play with Selenium IDE!!!
Selenium RC
Pre-requisites:
Java Runtime Environment (JRE)
Jre and browser executable should be set in PATH.
Steps to install:
Go to http://www.openqa.org/selenium-rc/download.action and download version 0.8.1
Unzip the archived file.
Voila RC!!!
Open the corresponding folder in a terminal and set the browser executable and JRE in the PATH variable.

Working with Selenium
Understanding Selenium Script
The test scripts can be recorded by using Selenium IDE or written manually.
The Selenium test script is a plain html table which will consist of the Command (Selenium Command), Target and the Value, and the script will be in simple readable and understandable format.
Selenium IDE also provides the option of converting this html/selenese script generated to other formats like java, ruby, Perl, python, C#.
(Refer to Appendix – I for a Walkthrough of a sample Selenium Script)
CVS Checkout
Check out the Regression_Testing folder from the Final folder of the repository given below
Server Name : cvsserver.etrade.com
Repository Name : QA_Automation
Complete Folder path : /etrade/cvsserver/cvs/QA_Automation/Selenium


Recording Test Cases


Step1. After installing Selenium IDE, we can open Selenium IDE from the Tools menu of firefox as shown below.



Step2. Once opened, it is automatically in record mode. Otherwise we can change it to record mode by clicking the red button present in the right side of the Selenium IDE.



Step3.
After doing this, minimize the Selenium IDE and proceed with the steps as per the test case. All events will be recorded by Selenium IDE as a test script.
Step4. We can also edit the test scripts using IDE by modifying the command, target, value triplet.
Command: The Selenium command. We can rightclick to get a list of all commands.
Target: Target is an item on which an action is performed.
Value: Value is the data associated with the action we perform.
Eg. If we are typing text in a textbox, type is the command, the locator name of the text box is the target and the text to be entered is the value.


Step5.
After recording we can save the script by giving .html extension.

Playing back Test Cases

Step1. Once the recording process is over, we can play back the test script by clicking the green button over the Selenium IDE as shown below.


Step2. As each command in the test is executed, the cell that contains the command turns either red or green. If an assertion fails, then the cell turns red. Otherwise, if the step succeeds, the cell turns green.

We can execute the test case in IDE in Run, Walk and Step modes. When we run a test, the test is executed from start to finish without pause. When we walk a test, the test is executed from start to finish with a pause between each step. Finally, when we step through a test,we must click the Step button to advance to each new step in the test.

Data Externalization
Data-Externalization is done for insulating the code from data changes .Test Scripts are driven by data from a spreadsheet we maintain for this purpose .For externalizing the data, we should have one ‘.xls’ file and one ‘.html’ file. The .html file would be generated from .xls file using the Excel-to-HTML-converter java program. Data required for the testcase are picked from this html file based on the logical name given.
Consider one scenario in which we are entering the stock symbol as ‘GOOG’. This data may change at some time in the future, or we may like to run the test case for another stock. So in this case we will externalize this data such that the locator name in externalization sheet would be ‘GOOG’ and the logical name would be something like ‘PlaceOptionOrder_txt_OptionSymbol_value’ in accordance with the naming standards.In the test script we would replace the locator name with the logical name. So if the symbol changes that wouldn’t affect the script. We have to just go in to the .xls sheet and change the locator name.
Step1: Create one .xls file and specify the actual value in the Locator Name column and the Logical value (our choice) in the corresponding Logical Name column, as shown below. Create one .html file from this .xls sheet using the java program. We have to pass the location of the .xls file as the argument. ( java )

Step2: Open the .html file from Selenium IDE using the ‘open’ command and map (using the storeText command) the corresponding actual values to Logical values as shown below.
We can externalize the login account numbers also; thus we can change the account numbers without affecting the script. These externalization files can be found at Regression_Testing/Data_Externalization/Common/
Similarly URLs are externalized too. The file which contains the URLs used is Regression_Testing/Data_Externalization/Misc/URLS.html


Step3: And in Selenium IDE, instead of the actual name specify the corresponding Logical Name as ${Logical Name}. So if in case the actual value changes that won’t affect the script because here we have specified only the Logical Names.

GUI Externalization
GUI-Externalization is for insulating the code from GUI changes. The process is similar to Data-Externalization. Instead of data, here we will externalize the value of text boxes, buttons, table locations, images and links so that when Webdev changes are made, we need not change the script.

Eg. , The above screen shot, the webdev name for the quantity text box is “quantity”. If in the future it is changed to say “stockquantity” our test script would fail.
To avoid this, we can give a logical name for this text box say PlaceStockOrder_txt_quantity and store the actual name in the .xls file against this logical name. In the testscript we can use ${ PlaceStockOrder_txt_quantity } instead of the webdev name.


Library

A set of commands may be common to more than one test case. We can use Libraries to achieve code re-use.
Libraries are also saved with a .html extension and they can be included in a test using the syntax
Include
In the below screen shot, we have included one login library BOPS_login.html . This library does the login functionality that is common for many testcases.

Note: If we have included a library in a test script, we can’t run that test script using Selenium IDE. To run test cases which use libraries, we should use test runner (See sec 5.2 for details).


Test Suites
A test suite is simply a list of Selenium tests. We can create a test suite by creating an HTML page with a list of links to individual tests. For example, the following page is a test suite that contains four tests.

head
title Test Suite title
head
body
table
tbody
Test Suite tr td
a href="./TestOpen.html"TestOpen
a href="./TestClick.html"TestClicktr td
a href="./TestType.html"TestType trtd
a href="./TestSelect.html"TestSelecttbody
table
body



User Extension

We can add additional functionality other than those provided by Selenium commands by writing and using User extensions.
User Extensions are written purely in Java Script.
Eg. To include libraries, the user extension user-extensions.js is used.

Step1. Save the user extension with .js extension in the Regression_testing/User_Extensions folder.
Step2. Open IDE. Select from the menu Options -> Options. Select the General tab.

Specific the location of the user extension in the Selenium Core extensions text box. If there is more than one extension, they can be delimited by a comma.
Step3. Apply Changes and restart IDE.

Executing Test scripts
Selenium RC
We run a test suite in RC by executing the below command
cmd=runHTMLSuite&1=*chrome&2=""&3=test suite filename&4=true&5=resultfilename
Executing the above command will start the Test Runner Browser and prompt the tester to select the test scripts to run. The tester can ask for the selective test scripts to run or can also select all the test scripts to run by selecting Run All option.
In all the cases the scripts will be run in the same order in which it is being referenced in the Test Suite and will generate a test report in the html format specifying the number of passes & failures along with their simple comments on failure.
Test will proceed uninterrupted by default in Selenium RC, i.e. even if one test case in the Test Suite fails due to assertion or any other reason, rest of the test cases will continue to get executed uninterruptedly.

Test Runner
From IDE if we press the test runner button (next to the Record button) Test runner would be opened. The Selenium TestRunner page enables us to execute any suite of Selenium tests.
The test runner page is divided into 3 frames. The left frame lists the test cases in the suite which we have opened. The Middle frame shows the current test case being run. Similar to IDE, the execution of the steps can be seen. The frame on the right is the control panel.
We can set the pace of execution using the slider in the control panel. If we click on the All button, all the test cases in the suite would be executed. We can also selectively run test cases by selecting them and clicking on the Selected button.
The result of running the test case (Pass or Fail) is also displayed in the control panel.
The actual application in which the test script is being executed is shown in a window below the test runner window.


URL for running suites through Test Runner:
chrome://selenium-ide/content/selenium/TestRunner.html?test=&multiWindow=true&userExtensionsURL=&baseURL=

Open command is used to open a file located at a particular location, in value option of IDE you have to specify the correct path where the file is located.

storeText
Locator Name0
BOPSAccountManagement_lnk_AccountSearch

Storetext command is used to store location of actual name. In value column we have to store the variable name given by us.
Use variable name in place of actual name in your script as ${variable name} for each element that you have recorded.



Include command is used to include libraries in your automation script. As shown above it is using a library named as BOPS_login-agupta5-genie13.html, this library will contain url and also login ID and password files .Libraries are means of achieving code reuse.(Commonly used set of commands can be made a library).


Here we are using a textbox where we have to provide the value Account No. In target we have used the variable name as ${BOPSHome_txt_AccNO} and value is provided as ${AccountNum}.



clickAndWait
${BOPSHome_btn_AccNoSubmit}


ClickAndWait is the command to click on a button and wait for the subsequent event to happen.
We have externalized the button name as ${BOPSHome_btn_AccNoSubmit}.



assertText
//form/table/tbody/tr[1]/td/table/tbody/tr/td/table/tbody/tr/td[2]
The start date is before the end date. Please re-enter.


AssertText is used when we have to verify some information while playing back. Suppose we have to verify the presence of a link, we can use asserttext or assertextpresent to do that.
If whatever we have asserted is present then it will pass otherwise the script will fail.



Few more commonly used commands:

1) waitforpopup: This command is used when we are opening a popup window, it will include some wait time so that popup window will open before any other command is executed. Format of the command will be as shown below. Target is the name of popupwindow and value is wait time in milli seconds.

Command Target Value
waitForPopUp wf 30000

2) assertLocation:This command is used to varify a url.Format is as below. Here we are asserting a url to verify that the page going to the correct url.

Command Target Value
assertLocation https://uu.com/e/t/onlineenroll/unifiedenrollment

3) waitForElementPresent:We use this command when we want to wait till the target is properly loaded in the webpage.

Command Target Value
waitForElementPresent ${Home_tab_OpenAccnt}


4) store:This command is used to store some value that we want to use later in our script, at that point we will give a variable name use to store that value. This variable can be used later on in the test case for any calculation etc.

Command Target Value
store IRA - Contributory OnlineAcctAppl_AccountType_Value


5) close:This command is used to close the popup window. In target column give name of the popup window you want to close.


Command Target Value
close wf

webserver

Web server
A computer, including software package, that provides a specific kind of service to client software running on other computers. More specifically, a server is a computer that manages and shares web based applications accessible anytime from any computer connected to the Internet.
Web browser
Specific to the Web, a Web server is the computer program (housed in a computer) that serves requested HTML pages or files. A Web client is the requesting program associated with the user. The Web browser in your computer is a client that requests HTML files from Web servers

HTTP:
(HyperText Transport Protocol) The communications protocol used to connect to servers on the World Wide Web. Its primary function is to establish a connection with a Web server and transmit HTML pages to the client browser. Addresses of Web sites begin with an http:// prefix; however, Web browsers typically default to the HTTP protocol. Web browsers communicate with Web servers via the TCP/IP protocol. The browser sends HTTP requests to the server, which responds with HTML pages and possibly additional programs in the form of ActiveX controls or Java

GET method is used to request a resource from the server.
POST method is used for passing user input to the server. POST stores all parameter info in the body than in the URL.

What is "URL Encoding"?
URL Encoding is a method by which a string is converted into a format which is suitable for HTTP URL.
Example : Server.URLEncode("sitename=imilap")

test cases

test cases:test cases

Tesing Resources

Interview Questions:

Interview Questions:

web application testing:

web application testing


Testing resources:
Testing resources

web apllication testing:

web apllication testing

VB Script

VBSCRIPT reference : BAsics of vbscript

Refer advanceqtp.com or google docs for advanced vb script

java examples

public class Ello{
public static void main(String[] args){
System.out.println( "Ello");
}
}



public class TestEx {
static class Ex1 extends Exception {}
static class Ex2 extends Ex1 {}
static class Ex3 extends Exception {}

static void method1() throws Ex1, Ex2, Ex3 {
throw new Ex2(); }

public static void main(String args[]) {
try {
method1();
method1();
}
catch (Ex3 e) { System.out.print("C"); }
catch (Ex2 e) { System.out.print("B"); }
catch (Ex1 e) { System.out.print("A"); }
catch (Exception e) { System.out.print("D"); }
finally { System.out.println("F"); }
}
}



public class Test {
public static void main(String[] args) {
if (args[0].equals("b") && checkFoo(args)) {
System.out.println("if evaluated to true.");
}

System.out.println("x");
}

private static boolean checkFoo(String[] args) {
System.out.println("Checking..");

return args.length > 0;
}
}



public class A {
int i=0;
public A() { i=8; }
public static void main(String args[]) {
A h = new A();
while (h.i <= 10) h.doIt();
}
public static void doIt() {
i++;
System.out.println("Hello");
}
}



char ch1 = 0, ch2 = 0;
try { ch1 = (char) System.in.read(); }
catch (Exception e) {}
switch (ch1) {
case 'a':
ch2 = '1';
case 'b':
ch2 = '2';
case 'c':
ch2 = '3';
default:
ch2 = '4';
}




public class Test {
public static void main(String[] args) {
foo("foo");
foo(new String("foo"));
foo("bar");
}

private static void foo(String arg) {
if (arg == "foo") {
arg = "1";
} else if (arg.equals("foo")) {
arg = "2";
} else if (arg.equals("baR")) {
arg = "3";
} else {
arg = "4";
}

System.out.print(arg);
}
}

sql commands

SQL present
SQl

Sql Presentation
SQl presentation

1.select first_name, last_name from employees where salary>=10000;




2.select first_name, last_name, department_name from employees ,departments
where employees.department_id = departments.department_id;



3.select first_name, last_name, department_name, job_title
from employees,departments, jobs where employees.department_id=departments.department_id
and employees.job_id = jobs.job_id;

4 select department_id,count(*) from employees group by department_id;

5select job_id, count (*) from employees group by job_id;


6select job_title , count(*) from employees, jobs
where employees.job_id = jobs.job_id group by job_title;

nsert into student

(student_id, student_name, email)
values
(105, 'anu', 'andu4u@yahoo.com');
select * from student;
commit;
select * from student;

update student set student_name = 'anu'
where student_id = 105;\



select * from student order by student_id;
select * from student;


alter table student add unique index (email);

select email, count(*) from student
group by email;



update student
set email='mgavr@hotamil.com1' where student_id = 100;



commit;



select * from student order by student_id;
commit;
select * from student;


create view employee_full_info as
select first_name, last_name, department_name, job_title
from employees e, departments d, jobs j where e.department_id = d.department_id
and e.job_id = j.job_id;



select rowid,e.* from employees e;

select * from employee_full_info;
select department_name,
count(*) from employee_full_info
group by department_name;


delete from student where student_id = 105;

select * from student;

commit;

select first_name, last_name,email from employees;
select job_id,job_title from jobs;
select e.first_name,e.last_name,e.email,j.job_title
from employees e ,jobs j where e.job_id=j.job_id;

select d.department_name,l.city ,c.country_name,r.region_name
from departments d,locations l ,countries c,regions r
where l.location_id=d.location_id
and l.country_id=c.country_id
and c.region_id=r.region_id;

select e1.first_name|| ' ' ||e1.last_name as employee_name,
e2.first_name|| ' ' ||e2.last_name as manager_name,
nvl(e2.email,'N/A') as manager_email
from employees e1, employees e2
where e1.manager_id=e2.employee_id(+);


select * from employees where salary <5000
or salary>10000;

select * from employees where salary < 5000
union all
select *from employees where salary > 10000;

select * from employees where salary >10000
minus
select *from employees where salary > 12000;


select e.first_name,e.last_name ,d.department_id ,l.city from
employees e, locations l,departments d
where e.department_id=d.department_id
and d.location_id=l.location_id
and l.city='Seattle';

select first_name,last_name from employees where department_id in
(select department_id from departments where location_id in
(select location_id from locations where city='Seattle'))

QTP imp functions


To get getTableData
Function for CountRecords
convNumb
ConvNumbWCents
Function handle unexpected Window on Page
checkStringLength(strBrowser, strPage ,strTable, ReqNum)
Page Wait specify time in intTime parametr
verifyWebElement(strBrowser, strPage, strName, strTag)

Function getRandomNum(RandNum)

dropDowngetValue Get value from dropdown list

For initial sorting function get dataType
Function getRandomNum(RandNum)
clickRadio
GetColumnNumber
ValidateCellData
Function generates random number
Function CompareStrings
Function getLookUp
Select Multiple items from the Web List
To get getTableData

Function getTableData(strBrowser, strPage, strTableID, strFind, strFindMore)

Dim objBr, objPg, objTbl
Dim intCount, intRow, intCol, blnFound

On Error Resume Next
getTableData = -1
Set objBr = Browser("name:=" & strBrowser)
Set objPg = objBr.Page("title:=" & strPage)
Set objTbl = objPg.WebTable("html id:=" & strTableID, "html tag:=TABLE")
If objTbl.Exist = False Then
Set objTbl = objPg.WebTable("name:=" & strTableID, "html tag:=TABLE")
If objTbl.Exist = False Then
Err.Clear
Exit Function
End If
End If

intCount = objTbl.RowCount
blnFound = False

For intRow = 1 To intCount
For intCol = 1 To objTbl.ColumnCount(intRow)
If InStr(objTbl.GetCellData(intRow, intCol),strFind) > 0 Then
If Len(strFindMore) > 0 Then
For intF = intCol To objTbl.ColumnCount(intRow)
If InStr(objTbl.GetCellData(intRow,intF),strFindMore) > 0 Then
blnFound = True
getTableData = 0
Exit For
End If
Next
Else
blnFound = True
getTableData = 0
End If
End If
If blnFound Then Exit For
Next
If blnFound Then Exit For
Next
If Err.Number <> 0 Then
Err.Clear
End If
End Function
'===========================================

Function for CountRecords

Public Function CountRecords(strBrowser, strPage, strHTML, intExpected, outResult)

On error resume Next
CountRecords = -1

Set objPage = Browser("name:="&strBrowser).Page("title:="&strPage)
objPage.sync
Set objCount = objPage.Object.all.Tags(strHTML)

intActual = objCount.length

If abs(intExpected) = abs(intActual) Then
outResult = "<< PASS >> expected " & intExpected & " , actual result " & intActual & " records."
Err.clear
CountRecords = 0
Exit Function
else
outResult = "<< COMMENT >> expected " & intExpected & ", actual result " & intActual & " records."
Err.clear
CountRecords = 0
Exit Function
End If
'Err.clear

End Function


convNumb

Function convNumbWN(inpNum,outNum)
On Error Resume Next
Dim iSLen, iComma, iComma1,i,j,k
Dim sWork
inpNum=Trim(inpNum)
If InStr(1,inpNum,".") =0 Then
iSLen=Len(inpNum)
iComma = iSLen\3
iComma1 = iSLen/3
outNum=""
If iComma=iComma1 Then
iComma=iComma-1
End If
For i=1 to iComma
j=i*3
sWork=Mid(inpNum,iSLen-j+1,3)
outNum=","&sWork&outNum
Next
k=iSLen-j
sWork=Mid(inpNum,1,k)
If outNum="" and sWork="" Then
outNum="0"
End If
outNum=sWork&outNum
else
outNum=inpNum
end if
On Error Resume Next
convNumb=0
If Err.Number <> 0 Then
convNumb=-1
Err.clear
Else
convNumb= 0
End If
Err.Clear
End Function


ConvNumbWCents
Function ConvNumbWCents(inpNum,outNum)
Dim sWork,sWork2,sWork3
Dim i
i=InStr(1,inpNum,".")
sWork2=Mid(inpNum,1,i-1)
sWork=Mid(inpNum,i,3)
convNumbWN sWork2,sWork3
outNum=sWork3&sWork
End Function


' Function handle unexpected Window on Page
' strBrowser - Name of the Browser
' strPage - Title of the Page
'
''' s = UnexpectedWindow("Cv Portal","CV Portal",strOutput)

public Function UnexpectedWindow(strBrowser,strPage)

On error resume next
Set objPage = Browser("name:="&strBrowser)
objPage.sync
Set unexpectedWin = objPage.Dialog("regexpwndtitle:=Microsoft Internet Explorer")

If unexpectedWin.exist Then
unexpectedWin.WinButton("regexpwndtitle:=OK").Click
UnexpectedWindow = 0
Else
UnexpectedWindow = -1
End If
IF Err.Number > 0 Then
Err.Clear
End IF

End Function

''' ================================================
''' checkStringLength(strBrowser, strPage ,strTable, ReqNum)
''' ================================================
Function checkStringLength(strBrowser, strPage ,strTable, ReqNum)
On error resume next
checkStringLength = -1
Set objPage = Browser("name:="&strBrowser).Page("title:="&strPage)

strCell = objPage.WebTable("html id:="&strTable).GetCellData(4, 5)
If Len(strCell) <= ReqNum Then
checkStringLength = 0
End If

If Err.number > 0 Then
Err.Clear
End If
End Function

''' Page Wait specify time in intTime parametr
''' ================================================
Function pageWait(intTime)
On error resume next
wait (intTime)
If Err.Number <> 0 Then
Err.Clear
End If
pageWait = 0
End Function

'' verifyWebElement(strBrowser, strPage, strName, strTag)
''' ================================================
Function verifyWebElement (strBrowser, strPage, strName, strTag)
On error resume next
verifyWebElement = -1
Set objPage = Browser("name:="&strBrowser).Page("title:="&strPage)
Set objTags = objPage.Object.all.Tags(strTag)

For each Element in objTags
If inStr (Element.innertext, strName) > 0 Then
verifyWebElement = 0
Err.Clear
Exit Function
End If
Next

If Err.number > 0 Then
Err.Clear
End If
End Function


Function getRandomNum(RandNum)

Function getRandomNum(RandNum)

RandNum = RandomNumber (100000000, 999999999)

Err.Clear
getRandomNum = 0

End Function

''' dropDowngetValue Get value from dropdown list
''' ================================================
Function dropDowngetValue (strBrowser, strPage, strName, strValue)

Dim objPage, objPageTags
On error resume next

Set objPage = Browser("name:="&strBrowser).Page("title:="&strPage)
Set objPageTags = objPage.Object.all.Tags("option")

For each Element in objPageTags
If Trim( Element.innertext) = Trim(strValue) Then
If Trim(Element.value) = Trim(strValue) Then
dropDowngetValue = 0
Err.clear
Exit Function
End If
End If
Next
dropDowngetValue = -1
Reporter.ReportEvent 1, "Fail", strValue & "does not exist"
Err.clear

End Function

''' For initial sorting function get dataType

''' =================================================
Function getDatatype(rulesString, delimeter)
Dim arRule
On error resume next
arRule = Split (rulesString, delimeter)
If err.number > 0 Then
getRulesType = -1
err.clear
Exit Function
End If
getDatatype = arRule
End Function



Function getRandomNum(RandNum)



Function closeAllBrowsers()
Dim n
set oDesc = Description.Create()
oDesc("micclass").Value = "Browser"
Set bs = Desktop.ChildObjects(oDesc)
n = bs.count
For i = 0 to n-1
if not bs(i).GetROProperty("title")="Mercury Quality Center" then bs(i).Stop : bs(i).close()
Next

end Function


clickRadio

Function clickRadio(strBrowser, strPage, strValue)
''' c = clickRadio("CreditView Portal", "CreditView Portal", "portlet_creditProd_overviewwlw-radio_button_group_key:{actionForm.creditProductDetailsVO.guaranteesCollateralCodeFlag}")
On error resume next
Dim objPage

Set objPage = Browser("name:="&strBrowser).Page("title:="&strPage)
objPage.sync
Set objPageTagInput = objPage.Object.all.Tags("input")

For each Element in objPageTagInput
If Trim(Element.value) = Trim(strValue) or Trim(Element.id) = Trim(strValue) or Trim(Element.name) = Trim(strValue) Then
Element.click
clickRadio = 0
Err.clear
Exit Function
End If
Next
clickRadio = -1
Err.clear
End Function

GetColumnNumber(


GetColumnNumber

Function GetColumnNumber(strBrowser, strPage, strTableID, strHeader)

Dim objBr, objPg, objTbl
Dim intR, intC, blnFound

On Error Resume Next
GetColumnNumber = -1
Set objBr = Browser("name:=" & strBrowser)
Set objPg = objBr.Page("title:=" & strPage)
blnFound = False
Set objTbl = objPg.WebTable("html id:=" & strTableID, "html tag:=TABLE")
If objTbl.Exist =false Then
Set objTbl = objPg.WebTable("name:=" & strTableID, "html tag:=TABLE")
End If
For intR = 1 To objTbl.RowCount
If Not blnFound Then
For intC = 1 To objTbl.ColumnCount(intR)
If Trim(objTbl.GetCellData(intR, intC)) = strHeader Then
blnFound = True
GetColumnNumber = intC
Exit For
End If
Next
End If

Next

If Err.Number <> 0 Then
Err.Clear
End If

End Function



ValidateCellData


Public Function ValidateCellData(strBrowser, strPage, strTable, strFind, blnSelect, strHeader, strEspected )
On error resume next
Dim objBr, objPg, objTbl, data
ValidateCellData = -1
strRow = GetRowNumber(strBrowser, strPage, strTable, strFind, FALSE )
' msgbox strRow
strCol=GetColumnNumber(strBrowser, strPage, strTable, strHeader)
'msgbox strCol

Set objPg = Browser("name:="& strBrowser).Page("title:="& strPage)
Set objTbl = objPg.WebTable("html id:=" & strTable, "html tag:=TABLE")
strActual = objTbl.ChildItem(strRow, strCol, "WebEdit", 0).GetROProperty("value")
If abs(strActual) = abs(strEspected) Then
ValidateCellData = 0
End If
'objTbl.ChildItem(strRow, strCol, "WebEdit",0).GetROProperty("value").Set(123456)

If Err.Number <> 0 Then
Err.Clear
End If

End Function

' Function generates random number , based on parameters
' intIndex - length of number
' strOutPut - output number
' function returns 0 -success, -1 - failure
'============================================================================================
Function RndNum(intIndex, strOutPut)
On Error Resume Next
Dim intFirst, intLast, intRest, intTimes, strTemp
RndNum = 0
If intIndex < 1 Then
strOutPut = 0
Exit Function
End If
'find reminder
intRest = intIndex Mod 9
' find how many times by 9 needs to be executed
intTimes = intIndex - intRest
If intTimes > 0 Then
intTimes = (intIndex - intRest)/9
End If
If intTimes = 0 Then
intFirst = CLng(1 & String(intIndex-1,"0"))
intLast = CLng(String(intIndex,"9"))
strTemp = RandomNumber(intFirst,intLast)
Else
For i =1 to intTimes
strTemp = strTemp & RandomNumber(100000000,999999999)
Next
If intRest > 0 Then
intFirst = CLng(1 & String(intRest-1,"0"))
intLast = CLng(String(intRest,"9"))
strTemp = strTemp & RandomNumber(intFirst,intLast)
End If
End If
strOutPut = strTemp
If Err.Number <> 0 Then
RndNum = -1
End If
End Function

Function CompareStrings
======================================================================
Public Function CompareStrings(strBrowser, strPage, strTable, strFirst, strSecond, strThird, strOutput)
On error resume next
CompareStrings = -1
Set objPg = Browser("name:="& strBrowser).Page("title:="& strPage)
Set objTbl = objPg.WebTable("name:=" & strTable & ".*")
intRowCount = objTbl.RowCount - 2 ' the last record
'intColCount = objTbl.ColumnCount(intRowCount)

strActual = trim(objTbl.GetCellData(intRowCount,5))
strExpected =trim( "Min"&strFirst&",Inc"&strSecond&",Max"&strThird)
If instr(strActual, strExpected) <> 0 Then
strOutput = "PASS. Pricing option validation pass." & vbCrLf & "Expected result: <" & strExpected & ">" & vbCrLf & "Actual result: < " & strActual & "> are matched"
else
strOutput = "FAIL. Pricing option validation fail" & vbCrLf & "Expected result: <" & strExpected & vbCrLf & "and Actual result:<" & strActual & "> are not matched"

End If

CompareStrings=0

If Err.Number <> 0 Then
Err.Clear
End If
End Function

Function CloseBrowser
'Browser("title:=Popup Select").Close
'end Function

Function closeBrowser()

On Error Resume Next

browser("index:=0").close

if not Err.Number = 0 then
closeBrowser = -1
Err.clear
exit function
end if
closeBrowser = 0
End Function

Function getLookUp
Public Function getLookUp(strBrowser, strPage, strRadioGroup, strSimple, strOutput)

On error resume next
Dim objPage, objTagsString, objTagsRadio, Element,objTagsSpan,arrayElement(),counter
Dim testArrayLinks

Set objPage = Browser("name:="&strBrowser).Page("title:="&strPage)
objPage.sync
' Set objTagsRadio = objPage.Object.all.Tags("input")
Set objTagsSPAN = objPage.Object.all.Tags("SPAN")

If objTagsSPAN.length <> 0 Then
counter = objTagsSPAN.length

ReDim arrayElement(counter)
' ReDim arrayInputs(counter)

For i = 0 to counter - 1
arrayElement(i) = objTagsSPAN.item(i).innertext
' arrayInputs(i) = objTagsRadio.item(i).value
Next
y = 0
For each Element in objTagsSPAN
If instr(Element.innertext, strSimple)<>0 Then
strOutput= Left(Element.innertext,Instr(Element.innertext,"#")-2)
Set r = Element.ParentNode.ParentNode.GetElementsByTagName("input")

If r(0).checked = FALSE Then
' r(0).checked = TRUE
r(0).Click
getLookUp = 0

err.clear
Exit Function
else
Reporter.ReportEvent 1, "Radio Button was not found", strName & "Was not found on the page."
getLookUp = -1
err.clear
Exit Function
End If
End If
y = y+1
Next
End If
End Function


'' Select Multiple items from the Web List.
''' ============================================================
Function selectAllitems(strBrowser, strPage, strListName, strFlag, strName, outPut)
'''' c = selectAllitems(" Portal", " Portal", "portlet_collateral_detailswlw-select_key:{actionForm.selectedPledges}", "One", "Customer 4",outPut)
On error resume next
Dim itemCount
selectAllitems = -1
Set obj = Browser("name:=" & strBrowser).Page("title:=" & strPage)
Set objList = obj.WebList("name:=" & strListName)
itemCount = obj.WebList("name:=" & strListName).GetRoProperty("items count")

If itemCount <= 0 Then
selectAllitems = 0
outPut = "<< ERROR >> No Items found in the List to Select."
Exit Function
else
Select Case strFlag
Case "All"
For i = 0 to itemCount - 1
objList.ExtendSelect ("#" & i )
Next
selectAllitems = 0
outPut = "<< COMMENT >> " & itemCount & " items found and selected in the List."
Case "One"
objList.ExtendSelect (strName)
selectAllitems = 0
outPut = "<< COMMENT >> " & strName & " found and selected in the List."
End Select
End If
If err.number <> 0 Then
outPut = err.description
err.clear
End If
End Function

QTP script

This script is to check checkbox in yahoologin page

Set obj=Description.Create
obj("html tag").value="INPUT"
obj("type").value="checkbox"

set a=Browser("name:=Yahoo! Mail: The best web-based email!").Page("title:=Yahoo! Mail: The best web-based email!").ChildObjects(obj)

a(0).set"ON"





Set a=Description.Create
a("html tag").value="input"
a("type").value="checkbox"

Set b=Browser("name:=").Page("title:=").childobjects(a)
c=b.count
msgbox c

For i=0 to c-1
b(i).set "on"
Next




D.P for checkbox
Script to check whether yahoologinpage(www.yahoomail.com) checkbox is checked or not

Set g=Browser("name:=Yahoo.*").Page("title:=Yahoo.*")
Set obj=Description.Create
obj("htmltag").value="Input"
obj("ClassName").value="webcheckbox"
obj("type").value="checkbox"
Set a=g.childobjects(obj)
c=a(0).getroproperty("checked")
msgbox(c)
If c=0 Then
msgbox "checkbox is not checked"
else
msgbox"checkbox is checked"
End If





Descriptive Programming for Gmail Login Page

Browser("name:=Gmail.*").Page("title:=Gmail.*").WebEdit("name:=Email").Set "abc"
Browser("name:=Gmail.*").Page("title:=Gmail.*").WebEdit("name:=Passwd").SetSecure "xyz"
Browser("name:=Gmail.*").Page("title:=Gmail.*").WebButton("name:=Sign in").Click
Browser("name:=Gmail.*").Page("title:=Gmail.*").Frame("name:=v1")
.Link("name:=Sign out").Click







How to run QTP script from command prompt?

How to run QTP script from command prompt?
How to run QTP script from command prompt?

1) Set up the scheduler to invoke or execute the VBS File

2)make sure that you specify path


Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable
Dim qtResultsOpt 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible

' Set QuickTest run options
qtApp.Options.Run.CaptureForTestResults = "OnError"
qtApp.Options.Run.RunMode = "Fast"
qtApp.Options.Run.ViewResults = False
qtApp.Open , True ' Open the test in read-only mode

Set qtTest = qtApp.Test

qtTest.Settings.Run.IterationMode = "rngAll" ' Run only iterations 2 to 4
qtTest.Settings.Run.OnError = "NextStep" ' Instruct QuickTest to perform next step when error occurs
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
qtResultsOpt.ResultsLocation = ' Set the results location

qtTest.Run qtResultsOpt ' Run the test




Descriptive Programming for Yahoo Login Page
SystemUtil.Run"iexplore","http://www.yahoomail.com"
Set g=Browser("name:=Yahoo.*").Page("title:=Yahoo.*")
g.WebEdit("name:=login").Set "aaa"
g.WebEdit("name:=passwd").SetSecure "bbb"
g.WebButton("name:=Sign In").Click
g.Link("name:=Inbox.*",
"html id:=WelcomeInboxFolderLink").Click
g.Link("name:=Sign Out").Click

SystemUtil.Run"iexplore","http://www.yahoomail.com" statement opens yahoo login page
aaa=username
bbb=password




descriptive programming for google search page



SystemUtil.run "iexplore","http://www.google.com"
Browser("name:=Google.*").Page("title:=Google.*").WebEdit
("name:=q").set"Testing"
Browser("name:=Google.*").Page("title:=Google.*").WebButton
("name:=Google Search").Click


Login SIt/UAT environments

Dim Lenvironment
Dim Lurl

Environment.LoadFromFile ("\\wc-a0186-qa-01\users\vmahesh\My Documents\Automation\Startdetails\Set-up.xml")
Lenvironment = Environment.Value("TestEnv")
LUrl = Environment.Value("Url")
Systemutil.Run "C:\Program Files\Internet Explorer\IEXPLORE.EXE",LUrl

If (Browser("ServiceView PeopleSoft").Page("ServiceView PeopleSoft").WebElement("Channel Secure Enabled"). Check (CheckPoint ("Channel Secure Enabled")) = "True") then
Reporter.ReportEvent micPass,"Service Page Launch", "Service Page launch successfull"
else
Reporter.ReportEvent micFail,"Service Page Launch", "Service Page launch failed. Page did not load"
ExitTest
End If

If (Lenvironment = "SIT") then
If ( Browser("ServiceView PeopleSoft").Page("ServiceView PeopleSoft").Link("Systems Integration Test").Exist(4) = "True" )Then
Reporter.ReportEvent micPass, "Service View page - SIT link", "SIT link in page exists"
Browser("ServiceView PeopleSoft").Page("ServiceView PeopleSoft").Link("Systems Integration Test").click
RunAction "SV Login", oneIteration
else
Reporter.ReportEvent micFail, "Service View page - SIT link", "SIT link in page does not exists"
ExitTest
End If
End If

If (Lenvironment = "UAT") then
If (Browser("ServiceView PeopleSoft").Page("ServiceView PeopleSoft").Link("UserAcceptance Testing").Exist(4) = "True" )Then
Reporter.ReportEvent micPass, "Service View page - UAT link", "UAT link in page exists"
Browser("ServiceView PeopleSoft").Page("ServiceView PeopleSoft").Link("UserAcceptance Testing").Click
RunAction "SV Login", oneIteration
else
Reporter.ReportEvent micFail, "Service View page - UAT link", "UAT link in page does not exists"
ExitTest
End If
End If

Useful links for QTP

http://www.twango.com/media/ankurj.public/ankurj.10003
QTP tutorial

http://www.kabinfo.net/kabinterviews/

Testing info

http://www.chetanasforum.com/lofiversion/index.php/f27.html

chetanasforum

www.softwaretestinghelp.com/preparation-of-qtp-interview-questions/

Learning basics of QTP automation

http://www.ameerpet.in/Messages.aspx?forumid=947&topicid=40&ftype=1

Testing Interview Qns

http://softwareqatestings.com/content/view/70/97/

softwareqatestings

http://www.bugtest.info/quick-test-professional-questions-answers-part-2/

quick-test-professional-questions-answers

http://mercuryquicktestprofessional.blogspot.com/2007/10/vb-script-and-qtp-part1.html

Good site for test automation

http://www.software-automation.org/forum/search.php?search_author=jerome

software-automation

www.software-automation.org/forum/viewtopic.php?t=382&view=next

automation forum

http://www.software-automation.org/forum/index.php

software-automation

http://www.advancedqtp.com/knowladge-base/scripting-quicktest-professional/

advancedqtp

http://www.knowledgeinbox.com/documents/closingprocesses.html

knowledgeinbox

http://www.techinterviews.in/all-interview-questions/3

techinterviews

http://geocities.com/xtremetesting/

xtremetesting

http://www.ittestpapers.com/interviewquestions/testing15.htm

ittestpapers

http://software-testing-askme.blogspot.com/2007/05/software-testing-resources-speedlinking.html

Testing info

http://testingsoftware.blogspot.com/2005/07/all-posts.html

knowledge about software testing

http://software-testing-zone.blogspot.com/2007/05/software-testing-for-freshers-tested.html

For freshers,,how to get started.

http://www.softwareqatest.com/

QA and Testing Resource Center

http://www.qaforums.com

qaforums

http://my330space.wordpress.com/2006/05/18/interview-question-of-qtp/

Interview questions of QTP

http://www.openqa.org/selenium/

Selenium

user functions2


Function load data from Word Doc to XML file

Function GetTableData2
Function GetColumnNumber

Function clickRadio
Function getDatatype
Function dropDowngetValue

Function getRandomNum
Function verifyWebElement
Function pageWait
Function checkStringLength
Function handle unexpected Window on Page
Function Counting records in WebTable
Function Verify existance of the data in the table
Function CwLogin(Env, UID, PWD)




========================================================================================
' Function load data from Word Doc to XML file appeand superSize text and set back to Word Doc
' =====================================
'' =====================================
Public Function loadWordDoc(strBrowser, strPage)

On Error resume next
loadWordDoc = -1
set pg = Browser("name:=" & strBrowser).Page("title:=" & strPage ).Object
Set word = pg.WordAx
t = word.DocumentText
'word.DocumentText = "5th "
xml = word.DocumentXML
Set doc = XMLUtil.CreateXML()
doc.Load xml
doc.SaveFile "c:\temp\word.xml"
Set pars = doc.ChildElementsByPath("/w:wordDocument/w:body/wx:sect/w:p")
set lastPar = pars.Item(pars.count)
val = lastPar.Value
Set pText = XMLUtil.CreateXML()
Set sText = XMLUtil.CreateXML()
pText.Load " Automation Test Custom Covenant and Report 155 5"
sText.Load "th"
lastPar.AddChildElement(pText.GetRootElement())
lastPar.AddChildElement(sText.GetRootElement())
word.DocumentXML = doc.ToString()
'Set doc1 = XMLUtil.CreateXMLFromFile("c:\temp\word.xml")
'word.DocumentXML = doc1.ToString()
'msgbox xml
If Err.Number <> 0 Then
Err.Clear
End If
loadWordDoc = 0

End Function

' ==========================================

' ==========================================


Function GetTableData2


Public Function GetTableData2(strBrowser, strPage, strTable, numRow, numColumn, subString, strFlag)
On error resume next
GetTableData = -1
Set objPg = Browser("name:="& strBrowser).Page("title:="& strPage)

Select Case strFlag

Case "noData"
strData = objPg.WebTable("name:=Index", "innertext:=Index.*").GetCellData(numRow, numColumn)

Case "NoData"

If strData = "" Then

GetTableData = 0

msgbox "result1 "
GetTableData = 0

Err.Clear
Exit Function
End If

Case "sub"
strData = objPg.WebTable("name:=Index", "innertext:=Index.*").GetCellData(numRow, numColumn)

Case "SubStingExist"

If inStr (strData, subString) > 0 Then
myArr = Split(strData, " ")
If Ubound(myArr) >0 Then
GetTableData = 0
Err.Clear
Exit Function
End IF
End IF

End Select
If Err.Number <> 0 Then
Err.Clear
End If
End Function



GetColumnNumber
Function GetColumnNumber(strBrowser, strPage, strTableID, strHeader)

Dim objBr, objPg, objTbl
Dim intR, intC, blnFound

On Error Resume Next
GetColumnNumber = -1
Set objBr = Browser("name:=" & strBrowser)
Set objPg = objBr.Page("title:=" & strPage)
blnFound = False
Set objTbl = objPg.WebTable("html id:=" & strTableID, "html tag:=TABLE")
If objTbl.Exist =false Then
Set objTbl = objPg.WebTable("name:=" & strTableID, "html tag:=TABLE")
End If
For intR = 1 To objTbl.RowCount
If Not blnFound Then
For intC = 1 To objTbl.ColumnCount(intR)
If Trim(objTbl.GetCellData(intR, intC)) = strHeader Then
blnFound = True
GetColumnNumber = intC
Exit For
End If
Next
End If

Next

If Err.Number <> 0 Then
Err.Clear
End If

End Function


'====================================================================
clickRadio
Function clickRadio(strBrowser, strPage, strValue)
''' c = clickRadio("CreditView Portal", "CreditView Portal", "portlet_creditProd_overviewwlw-radio_button_group_key:{actionForm.creditProductDetailsVO.guaranteesCollateralCodeFlag}")
On error resume next
Dim objPage

Set objPage = Browser("name:="&strBrowser).Page("title:="&strPage)
objPage.sync
Set objPageTagInput = objPage.Object.all.Tags("input")

For each Element in objPageTagInput
If Trim(Element.value) = Trim(strValue) or Trim(Element.id) = Trim(strValue) or Trim(Element.name) = Trim(strValue) Then
Element.click
clickRadio = 0
Err.clear
Exit Function
End If
Next
clickRadio = -1
Err.clear
End Function

Function closeAllBrowsers()
Dim n
set oDesc = Description.Create()
oDesc("micclass").Value = "Browser"
Set bs = Desktop.ChildObjects(oDesc)
n = bs.count
For i = 0 to n-1
if not bs(i).GetROProperty("title")="Mercury Quality Center" then bs(i).Stop : bs(i).close()
Next

end Function
''' =================================================
''' For initial sorting function get dataType
''' =================================================
Function getDatatype(rulesString, delimeter)
Dim arRule
On error resume next
arRule = Split (rulesString, delimeter)
If err.number > 0 Then
getRulesType = -1
err.clear
Exit Function
End If
getDatatype = arRule
End Function

''' dropDowngetValue Get value from dropdown list
''' ================================================
Function dropDowngetValue (strBrowser, strPage, strName, strValue)

Dim objPage, objPageTags
On error resume next

Set objPage = Browser("name:="&strBrowser).Page("title:="&strPage)
Set objPageTags = objPage.Object.all.Tags("option")

For each Element in objPageTags
If Trim( Element.innertext) = Trim(strValue) Then
If Trim(Element.value) = Trim(strValue) Then
dropDowngetValue = 0
Err.clear
Exit Function
End If
End If
Next
dropDowngetValue = -1
Reporter.ReportEvent 1, "Fail", strValue & "does not exist"
Err.clear

End Function


getRandomNum(RandNum)

Function getRandomNum(RandNum)

RandNum = RandomNumber (100000000, 999999999)

Err.Clear
getRandomNum = 0

End Function

''' verifyWebElement(strBrowser, strPage, strName, strTag)
''' ================================================
Function verifyWebElement (strBrowser, strPage, strName, strTag)
On error resume next
verifyWebElement = -1
Set objPage = Browser("name:="&strBrowser).Page("title:="&strPage)
Set objTags = objPage.Object.all.Tags(strTag)

For each Element in objTags
If inStr (Element.innertext, strName) > 0 Then
verifyWebElement = 0
Err.Clear
Exit Function
End If
Next

If Err.number > 0 Then
Err.Clear
End If
End Function
''' Page Wait specify time in intTime parametr
''' ================================================
Function pageWait(intTime)
On error resume next
wait (intTime)
If Err.Number <> 0 Then
Err.Clear
End If
pageWait = 0
End Function
''' ================================================
''' checkStringLength(strBrowser, strPage ,strTable, ReqNum)
''' ================================================
Function checkStringLength(strBrowser, strPage ,strTable, ReqNum)
On error resume next
checkStringLength = -1
Set objPage = Browser("name:="&strBrowser).Page("title:="&strPage)

strCell = objPage.WebTable("html id:="&strTable).GetCellData(4, 5)
If Len(strCell) <= ReqNum Then
checkStringLength = 0
End If

If Err.number > 0 Then
Err.Clear
End If
End Function


' Function handle unexpected Window on Page
' strBrowser - Name of the Browser
' strPage - Title of the Page
'
''' s = UnexpectedWindow("CPortal","CView Portal",strOutput)

public Function UnexpectedWindow(strBrowser,strPage)

On error resume next
Set objPage = Browser("name:="&strBrowser)
objPage.sync
Set unexpectedWin = objPage.Dialog("regexpwndtitle:=Microsoft Internet Explorer")

If unexpectedWin.exist Then
unexpectedWin.WinButton("regexpwndtitle:=OK").Click
UnexpectedWindow = 0
Else
UnexpectedWindow = -1
End If
IF Err.Number > 0 Then
Err.Clear
End IF

End Function

48. ==========================================================
''' Counting records in WebTable.
''' c = CountRecords("Popup Select", "Popup Select", "SPAN", "2767", outResult)
''' strBrowser - Browsers Name
''' strPage - Pages Name
''' strHTML - Tags Name
''' intExpected - Expected quantity of records
'' outResult -
''' ==============================================================
Public Function CountRecords(strBrowser, strPage, strHTML, intExpected, outResult)

On error resume Next
CountRecords = -1

Set objPage = Browser("name:="&strBrowser).Page("title:="&strPage)
objPage.sync
Set objCount = objPage.Object.all.Tags(strHTML)

intActual = objCount.length

If abs(intExpected) = abs(intActual) Then
outResult = "<< PASS >> expected " & intExpected & " , actual result " & intActual & " records."
Err.clear
CountRecords = 0
Exit Function
else
outResult = "<< COMMENT >> expected " & intExpected & ", actual result " & intActual & " records."
Err.clear
CountRecords = 0
Exit Function
End If
'Err.clear

End Function


'=================================================================================================
'
' Verify existance of the data in the table
'
' Input: strBrowser - "
' strTableID - "treeTable"
' strFind - "Any search string"
' strFindMore- could be empty or another search string
'=================================================================================================
Function getTableData(strBrowser, strPage, strTableID, strFind, strFindMore)

Dim objBr, objPg, objTbl
Dim intCount, intRow, intCol, blnFound

On Error Resume Next
getTableData = -1
Set objBr = Browser("name:=" & strBrowser)
Set objPg = objBr.Page("title:=" & strPage)
Set objTbl = objPg.WebTable("html id:=" & strTableID, "html tag:=TABLE")
If objTbl.Exist = False Then
Set objTbl = objPg.WebTable("name:=" & strTableID, "html tag:=TABLE")
If objTbl.Exist = False Then
Err.Clear
Exit Function
End If
End If

intCount = objTbl.RowCount
blnFound = False

For intRow = 1 To intCount
For intCol = 1 To objTbl.ColumnCount(intRow)
If InStr(objTbl.GetCellData(intRow, intCol),strFind) > 0 Then
If Len(strFindMore) > 0 Then
For intF = intCol To objTbl.ColumnCount(intRow)
If InStr(objTbl.GetCellData(intRow,intF),strFindMore) > 0 Then
blnFound = True
getTableData = 0
Exit For
End If
Next
Else
blnFound = True
getTableData = 0
End If
End If
If blnFound Then Exit For
Next
If blnFound Then Exit For
Next
If Err.Number <> 0 Then
Err.Clear
End If
End Function
'====================================================================================================
Function CwLogin(Env, UID, PWD)


Function CwLogin(Env, UID, PWD)
Dim strURL, objUser
Select Case LCase(Env)
Case "dev"
strURL = "https://"
Case "sit"
strURL = "https"
Case "uat"
strURL = ""
Case "prodfix"
strURL = ""
Case "production"
strURL = ""
End Select
Set objUser = New TestUser
With objUser
.App = "cv"
.UserID = UID
.PWD = PWD
.Domain = "qa-ent"
.URL = strURL
.PageTitle = ""
.Sample = ""
End with
If objUser.Login("IEXPLORE.EXE") = False Then
cwLogin = -1
Else
CwLogin = 0
End If
If Err.Number <> 0 Then Err.Clear

End Function