Sie sind auf Seite 1von 11

Understanding BPT Implementation for SAP ERP

************************************************************************************** * BPT implementation requires > Quick Test Professional > SAP Add-in for QTP > TD Plug-in to communicate between QTP and Quality Center > Quality center >The function library can be created as a .qfl file in text format and stored in QC at a specified path which has to be included under Resources TAB in Business Component Settings. >Every data file meant for a BPT component contains a column strFlag with value start at the first row and end at the last row ************************************************************************************** *

Reporter Object
The object used for sending information to the test results. ReportEvent Method To report an event to the test results. Syntax Reporter.ReportEvent EventStatus, ReportStepName, Details [, in] Status of the report step: 0 or micPass: Causes the status of this step to be passed and sends the specified message to the report. 1 or micFail: Causes the status of this step to be failed and sends the specified message to the report. When this step runs, the test fails. 2 or micDone: Sends a message to the report without affecting the pass/fail status of the test. 3 or micWarning: Sends a warning message to the report, but does not cause the test to stop running, and does not affect the pass/fail status of the test. Name of the intended step in the report (object name). Description of the report event. The string will be displayed in the step details frame in the report.

EventStatus

Number or predefined constant

ReportStepName String Details Eg. String

Reporter.ReportEvent 1, "Custom Step", "The user-defined step failed." Reporter.ReportEvent micFail, "Custom Step", "The user-defined step failed." Reporter.ReportEvent 2,"Functional Expert",Parameter("fexpert")

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. Syntax To retrieve the mode settings CurrentMode = Reporter.Filter To set the mode Reporter.Filter = newMode Mode 0 or rfEnableAll 1 or rfEnableErrorsAndWarnings 2 or rfEnableErrorsOnly 3 or rfDisableAll Default. All reported events are displayed in the Test Results. Only event with a warning or fail status are displayed in the Test Results. Only events with a fail status are displayed in the Test Results. No events are displayed in the Test Results

Eg. The following example uses the Filter property to report the following events in the Test Results: 1, 2, 5, and 6.
Reporter.ReportEvent micGeneral, "1", "" Reporter.ReportEvent micGeneral, "2", "" Reporter.Filter = rfDisableAll Reporter.ReportEvent micGeneral, "3", "" Reporter.ReportEvent micGeneral, "4", "" Reporter.Filter = rfEnableAll Reporter.ReportEvent micGeneral, "5", "" Reporter.ReportEvent micGeneral, "6", ""

ReportPath Property Retrieves the folder path in which the current test's results are stored. Syntax Path = Reporter.ReportPath Path String The folder path in which the current test's results are stored.

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. For business components, it returns the status of current business component (not the entire business process test). Syntax Reporter.RunStatus **************************************************************************************

DataTable Object
The run-time Data Table

Note: All methods performed on this object apply to the run-time DataTable object only. Changes to the run-time DataTable object are reflected in the test results, but the design-time Data Table is not affected. AddSheet Method Adds the specified sheet to the run-time Data Table and returns the sheet so that you can directly set properties of the new sheet in the same statement. Syntax DataTable.AddSheet(SheetName) SheetName String Assigns a name to the new sheet.

DeleteSheet Method Deletes the specified sheet from the run-time Data Table Syntax DataTable.DeleteSheet SheetID SheetID Variant Identifies the sheet to be returned. The SheetID can be the sheet name or index. Index values begin with 1.

Export Method Saves a copy of the run-time Data Table in the specified location. Syntax DataTable.Export (FileName) FileName String The full path of the location to which the Data Table should be exported.

ExportSheet Method Exports a specified sheet of the run-time Data Table to the specified file. If the specified file does not exist, a new file is created and the specified sheet is saved. If the current file exists, but the file does not contain a sheet with the specified sheet name, the sheet is inserted as the last sheet of the file. If the current file exists and the file contains the specified sheet, the exported sheet overwrites the existing sheet. Syntax DataTable.ExportSheet(FileName, DTSheet) FileName String DTSheet Variant The full path of the Excel table to which you want to export a sheet. The name or index of the run-time Data Table sheet that you want to export. Index values begin with 1.

