Você está na página 1de 59

ULM150

Automated Functional
Testing Using eCATT in
SAP Solution Manager
Contributing Speakers

Jon Maidstone
Product Manager, NetWeaver Test Tools, SAP AG

Martin Plummer
Product Specialist, NetWeaver Test Tools, SAP AG

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 2


Learning Objectives

As a result of this workshop, you will be able to:


Assess the extent to which automated testing can help you
Use the SAP Solution Manager as the basis for a test project
Use eCATT to create automated test cases
Use the Test Workbench to manage a test project

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 3


Meeting the Players

Defining the Solution Manager Project

Creating Automated Tests

Running the Test Project


Meeting the Players: SolMan, eCATT, Test Organizer

The one-stop instance for managing your


implementations and upgrades and for
monitoring your running systems.
SAP Solution Manager
The implementation tools allow you to define the
scope of your project and to assign test cases to
the various steps
SAP‘s tool for automated functional testing. With
eCATT, you can record user interaction with the
Extended Computer-
SAP GUI and edit the recordings to form modular,
Aided Test Tool
reusable test cases.
(eCATT)
eCATT ships at no additional charge, and is part
of the Solution Manager shipment
The Test Organizer allows you to create and
manage test projects. Individual testers can be
assigned worklists of tests (either manual or
Test Organizer automatic). Coordinators can monitor the
progress of the project. Like eCATT, the Test
Organizer is part of the Solution Manager
shipment

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 5


The Relationship Between The Tools

SAP Solution Manager 4.0

Project

Scope of
Assign implementation/ System
eCATT upgrade Landscape
tests

Extract
tests to Test
eCATT form Organizer
project

SAP NetWeaver 2004s

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 6


Relationship To Your Other Systems

Solution A DEV QAS PRD

SAP
Solution
Manager
4.0
Solution B DEV QAS PRD
(inc. eCATT
Test
Organizer)

Solution C DEV QAS PRD

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 7


Today‘s System Landscape

Solution Manager CRM

System M07 System M06


Host iwdf2052 Host iwdf2062
Syst. No. 14 Syst. No. 20
Client 800 Client 800
User ULM150-## User ULM150-##
Password init123 Password init123

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 8


Meeting the Players

Defining the Solution Manager Project

Creating Automated Tests

Running the Test Project


Solution Manager Project

Project Business Blueprint

Administrative Business
information about Scenarios to be
the project implemented

Configuration
Test cases are
assigned to a Transactions,
configuration Test cases,
training …

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 10


Exercise 1
© SAP AG 2006, SAP TechEd ’06 / ULM150 / 11
Meeting the Players

Defining the Solution Manager Project

Creating Automated Tests

Running the Test Project


Extended Computer-Aided Test Tool (eCATT)

The Extended Computer-Aided Test Tool (eCATT) allows you to


record automated tests for applications running in the following
environments
SAP GUI for Windows
Web Dynpro
Web Services

You can create modular, re-usable scripts that you subsequently


chain together to represent larger business processes

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 13


Structure of an eCATT Script

Field Checks

Database Checks
Record

Message Checks
Parameters an Parameters
Application

Define what Define what


goes in Customizing Checks comes out

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 14


Knowing What You Want to Test

Step 1: Create Quotation Step 2: Create Order

Input: Input:
Sold-to party Quotation
Product number
Quantity

Output: Output:
Quotation number Order number

Action Action
Create quotation Convert existing
in CRM quotation into
order in CRM

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 15


Recording the Quotation Processing

We are going to make a recording of the CRM transaction that


creates a quotation

(Later on, you will also record the transaction that converts a
quotation into an actual order)

Some of the details will be left out – we will discuss them later on

At the end of this section, you will have a running script that
Accepts input data (sold-to party, material, quantity)
Creates a quotation
Outputs the quotation number for further use later on

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 16


Recording Transactions Using SAP GUI Scripting

The eCATT command SAPGUI allows you to capture and replay


applications running in the SAP GUI for Windows environment

As well as recording an application, it allows you to


Assign variables to input fields
Retrieve values from output fields
Check the values of output fields

