Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 

                                                 SAP BW Automation Testing

Objective: Any BW upgrade requires rigorous testing to ensure system’s consistency and all functionalities are intact and behaving in expected manner. To ensure successful upgrade, we perform testing by executing various test cases prior and post upgrade environment and compare both the results to ensure system consistencies.

These testing activities are repetitive in nature due to various upgrades (version upgrade/ patch upgrade) and required to carry out across landscape (Sandbox, Dev, Quality, Pre-production and Production).

Automation of these testing activities will not only reduce the manual effort but this will also help in:

1.     Reducing the scope of manual error.

2.     Reducing testing cycle time.

3.     Reducing the dependency on SMEs and functional process owners.

Learning Objectives:

1.     The first question that will come to mind is: What is Automation and why is it done? The answer to this question will be: To reduce the manual effort, the scope of manual error and the time taken to complete a task, we make that task get completed automatically (without manual effort) by writing some scripts in a particular language (technical) that involve the same steps as the steps needed to complete that task manually but these steps have now been coded in the particular language. This code is called script. After this, the integration between the script and the application is done. Then, when the code is executed, it runs the application and performs the same steps as required to complete the task.

2.     Now, as the scripts run, the time taken by them to complete the task is very less as compared to the time taken to complete the same task manually. Also, they reduce the manual efforts and also the scope of manual errors.

3.     After this activity, readers will be able to understand how they can work    with different tools on the same SAP GUI and automate their daily ongoing processes on the application.

4.     It will be an added advantage for the functional as well as technical people to understand some new technical tools like HP QTP (QuickTest Professional) and HP QC (Quality Center) that we’ll be using here and this adds some technical knowledge as well to their current skills. 

5.     The coding here for the automation scripts is done in Visual Basic (VB) language which is also widely used in the technical environment these days.

BW testing Automation:

Using HP QTP:

1.     HP QuickTest Professional (QTP) software provides functional and regression test automation for software applications and environments. Part of the HP QC tool suite, HP QTP can be used for enterprise quality assurance.

2.     HP QuickTest Professional supports keyword and scripting interfaces and features a graphical user interface (GUI).

3.     It uses the Visual Basic Scripting Edition (VBScript) scripting language to specify a test procedure, and to manipulate the objects and controls of the application under test.

Using HPQC as automation framework to develop testing repository, remotely executable and reusable assets:

1.     HP Quality Center (QC) is test management software.

2.     HP QC offers software quality assurance, including requirements management, test management and business process testing for IT and application environments.

3.     HP Functional Testing software combines HP QuickTest Professional software and all HP QuickTest Professional add-ins into a solution for functional testing. The software thus supports both manual and automated testing for GUI-based applications and non GUI-based services.

4.     HP QC enables us to store the scripts and to run them remotely from any SAP system where the QTP and QC are installed.

                                                                     Test Scenario

1.     Introduction

2.     Pre-requisites

3.     Step-by-Step Process

4.     Source Code

5.     HPQTP & HPQC – Testing Framework

6.     Other possible scenarios for Automation

7.     Advantages

8.     Summary

9.     Appendix

                                                                        Introduction

Ø  Automating the process to open the ExcelSheet “Employee_Query_ank”   by giving the particular Variable Selection values in the “XW1-Sandbox” Environment.

Ø  It is a generalized process used in BEx Analyzer to open the respective queries and after that the variable selections are given to see the data present in the Excel sheet of the particular query.

Ø  Thereafter, the comparison between the Excel sheets containing data before upgrade in BW and after upgrade in BW is made and the results with changes highlighted in it are shown in a separate excel sheet.

Ø  The Step-By Step Procedure for this follows next and after that the Source Code’s parts as well as their respective explanation is given.

                                                                              Pre-Requisites

Some of the pre-requisites for automating this process are:-

1.     Quick Test Professional v11.0(QTP version 11.0)

2.     SAP Logon 720

3.     SAP Front End

4.     BEx Analyzer

5.     SAP Add-in for QTP(Optional, depends on system compatibility)

6.     VB Add-in for QTP

                                                                          Step-by-Step Process

1.     Go to Business Explorer using the following path & Click on “Analyzer”  :-

  1. start->programs-> SAP Front end->Business Explorer -> Business Explorer (SAP BW 7.x) -> query Analyzer

 

2. Click on "Add-Ins" Tab after that.

3. Add-Ins icons will be shown after that.

4. Click on icon and select "Open Query".