GetCurrentRow Method Returns the current (active) row in the first sheet in the run-time Data Table (global sheet). Syntax DataTable.GetCurrentRow

GetRowCount Method Returns the total number of rows in the longest column in the first sheet in the run-time Data Table (global sheet). Syntax DataTable.GetRowCount GetSheet Method Returns the specified sheet from the run-time Data Table. Syntax DataTable.GetSheet(SheetID) SheetID Variant Identifies the sheet to be returned. The Sheet ID can be the sheet name or index. Index values begin with 1

Eg. MyParam=DataTable.GetSheet ("MySheet").AddParameter("Time", "8:00") DataTable.GetSheet ("MySheet").AddParameter "Time", "8:00" GetSheetCount Method Returns the total number of sheets in the run-time Data Table. Syntax DataTable.GetSheetCount Eg. sheetcount = DataTable.GetSheetCount Import Method Imports the specified Microsoft Excel file to the run-time Data Table. Notes: The imported table must match the test. The column names must match the parameters in the test, and the sheet names must match the action names. If you import an Excel table containing combo box or list cells, conditional formatting, or other special cell formats, the formats are not imported and the cell is displayed in the Data Table with a fixed value. Syntax DataTable.Import(FileName) FileName String The full path of the Excel table to import.

The imported table replaces all data in the existing run-time Data Table (including all data sheets). ImportSheet Method Imports a sheet of a specified file to a specified sheet in the run-time Data Table. The data in the imported sheet replaces the data in the destination sheet (see SheetDest argument). Notes:

The column headings in the sheet you import must match the Data Table parameter names in the action for which the sheet is being imported. Otherwise, your test or component may fail. The sheet you import automatically takes the name of the sheet it replaces. If you import an excel sheet containing combo box or list cells, conditional formatting, or other special cell formats, the formats are not imported and the cell is displayed in the Data Table with a fixed value. Syntax DataTable.ImportSheet(FileName, SheetSource, SheetDest) FileName String The full path of the Excel table from which you want to import a sheet. The name or index of the sheet in the file that you want to import. Index values begin with 1. The name or index of the sheet in the Data Table that you want to replace with the SheetSource. Index values begin with 1

SheetSource Variant SheetDest Variant

Eg. The following example uses the ImportSheet method to import the first sheet of the name.xls table to the name sheet in the test's run-time Data Table. DataTable.ImportSheet "C:\name.xls" ,1 ,"name" setCurrentRow Method Sets the specified row as the current (active) row in the run-time Data Table Note: You can only set a row that contains at least one value. Syntax DataTable.SetCurrentRow(RowNumber) RowNumber Number Indicates the number of the row to set as the active row. The first row is numbered 1 setNextRow Method Sets the row after the current (active) row as the new current row in the run-time Data Table Note: You can only set a row that contains at least one value. If the current row is the last row in the Data Table, applying this method sets the first row in the Data Table as the new current row. Syntax DataTable.SetNextRow setPrevRow Method Sets the row above the current (active) row as the new current (active) row in the run-time Data Table Note: If the current row is the first row in the Data Table, applying this method sets the last row in the Data Table as the new current row. Syntax DataTable.SetPrevRow GlobalSheet Property

