# Usage

## Prepare TestBench

After installation you can call the portal application TestBench at any time by calling the URL

<server:port>/irj/servlet/prt/portal/prtroot/com.sap.portals.sherlok.TestBench

Then you will see the Main View of TestBench.

## General Operation Overview

You should use two browser windows

- one window to start TestBench
- one window to start your iView

There are two ways to start a portal iView in a browser

- In PortalAnywhere.Go select Go button of your iView
  URL = /irj/servlet/prt/portal/prtroot/PortalAnywhere.Go
- In ContentAdministration seach your iView and select Preview
  URL = /irj/servlet/prt/portal/prtroot/com.sap.portal.navigation.portallauncher.default

In the first case you start the iView with fixed parameter set defined in the portalapps.xml file. The better way is to choose the ContentAdministration, because you can enter a well defined parameter set and test your iView with different settings.

Before you start your iView select Reset button of the TestBench. That will clear all values and start the execution. Now repeat the following steps at least 5-10 times

- Execute your iView and all steps that belongs to a logical unit of your test
- Select NextStep button of the TestBench, to call the GC and to start a new entry in the memory history table

## Example

In the following example TestBench works with the iView Default Framework Page. The iView is called 5 times with the preview function and after each call the NextStep button of the TestBench is pressed. The test uses the testbench.properties file and adds all methods of the package "com.sapportals.portal" as profile points:

- ProfilePackages=com.sapportals.portal.

### Preparation

In the ContentAdministration select Default Framework Page:

- Open ContentAdministration
  URL = /irj/servlet/prt/portal/prtroot/com.sap.portal.navigation.portallauncher.default
- Select Search button
- Enter Seach String "*Frame*"
- With the right mouse click open the context menu of Default Framework Page and choose Edit
- Now you have the iView in the editor pane

Open the TestBench in another browser window and press Reset button. Follow the steps

- Press Preview button in the ContentAdmin window
- Press NextStep button in the TestBench window

### ProfilePoints

The result is a list of all ProfilePoints with active links for drill down.

### Memory Consumption

If you click on the link in column "CurrSize" for the component TabContentComponent and you get the memory allocation history for this component.

Note: This view shows all memory by your iView and the memory allocated by used services. So you see the memory usage, your iView is responsible for, and not just the memory allocated by the iView itself.

The detail view shows the following entries:
NrGC | GC number, i.e. GCs since start of the J2EE server
Total | Total memory for the 'scope' after a GC
Allocated | Allocated memory for the 'scope' between two GCs
Deallocated | Deallocated memory during this GC (again for scope)
TimeStamp | Timestamp for the GC (zero for current time)

As result you can see for the component TabControlComponent:

- It needs 160 + 7272 bytes to initialize (first two entries)
- It needs 38.424 bytes for each request cycle
- It needs 320 bytes of static data

### Time Consumption

If you click on the link in column Name, you get the time measurement for each method of the iView.

The detail view shows the following entries:
CpuTime | Cumulated Time needed by CPU to run this request
Elapsed | Cumulated Time elapsed from method entry to exit
NrCalls | Number of calls since last reset
Name | Name of the method

The component TabControlComponent has three methods and two of them are in the scope of the TestBench timer :

- doContent was called 5 times, with overall 7 sec CPU-time and 20 sec to return the request
- addFrameworkHTML was called 5 times with overall 2 sec CPU-time and 5 sec to return the request