5. Then, the following SAP Logon Screen will come and then select the particular server to Logon:-

6. After selecting the server, the Logon Credentials will be asked as shown :-

7. After Logging-in, the following window will open:-

8. Now, we can give the Query Name as "Employee_Query_ank"

in the Text Box and after selecting both the check-boxes i.e. "Search in Description‟ & "Search in Technical Name‟, click on the "Find" Button. The Query will get loaded and gets displayed there.

 

9. After that, click on the "Open" button and then, the window "Select Values for Variables" will come.

 

10. Select the variant created for the query from the drop-down of "Available Variants" i.e.

 

11. After that, click on "Check" and then click on "OK" buttons.

12. The Query will thus execute and the sheet containing the data will open.

13. This sheet will be saved as “Employee_Query_ank_BEFORE.xls”.

The naming convention is taken like this because the sheet is saved before upgrade in BW.

 

14. The same process is repeated again after upgrade and this time the sheet is saved as

"Employee_Query_ank_AFTER.xls"

 

15.        After this, the comparison between the two Excel sheets i.e. Before Upgrade & After Upgrade is done, we get the comparison results in the separate sheet named as "

Employee_Query_ank_COMPARE.xls".If there are any changes in the data, they will be highlighted in "RED".

                                                                                      Source Code

The source code has been divided in 3 parts/scripts:-

1.     Driver Script

2.     Login Script

3.     Main Script

1.     Driver Script: - This script is used to call/import the actions/sheets related to the test case at the appropriate positions. The Driver Script is shown in Appendix part (A).

2.     Login Script: - This script enables us to login to the BEx Analyzer and after that through the main script, we execute the queries. The Login script is shown in Appendix part (B).

3.     Main Script: - This script contains the entire source code related to the execution of the queries and the whole processing after the logon, takes place here. The Main script is shown in Appendix part(C).

                                                              QTP-HPQC – Testing Framework

QTP will be integrated with Quality Center (QC), the scripts become remotely available and thus can be accessed from anywhere over the internet, we just need QTP and QC to be installed on the particular SAP system where we want to run these scripts or the automated processes.

                                                          Other possible scenarios for Automation

1.    T-code testing automation

2.    AWB functionality testing

3.    Data load or ETL testing

4.     Process chains testing

5.     Workbook testing

6.     Query designer testing

                                                                                     Advantages

1.     Saves Time: - The execution time for these scripts is quite less as compared to manual process execution time.

2.     Scope of Manual Error reduced: - The scope of manual error gets reduced as there are no manual efforts required during the time script runs to complete the process.

3.     Easy to Understand, Use and Maintain: - The scripts are easy to understand, use and maintain as you just need to have the knowledge of VB Script, in which the script code has been written.

4.     Easily Accessible: - If QTP is integrated with QC (Quality Center) then the scripts will be loaded and can run through QTP-QC combination and thus are available from anywhere over the internet, we just require QC and QTP installed on the particular machine from where we want to access the scripts.

                                                                       Summary

Now we are able to:-

1.     Automate the processes in SAP-BW.

2.     Save time by automating these processes.

3.     Reduce the scope of manual errors.

                                                                         Appendix

Part (A)

'----------------------------------------------------------

'Calling Re-usable action for Login Script.

'----------------------------------------------------------

RunAction "BexLogin [Bex_Login]", oneIteration

'----------------------------------------------------------

  1. DataTable.ImportSheet "D:\test_white\Test Data\Employee_Query_ank.xls","Sheet1","new action"

'------------------------------------------------------------------------------------

'This Statement will call the Reusable action of Keep Filter Value

'------------------------------------------------------------------------------------

Dim i

For i = 1 to DataTable.GetSheet ("new action").GetRowcount

Datatable("Rowcount",dtGlobalSheet) = i

RunAction "new action", oneIteration

Next 

'----------------------------------------------------------

'Calling LogOut Reusable Action in to the mail Script

'----------------------------------------------------------             

'exittest()

'--------------------End Of Action-------------------------

Part (B)

'----------------------------------------------------------------------------------------

     'Variable Declaration:

'----------------------------------------------------------------------------------------

     Dim Pth      'Declare Pth  as a variable to find the full path of the  Current  QTP Script

     Dim Drv     'Declare Drv as a variable to find the Drive Name of the Current  QTP Script

     Dim Qtapp 'Declare Qtapp as a variable to minimize QTP Window and   Set  Other Resource Files