In this demonstration and exercise, we are going to


1. Record the application using the SAPGUI command
2. Use the GETGUI command to retrieve an output value from the screen

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 17


Starting eCATT

To start eCATT, use transaction


code SECATT

The initial screen looks


like this:

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 18


Creating a Script

Select the Test Script radio button

Enter the name of a Script (max. 30 characters, Z or Y namespace)


and choose Create

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 19


Script Attributes

eCATT scripts have various attributes that must be filled out:

Title, package,
person responsible,
application component

Description of the
system landscape
in which to work

Optional keywords

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 20


Starting the Recording – 1

To start a recording, switch to the Editor tab and choose the Pattern
function:

Commands are grouped –


Use the UI Control group
for SAP GUI recordings

The completed dialog


looks like this:

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 21


Starting the Recording – 2

Specify the transaction you want


to record and how often you
want a new SAP GUI command

Confirm that you want to record.


Now you‘re ready to go…

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 22


Reading Field Values During Recording – 1

Click on Insert GETGUI Command

Point and click at the field


you want to read

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 23


Reading Field Values During Recording – 2

Select the relevant field


properties (usually Text)
and choose Insert and Exit.
This returns you to
your recording.

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 24


Ending a Recording

To complete the recording, switch to the Recording Running dialog


and choose Stop Recording

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 25


Exercise 2
© SAP AG 2006, SAP TechEd ’06 / ULM150 / 26
Function of the System Data Container

A system data container allows your script (created in the Solution


Manager system) to access the systems in which the applications
are running

In a script, you use a logical name to refer to a system

A system data container maps logical names to real RFC


destinations

Different logical systems can refer to


Different physical systems (CRM, ERP…)
Different users on one system (employee, manager, … )

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 27


Editing The Generated Script – Command Interfaces

Almost every generated command has a command interface

eCATT and the application under test use the command interface to
communicate

You can edit a command interface by double-clicking it in the script


editor

Double-click Command interface


containing the actions
you performed

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 28


Finding an Input Field – 1

Command interfaces are complex – but the global search function


helps you to find the fields you are looking for…

Enter a search string –


Such as the customer number
you entered during recording

Double-click the hit-list entry to


navigate directly to the field

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 29


Finding an Input Field – 2

Replace this
value with a
variable
eCATT opens correct
part of command interface

Double-click

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 30


Parameterizing an Input Field

Enter parameter name

eCATT creates the


parameter automatically

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 31


Parameterizing an Output Field

E_ORDER_NUMBER

Enter parameter
name

Double-click

Create the parameter as an


exporting parameter

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 32


Messages in Test Cases

Messages from the application can be sent


In the status bar of the screen
In the application log

These messages can be an indication to you that a particular test


has succeeded or failed

They can also contain important data – for example, a customer or


order number

Additionally, eCATT can send messages during script replay

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 33


MESSAGE … ENDMESSAGE in a Script

Define expected message


behavior for the command block

MESSAGE ( MSG_1 ).

SAPGUI ( SAPGUI_1).
SAPGUI ( SAPGUI_2). Command Block

ENDMESSAGE ( E_MSG_1 ).

Retrieve messages sent


by applications under test
during the command block

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 34


Inserting the MESSAGE – ENDMESSAGE Commands

Using the Pattern function. . .

Move the ENDMESSAGE statement to the end of the statement block

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 35


Defining a Message Rule

A message rule consists of two elements:


To which message(s) does it apply?
Does the script pass or fail when the message occurs?

Message rules are defined in the command interface of the message


command:

Message 006 from


Require message class CRM_USERFACE

The script will only succeed if this message occurs during replay

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 36


Exercise 3
© SAP AG 2006, SAP TechEd ’06 / ULM150 / 37
The Situation So Far

You have created the following script:

Product Code
Sold-to Party

Parameters
Importing
Quantity

Commands
Script
Run transaction CRMD_ORDER in CRM System
Create quotation with given import data
Return quotation number for further processing

Quotation No.

Parameters
Exporting
© SAP AG 2006, SAP TechEd ’06 / ULM150 / 38
The Next Stage