Returns the first sheet in the run-time Data Table (global sheet) Syntax DataTable.GlobalSheet Eg. ParamValue=DataTable.GlobalSheet.AddParameter("Time", "5:45") DataTable.GlobalSheet.AddParameter "Time", "5:45" LocalSheet Property Returns the current (active) local sheet of the run-time Data Table. Syntax DataTable.LocalSheet RawValue Property Retrieves the raw value of the cell in the specified parameter and the current row of the run-time Data Table. The raw value is the actual string written in a cell before the cell has been computed, such as the actual text from a formula. Syntax DataTable.RawValue ParameterID [, SheetID] Identifies the parameter (column) of the value to be set/retrieved. Index values begin with 1. Note: The specified value must be an actual column header name that has been ParameterID Variant defined as a Data Table parameter. Entering A (or another default column label) as the column name is not valid unless A has explicitly been set as the name of a Data Table parameter. Optional. Identifies the sheet to be returned. The SheetID can be the sheet name, index or dtLocalSheet, or dtGlobalSheet. Variant If no Sheet is specified, the first sheet in the run-time Data Table is used (global sheet). Index values begin with 1

SheetID

Eg. The following example uses the RawValue property to find the formula used in the current row of the Date column in the ActionA sheet in the run-time Data Table. The statement below returns the value: =NOW() FormulaVal=DataTable.RawValue ("Date", "ActionA") Value Property DataTable default property. Retrieves or sets the value of the cell in the specified parameter and the current row of the run-time Data Table. Syntax To find the value: DataTable.Value(ParameterID [, SheetID]) or DataTable(ParameterID [, SheetID]) To set the value: DataTable.Value(ParameterID [, SheetID])=NewValue or

DataTable(ParameterID [, SheetID]) =NewValue ParameterID Variant Identifies the parameter (column) of the value to be set/retrieved. Index values begin with 1.

SheetID

Optional. Identifies the sheet to be returned. The SheetID can be the sheet name, index or dtLocalSheet, or dtGlobalSheet. Variant If no Sheet is specified, the first sheet in the run-time Data Table is used (global sheet). Index values begin with 1. String Sets the value for the specified table cell

NewValue

Eg. The following example uses the Value property to set the value in the current row of the Destination parameter (column) in the "ActionA" sheet in the run-time Data Table. DataTable.Value ("Destination", "ActionA")="New York" The following example uses the Value property to set the value in the current row of the second parameter (column) in the third sheet. DataTable.Value (2,3)="New York" Note: You could omit the word Value in the statements above, because Value is the default property for the DataTable object. The following example uses the default property to set the value in the current row of the Destination parameter (column) in the current (active) local sheet. DataTable("Destination", dtlocalSheet)="New York" ************************************************************************************** * DTSheet Object A sheet in the run-time Data Table. This object is not a built-in utility object, but can be accessed using one of the following methods or properties DataTable.AddSheet DataTable.GetSheet DataTable.GlobalSheet DataTable.LocalSheet AddParameter Method Adds the specified parameter (column) to the sheet in the run-time Data Table, sets the value of the first row to the specified value, and returns the parameter so that you can directly set or retrieve properties of the new parameter in the same statement Syntax DTSheet.AddParameter(ParameterName, Value) Assigns a name to the new parameter. If another parameter in the sheet has the same name, a number (i.e. '1') will be appended to the assigned ParameterName. If ParamterName String the ParameterName contains illegal characters, the illegal characters will be replaced with '_' characters.

Value

String Assigns a value to the first row of the parameter

Eg. The following example uses the AddParameter method to create the new Parameter, "Arrival" within the new sheet, MySheet of the run-time Data Table, and sets the first cell in the column as "New York". Because the method also returns the newly created parameter, it is possible to use methods or check properties of the new sheet within the same statement ParamName=DataTable.AddSheet("MySheet").AddParameter("Arrival", "New York").Name Note that if a parameter with the name "Arrival" already exists in the sheet, the example above will return "Arrival1" as the actual name assigned to the new parameter DeleteParameter Method Deletes the specified parameter from the sheet in the run-time Data Table Syntax DTSheet.DeleteParameter(ParameterID) ParameterID Variant Identifies the parameter (column) to be deleted by name or index. (Index values begin with 1.)