'----------------------------------------------------------------------------------------

     'Environment Variables

'----------------------------------------------------------------------------------------

     Set qtapp=CreateObject("QuickTest.Application")       ' New Quick test.Application Object is created

     qtapp.Windowstate="Minimized"    'This Statement Minimizes the  QTP Main Window

     Pth=Environment.Value("TestDir")  'This Statement finds the Full Path of the Current  QTP Script

     Drv=mid(pth,1,2) 'This Statement takes Drive Name from the  Full Path of the Current Script

'----------------------------------------------------------------------------------------

     'Invoke the Bex Application window

'----------------------------------------------------------------------------------------

  1. SystemUtil.Run "BExAnalyzer.exe","","",""

wait(5)

'----------------------------------------------------------------------------------------

     'Importing the Logging external sheet..

'----------------------------------------------------------------------------------------

    ExecuteFile Drv&"\test_white\Libraries\Analyser.vbs"

'----------------------------------------------------------------------------------------

     DataTable.Import (Drv&"\test_white\Test Data\AnalizerLogin.xls")

'----------------------------------------------------------------------------------------

wait(5)

Call Excelupload

With Window("Microsoft Excel").Dialog("SAP Logon at 2.3a")

     If .Exist Then

              .WinEdit("Client").Set DataTable("Client")

              .WinEdit("User").Set DataTable("User_Name")

              .WinEdit("Password").Set DataTable("Password")

              .WinButton("OK").Click

     End If

End With

If  Window("text:=SAP Logon Control").Exist Then

     Window("text:=SAP Logon Control").Click "410","15", micLeftBtn

End If

Wait(10)

'--------------------------------------- End of Action ------------------------------

Part(C)

'--------------------------------------------------

'Working with  Employee_Query

'--------------------------------------------------

wait(20)

Window("text:=Open").DblClick "70","300"                ' InfoArea

Window("text:=Open").DblClick "70","250"                ' Roles

Window("text:=Open").DblClick "70","200"                'Fav

Window("text:=Open").DblClick "70","100"                'History

Window("text:=Open").DblClick "70","50"                            ' Find

wait(2)

Window("text:=Open").Type trim(DataTable("Technical_Name",dtLocalSheet))

Window("text:=Open").Type micTab

Window("text:=Open").Type " " ' check select checkbox

Window("text:=Open").Type " " ' check select checkbox

Window("text:=Open").Type micTab

Window("text:=Open").Type " " ' check select checkbox

Window("text:=Open").Type " " ' check select checkbox

Wait(5)

For tmp=1 to 3

Window("text:=Open").Type micTab        ' to reach checkbox for technical names checkbox

Next

Window("text:=Open").Type MicReturn   'this statement is to click on Find button

wait(10)

For tmp=1 to 2

Window("text:=Open").Type micDwn

Next

For tmp=1 to 3

Window("text:=Open").Type micTab

Next

wait(5)

Window("text:=Open").Type MicReturn

wait(50)

Window("text:=Select Values for Variables").Click "250","25",micLeftBtn

Set Wsh=CreateObject("WScript.Shell")

wait(1)

  1. Wsh.SendKeys "^"

wait(2)

  1. Wsh.SendKeys "{DOWN}"
  2. Wsh.SendKeys "{ENTER}"

wait(5)

Window("text:=Select Values for Variables").Click "450","145",micLeftBtn

wait(60)

'--------------------------------Excel stored before upgrade--------------------------

Dim val

Set sExcelObj = CreateObject("Excel.Application")

Set sWorkBook = sExcelObj.Workbooks.Open ("D:\test_white\Test Data\Employee_Query_ank.xls")

Set objDriverSheet=sWorkBook.Worksheets("Sheet1")

val =objDriverSheet.cells("2","D").value

If val=1  Then

Window("text:=Microsoft Excel - Employee_Query_ank").Click "20","20",micLeftBtn

Set Wsh=CreateObject("WScript.Shell")

wait(1)

  1. Wsh.SendKeys "^"

wait(2)

For i=1 to 5

  1. Wsh.SendKeys "{DOWN}"

Next

  1. Wsh.SendKeys "{RIGHT}"

For i=1 to 3

  1. Wsh.SendKeys "{DOWN}"

Next

  1. Wsh.SendKeys "{ENTER}"

Window("text:=Save As").Type DataTable("Path",dtLocalSheet)