You need to incorporate your script into a wider business process:

Sold-to Party

Create Create
Product Code Quotation No. Quotation No. Order No.
Quotation Order

Quantity

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 39


The REF Command in eCATT

The REF command allows you to call one script from another

Each REF command has a command interface that allows you to


pass data to the script that you are calling and receive data from it

Scripts called using REF can themselves call further scripts

Enter values here, or use


Importing and default values stored in
Exporting called script
parameters
© SAP AG 2006, SAP TechEd ’06 / ULM150 / 40
Parameterizing the REF Command

The REF command is parameterizied similarly to the SAPGUI and


GETGUI commands:

It does not matter that parameters in the source and target scripts
have the same name

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 41


Copying Parameter Definitions From Another Script

To pass data to a script, you generally need an appropriate set of


parameters in the calling script

If these already exist in the called script, you can copy their
definitions by choosing Edit → Parameter/Command Interfaces →
Import:

Select

Transfer

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 42


Exercise 4
© SAP AG 2006, SAP TechEd ’06 / ULM150 / 43
Making the Test Executable

Test Configuration

System Test Data:


Test
Data Script Variants
Container

Log Archive

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 44


Creating the Configuration

The easiest way to create a configuration is directly from a script.

If you do this, eCATT does much of the work for you ☺

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 45


Variants

Without doing anything to you test configuration, you can run the
test with
The default values of the importing parameters
No data at all

However, you can also add any amount of data to the configuration
by
Entering it manually in the grid in the configuration editor
Uploading the contents of a tab-delimited text file

Variants are useful for


Testing good/bad/questionable combinations of data
Creating data that you will use later on
Going beyond a boundary (keep creating orders – what happens when
the stock runs out?)

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 46


Exercise 5
© SAP AG 2006, SAP TechEd ’06 / ULM150 / 47
Meeting the Players

Defining the Solution Manager Project

Creating Automated Tests

Running the Test Project


Back to the Solution Manager…

Armed with your eCATT test configurations, you can go back to the
Solution Manager project and assign them to the configuration:

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 49


Solution Manager and Test Organizer

Solution Manager Test Organizer

Contains project Test Plan

Contains all test cases


from Solution Manager
Help Desk project

Test Package
Process

Subset of
Worklist tests

Test Package
Error Each test package is Subset of
Report
Messages assigned to a user tests

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 50


Creating the Test Project

Use this option to


extract all test cases from
a given Solution Manager project

Enter a
title

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 51


Selecting Test Cases

2. Generate the
test plan

1. Select the
required
test cases

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 52


Dividing Up the Test Plan Into Test Packages

Each test package contains one or more test cases from within the
test plan

A test package is assigned to a particular user, who will see it in


their worklist

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 53


Assigning a Test Package to a User

Click here

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 54


Exercise 6
© SAP AG 2006, SAP TechEd ’06 / ULM150 / 55
Summary

The SAP Solution Manager provides functions for defining


and managing test projects

You can use the built-in capability of eCATT to create


automated test cases for the SAPGUI environment at minimal
cost of ownership

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 56


Further Information

Public Web:
SAP Developer Network: www.sdn.sap.com Forums SAPGUI

Related SAP Education Training Opportunities


http://www.sap.com/education/
CA611: Test Managment with eCATT

Related Workshops/Lectures at SAP TechEd 2006


ULM300: eCATT: Some Frequently-Asked-Questions Explained
CD211: Testing Tools – eCATT, Mercury QuickTest Pro and Mercury Quality
Center
CD261: Testing Web Dynpro Applications and Web Services
ULM218: SAP Test Data Migration Server: Creating Non-Production
Systems With a Reduced Set of Data

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 57


THANK YOU FOR YOUR
ATTENTION !

QUESTIONS – SUGGESTIONS – DISCUSSION

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 58


Feedback
Please complete your session evaluation.

Be courteous — deposit your trash,


and do not take the handouts for the following session.

Thank You !

© SAP AG 2006, SAP TechEd ’06 / ULM150 / 59

Você também pode gostar