Eg. The following example uses the DeleteParameter method to delete the parameter, "Arrival" from the "MySheet" sheet of the run-time Data Table. DataTable.GetSheet("MySheet").DeleteParameter("Arrival") Note that deleting a parameter from the sheet will cause the run to fail if a corresponding parameter exists in a step GetCurrentRow Method *Same as in DataTable Object GetParameter Method Retrieves the specified parameter from the run-time Data Table sheet Syntax DTSheet.GetParameter(ParameterID) ParameterID String/Index Identifies the parameter (column) to be returned by name or index. (Index values begin with 1.)

Eg. The following example uses the GetParameter method to return the "Destination" parameter from the runtime Data Table sheet: MySheet. DataTable.GetSheet("MySheet").GetParameter("Destination") GetParameterCount Method Returns the total number of parameters (columns) in the run-time Data Table sheet. Syntax DTSheet.GetParameterCount

Eg. The following example uses the GetParameterCount method to find the total number of parameters (columns) in the run-time Data Table sheet (MySheet) and writes it to the report. paramcount = DataTable.GetSheet("MySheet").GetParameterCount Reporter.ReportEvent 2, "There are " &paramcount, "columns in the data sheet." GetRowCount Method *Same as in DataTable Object SetCurrentRow Method *Same as in DataTable Object SetNextRow Method *Same as in DataTable Object SetPrevRow Method *Same as in DataTable Object Name Property Returns the name of the run-time data sheet Syntax DTSheet.Name Eg. The following example uses the Name method to return the name of the active run-time data sheet and writes it in the report. Sheetname = DataTable.LocalSheet.Name Reporter.ReportEvent 1, "The Active Sheet is", Sheetname ************************************************************************************** * DTParameter Object A parameter (column) in a sheet in the run-time Data Table. This object is not a built-in utility object, but can be accessed using one of the following methods DTSheet.AddParameter DTSheet.DeleteParameter Note: All methods performed on this object apply to the run-time DataTable object only. Changes to the run-time DataTable object are reflected in the test results, but the design-time Data Table is not affected Name Property Returns the name of the parameter (column) in the run-time Data Table Syntax DTParameter.Name Eg.

The following example uses the Name method to return the name of the newly created parameter in the runtime Data Table and writes it in the report. Dim paramname paramname = DataTable.LocalSheet.AddParameter("Food", "pizza").Name Reporter.ReportEvent 1, "The New Parameter name is", paramname RawValue Property Retrieves the raw value of the cell in the current row of the parameter in the run-time Data Table. The raw value is the actual string written in a cell before the cell has been computed, such as the actual text from a formula Syntax DTParameter.RawValue Eg. The following example uses the RawValue property to find the formula used in the current row of the Date column in the ActionA sheet of the run-time Data Table. The statement below returns the value: =NOW() FormulaVal=DataTable.GetSheet("ActionA").GetParameter("Date").RawValue Value Property Parameter default property. Retrieves or sets the value of the cell in the current (active) row of the parameter in the run-time Data Table Note: This method returns the computed value of the cell. For example, if the cell contains a formula, the method returns True or False Syntax To find the value: DTParameter.Value or DTParameter To set the value: DTParameter.Value =newvalue or DTParameter =newvalue Eg. The following example uses the Value property to set the value in the current row of the Destination parameter (column) in the "ActionA" sheet of the run-time Data Table. DataTable.GetSheet("ActionA").GetParameter("Destination").Value="New York" Note: You could omit the word Value in the statement above, because Value is the default property for the DTParameter object. ValueByRow Property Retrieves the value of the cell in the specified row of the parameter in the run-time Data Table Syntax RowNum Number Indicates the row of the parameter that should be returned. (Row numbers start with 1.) Eg. The following example uses the ValueByRow property to find the value in the 4th row of the Destination parameter (column) in the "ActionA" sheet of the run-time Data Table. DataTable.GetSheet("ActionA").GetParameter("Destination").ValueByRow(4)

Das könnte Ihnen auch gefallen