Window("text:=Save As").Click "650","450",micLeftBtn

  • objDriverSheet.cells("2","D").value = 2
  1. sWorkBook.Save
  2. sExcelObj.Quit

Set sExcelObj=nothing

Window("text:=Microsoft Excel - Employee_Query_ank_BEFORE.xls").Close

'-------------------------------Excel stored after upgrade----------------------------

else

Window("text:=Microsoft Excel - Employee_Query_ank").Click "20","20",micLeftBtn

Set Wsh=CreateObject("WScript.Shell")

wait(1)

  1. Wsh.SendKeys "^"

wait(2)

For i=1 to 5

  1. Wsh.SendKeys "{DOWN}"

Next

  1. Wsh.SendKeys "{RIGHT}"

For i=1 to 3

  1. Wsh.SendKeys "{DOWN}"

Next

  1. Wsh.SendKeys "{ENTER}"

Window("text:=Save As").Type DataTable("Path1",dtLocalSheet)

Window("text:=Save As").Click "650","450",micLeftBtn

  • objDriverSheet.cells("2","D").value = 1

i=2

  1. sWorkBook.Save
  2. sExcelObj.Quit

Set sExcelObj=nothing

Window("text:=Microsoft Excel - Employee_Query_ank_AFTER.xls").Close

End If

'--------------------------------------------------------------------

'                         Excel Comparision

'---------------------------------------------------------------------

If i=2 Then

Set objExcel = CreateObject("Excel.application")

'objExcel.Visible = True

Set objWorkbook1 = objExcel.workbooks.Open("D:\test_white\Before\Employee_Query_ank_BEFORE.xls")

Set objWorkbook2 = objExcel.workbooks.Open("D:\test_white\After\Employee_Query_ank_AFTER.xls")

Set objWorkbook3 = objExcel.workbooks.Add

Set objWorksheet1 = objWorkbook1.worksheets(1)

Set objWorksheet2 = objWorkbook2.worksheets(1)

Set objWorksheet3 = objWorkbook3.worksheets(1)

For Each cell In objWorksheet1.UsedRange

If cell.Value <> objWorksheet2.Range(cell.Address).Value Then

objWorksheet3.Range(cell.Address).Value=cell.Value

objWorksheet3.Range(cell.Address).Font.ColorIndex =cell.Font.ColorIndex

objWorksheet3.Range(cell.Address).Interior.ColorIndex=3

else

objWorksheet3.Range(cell.Address).Value=cell.Value

objWorksheet3.Range(cell.Address).Interior.ColorIndex = cell.Interior.ColorIndex

objWorksheet3.Range(cell.Address).Font.ColorIndex =cell.Font.ColorIndex

end if

If objWorksheet3.Range(cell.Address).Interior.ColorIndex=51 then

objWorksheet3.Range(cell.Address).Interior.ColorIndex=6

end if

Next

objWorkbook1.close

objWorkbook2.close

  • objExcel.Visible = True

Window("text:=Microsoft Excel - Book1").Click "20","20",micLeftBtn

Set Wsh=CreateObject("WScript.Shell")

wait(1)

  1. Wsh.SendKeys "^"

wait(2)

For i=1 to 4

  1. Wsh.SendKeys "{DOWN}"

Next

  1. Wsh.SendKeys "{RIGHT}"

For i=1 to 3

  1. Wsh.SendKeys "{DOWN}"

Next

  1. Wsh.SendKeys "{ENTER}"

Window("text:=Save As").Type DataTable("Path2",dtLocalSheet)

Window("text:=Save As").Click "650","450",micLeftBtn

'------------------------ Result Sheet Formatting -------------------------------------

objWorksheet3.UsedRange.Select

Window("Employee_Query_ank_COMPARE.xls").Click "300","200",micRightBtn

Set wsh=CreateObject("WScript.Shell")

wsh.SendKeys "^"

            Wait(1)

For i=1 to 11

  1. wsh.SendKeys"{DOWN}"

Next

  1. wsh.SendKeys"{ENTER}"

wait(3)

Window("text:=Format Cells").Click "200","20",micLeftBtn

Window("text:=Format Cells").Click "275","80",micLeftBtn

Window("text:=Format Cells").Click "325","80",micLeftBtn

Window("text:=Format Cells").Click "325","410",micLeftBtn

wait(10)

objWorkbook3.Save

  • objExcel.quit

set objExcel=nothing

End If

'----------------------------------------End Of Action------------------------------------------

4 Comments
Labels in this area