Blog to understand automation concepts in QTP, Selenium Webdriver and Manual Testing concepts

How to compare content of files using fc command

I was having issues with comparison of two large csv files that I came across fc comparision command of Microsoft DOS. fc  is a command line program that compares multiple files and outputs the differences between them


The syntax of fc Command and results of execution of fc with different arguments is shown below:




Syntax for fc command:


fc filename1 filename 2 [Parameter for comparision type] >Log File Path

where filename1 and filename2 are paths of the two files to be compared .
LogFilePath is path for saving result log
Commonly used Parameters are as described below:
/a :  fc displays only the first and last line for each set of differences.
/b : Compares the files in binary mode.
/c : Ignores the case of letters.
/l :  Fc compares the two files line by line and attempts to resynchronize the files after finding a mismatch. 
/lbn : Sets the n number of lines for the internal line buffer.
/n : Displays the line numbers during an ASCII comparison.

Connecting to excel as database using Adodb in VBScript/QTP

We can connect to excel file using Adodb object in vbscript.  Following are the steps in working with excel as database.

1.       Create an instance of connection :

Set objConn = CreateObject("Adodb.connection")


2.       Create connection string to connect to excel database as follows

strCon = "Driver={Driver do Microsoft Excel(*.xls)};DriverId=790;Dbq=" & Workbook &";"

Here we have created a database for excel Workbook . The sheets in the workbook acts as table of the database.

3.       Connect to database as shown below:

objConn.open strCon

Now we are done with the connection to excel , we require SQL to run on the data to extract required information . 

4. Create a SQL as required as shown below:

strSQL =  "select name from [Table1$];"

Note here, we have to give sheet name acting as table within square bracket and with suffix “$” as shown above.

5.   Create a recordset as shown below and execute the query using recordsetall  the records based on query will be stored in recordset.

Set rs = CreateObject("ADODB.recordset")

rs.Open strSQL,objConn


6.       We can transfer the data extracted from query back in excel using copyrecordset method

XLSheet.range("A2").copyfromrecordset rs

Where XLSheet is the reference of required sheet in the excel  file and A2 is the location in sheet from which data will be pushed in the sheet.


Reporting in QTP - Reporter Object

When we run a test in QTP, QTP generates a report based on inbuilt native reporting for steps  defined in QTP. To add user defined results, we have reporter object in QTP.
Below are the properties  and methods  of reporter object which will be described in details below.

Reporter.Filter Property 

Retrieves or sets the current mode for displaying events in the Test Results. You can use this property to completely disable or enable reporting of steps following the statement, or you can indicate that you only want subsequent failed or failed and warning steps to be included in the report.

Reporter.filter = FilterValue.


Filter value can be
·         0 or rfEnableAll – Default , all reporting events are displayed.
·         1 or rfEnableErrorandWarnings – only error and warning events are displayed.
·         2 or rfEnableErrorsOnly – Only errors are displayed.
·         3 or rfDisableAll – No event are displayed in results.

Reporter.ReportEvent Method

Reports an event to the results

Syntax: Reporter.reportEvent  eventstatus, reportStepName, Details,[Image]


EventStatus can have value 0, 1,2,3 or micPass,micFail, micDone, and micwarning.
reportStepName Name of the steps
Details – Details of execution.
Image – Path of imagefile to be attached for event.

Reporter.ReportPath property

 This retrieves the folder Path in which current test results are saved.

Reporter.RunStatus property

Retrieves the run status at the current point of the run session. For tests, it returns the status of current test during the test run.