Tuesday, 3 June 2014

Citrix Error : Error 2320 in load runner

 "Error 2320"


Citrix is now common practice to make available all application using web interface. Some time while
accessing your application which published using Citrix gives an error known as “Error 2320”


          


Steps to resolve the issue:

1
. Open Registry using “regedit” command on Run window.

2. Make a practice to have backup of registry whenever you are going to modify the registry value since
your action can corrupt the windows.so its a best Practise always.

3. If your OS in 32 bit then

i) Go to the HK Local Machine registry key
ii) Access this path “HKLM\SOFTWARE\Citrix\ICA Client\Engine\Lockdown Profiles\All Regions\
     Lockdown\Virtual Channels\Control”
iii) Remove “ClientHostedApp” key from this.

4. Re-launch Citrix and try to access your application

5. If your OS in 64 bit then

i) Go to the HK Local Machine registry key
ii) Access this path “HKLM\SOFTWARE\Wow6432Node\Citrix\ICA Client\Engine\Lockdown
     Profiles\All Regions\Lockdown\Virtual Channels\Control”
iii) Remove “ClientHostedApp” key from this.

6. Re-launch Citrix and try to access your application.

while replaying the recorded script can give some errors like-Error: Failed to get window size, wrong format.etc ..,

Unable to detect client version.
Warning: Extension CitrixClientImpl.dll reports error -1 on call to function ExtPerThreadInitialize
Error: Vuser failed to initialize extension CitrixClientImpl.dll in load runner

By using the Citrix protocol we can perform  the load testing in load runner
BestPractice for Citrix applications:

1. You can use "HTTP" and "Citirix" protocol together in load runner.
2. Try to keep windows in full screen mode.


Some time while replaying the recorded script can give some error too.like 

"Error: Failed to get window size, wrong format.

Unable to detect client version.

Warning: Extension CitrixClientImpl.dll reports error -1 on call to
function ExtPerThreadInitialize

Error: Vuser failed to initialize extension CitrixClientImpl.dll"


Solution:

1.
 Save the script after recording.
2. Go to Script directory and look for "default.cfg” file
3. Open the file into edit mode
4. Add below mentioned code in file and save it

[CITRIX]
DesktopColors=32
Colors=True Color (24 bit)
Enctyption=128 Bit
Window=1024 x 768
Latency=Use Server Default
Compression=1
Cache=0
Queue=0
Sound=Use Server Default
BitmapSyncLevel=Exact
[CommandArguments]
[ModemSpeed]
CustomModemSpeed=
EnableModemSpeed=0
EnableCustomModemSpeed=0
ModemSpeed=14400
[TIMEOUT]
Connect=180
Waiting=60
Typing=150
[FILTERS]
IncludeFiltersInList=
FilterType=0
[AED]
TempAedFile=NO_APP_AT_AED

5. Replay your script.

Service Virtualization in loadrunner controller

    HP Service Virtualization is the power tool for development and testing teams to remove delay-causing roadblocks. This visually intuitive software provides development and testing teams building composite applications with a flexible solution to remove constraints by virtualizing services within existing environments both onsite and in the cloud. By enabling parallel development and early functional testing, Service Virtualization eliminates wait times for teams delivering at Agile speed. And, HP Service Virtualization reduces costs, by eliminating the requirement for access to constrained business-critical infrastructure or pay-per-use cloud components for testing.



Key benefits:
  • Remove wait times for constrained services and speed delivery
  • Reduce budgets required to run and manage complex test environments
  • Eliminate expenses from dev/test access to third-party services
  • Reduce downtime risk by engaging quality early
  • Minimize security risk with broader test coverage

Monday, 2 June 2014

Uses of IIS Server & Installation of IIS Server

IIS (Internet Information Services) Server and Uses :


IIS stands for Internet Information Services. It can also commonly known as Internet Information
Server.Sometime creating test bed we need to install IIS. IIS is Microsoft server is software provided with
MS operating system which handles all the HTTP/Https requests. It is a part of windows component.IIS
server is used for displaying web pages on your system at local level which can open on other systems
as well.

There are various parts of IIS. In which following are compulsory to install :

  1. Common Files: The main files and services included with IIS
  2. Documentation: Files of the Default Web Site, files containing IIS error messages and the basic
    HTML documentation
  3. Internet Information Services Snap-In: An application for managing IIS from the Microsoft
    Management Console
  4. World Wide Web Server: Represents HTTP services in compiled form.
  5. Below are optional components of IIS server:
  6. File Transfer Protocol (FTP) Server: It is included in the system provides support for an FTP
    account.
  7. NNTP Service: Service to host newsgroups
  8. SMTP Service: This is email server service
  9. FrontPage 2000 Server Extensions: A communication protocol which provides authoring and
    administering service
  10. Internet Service Manager :This is used to configure and monitor IIS using WWW pages
  11. Visual InterDev RAD Remote Deployment Support: It is a sub-component that assists in the
    development of web applications.
Please note that last three components may make your system little vulnerable to security. Kindly avoid
installing them until it is required for your application.

Step to install IIS Server:

Method of installing is always same but till Microsoft XP, we require XP cd while installing IIS server.
But in higher version we don’t require operating system CDs.

Step 1: Navigate to Control Panel->Programs->Programs and Features.




Step 2: Click on “Turn Windows Features on or off” link

Step 3: Select “Internet Information Service” check box and click on “OK” button.





Step 4: A message will appear




After message box disappear, IIS server has installed successfully on server.

Step 5: Go to “Run “and type “inetmgr” . It will open IIS server.

Allow particular Port Communication over Firewall

    The firewall is always enable in professional environment due to security issue. Sometime during testing, we need some ports which should be allowed to communicate over enabled firewall.


Steps to enable the firewall :

Step 1: Navigate to Control Panel->All Control Panel Items>Windows Firewall

Step 2: Click on Advance settings link





Step 3: Click on “Inbound Rules”





Step 4: Click on “New Rule”


Step 5: Select “Port” and click on “Next”






Step 6: Enter the port number in “Specific local ports” and click on next





Step 7: Select “Allow the connection” and click on next




Step 8: In this section you can choose in which network you want allow this port for communication
              purpose.





Step 9: You can give name of port (it can be anything like general name)





Step 10: You can see the added port as below. You can disable, delete or modify the rule anytime.



You can also configure outbound/outgoing communication of port using same process but you need
to select “Outbound Rule” instead of “Inbound Rule”.and also you can also block the port or allow
communication only when connection is secure. Same way you can also allow/block any application
over enabled firewall.

To know only WebPage Content was delivered Securely

Want to view only the webpage content that was delivered securely-Error in load runner

In IE 7 and earlier, this dialog would cause annoyance to users but generally didn't cause any other
significant problems. This was because it was worded in such a way that most users would click on
the Yes button and allow non-secure content to be downloaded.

However, the wording in the IE 8 version of this dialog has changed:


           


Some sites are going to find that their secure pages in IE 8 have the following problems:
Any non-secure HTTP image beacons used for analytics data gathering will often be ignored
The page may not display or even work correctly if it relies on non-secure images, CSS or Javascript


Going to Tools->Internet Options->Security
  • Select the Security tab
  • Click on the Internet zone icon at the top of the tab page
         

  • Click the Custom Level button
  • In the Miscellaneous section change Display mixed content to Enable
  • Repeat steps 1 – 5 for the Local intranet and Trusted sites zones


         


In this way we can solve the pop up..!

Monitoring Unix Resources through Controller

   There is no need for any Load Runner installation to be on a Unix/Linux Machine to be monitored.


However, the machine must have the default RSTAT daemon installed and running. The controller
establishes a UDP socket connection with the UNIX machine. It first communicates with port 111 on
the Unix machine and this port is then mapped to the dynamic port on which the rstatd is working.
The controller then queries rstatd and all communication takes place through this established UDP
socket connection.

Starting the rstatd process in Unix
To monitor UNIX resources, you must configure the rstatd daemon. Note that the rstatd daemon
might already be configured, because when a machine receives an rstatd request, the inetd on that
machine activates the rstatd automatically.

To verify whether the rstatd daemon is already configured:
The rup command reports various machine statistics, including rstatd configuration. Run the following
command to view the machine statistics:
>rup host

A remote host will only respond if it is running the rstatd daemon. If you do not receive a response, or if
you receive an error message, the rstatd daemon is not configured.

To configure the rstatd daemon:

 Run the command: su root
  • Go to /etc/inetd.conf and look for the rstatd row (it begins with the word rstatd). If it is commented
    out (with a #), remove the comment directive, and save the file. From the command line, run:
  • > kill -1 inet_pid 
  • where inet_pid is the pid of the inetd process. This instructs the inetd to rescan the /etc/inetd.conf
    file and register all daemons which are uncommented, including the rstatd daemon. 
  •  Run rup again.
If the command still does not indicate that the rstatd daemon is configured, contact your system
administrator.

Which port is rstatd daemon running on:
You can run a UNIX utility called rpcinfo and identify the rstatd's port number. By running
> rpcinfo -p
you will receive a list of all RPC servers registered in the host's portmapper, along with the port number.

Scripting for Microsoft ASP.NET VIEWSTATE in VuGen LoadRunner

      ASP.NET web applications maintain state of data by passing hidden _VIEWSTATE field encoded using base64 algorithm. The state of the page is restored based on the VIEWSTATE. If on the client side, the value of textbox has been changed, VIEWSTATE will now have the new value. (Obviously, this stage does not happen when the page is requested for the first time).


Let’s see how Web Applications developer store objects in VIEWSTATE,

// Storing a Customer object in view state.
Customer cust = new Customer ("Dilip", "Kutarmare");
ViewState["CurrentCustomer"] = cust;

// Retrieve a student from view state.
Customer cust = (Customer) ViewState["CurrentCustomer"];

Now we will see how to capture and replace VIEWSTATE in a recorded script,

1. First set the html parameter length to maximum so that it can store VIEWSTATE, You can adjust this
number after examining the captured value.

       web_set_max_html_param_len("50000");

2. Capture the VIEWSTATE value when it is returned from the server using web_reg_save_param()
function

web_reg_save_param("MyViewState","LB=\"__VIEWSTATE\" value=\"","RB=\"",
"ORD=ALL",LAST);


3. Substitute the captured value with the parameter name in which you captured the VIEWSTATE:

      "Name=__VIEWSTATE", "value={MyViewState}", ENDITEM,

4. Run the script (with enabled advanced log) in VuGen and verify that the correlation function is
capturing the right value.

Representational State Transfer (REST) API Load Testing

Load testing of a REST API, using HP LoadRunner’s web_custom_request

     In recent years, Representational State Transfer (REST) has become a dominant model for software
architecture, especially for Web-based applications. Today, most large websites and Web applications
on the Internet have REST APIs. Some examples of websites using REST APIs include Twitter, Google,
Flickr and so on.

     The great thing about a REST API is that it is usually well-defined and therefore allows clear separation
between the client logic and the server logic. This property in itself is very beneficial for both functional
and load testing of the application server. In the following article we will demonstrate an easy way to test
your application’s REST API using HP LoadRunner’sweb_custom_request method.

REST API Basics

Before we dive into load testing, let’s look at the basic terminology of a REST API. A REST API call
consists of three major components:

The Uniform Resource Identifier (URI) – This is a string which consists of three parts. The first part
contains the host (and optionally, the port) of the API call (e.g. http://www.hp.com). The second part
contains the path which identifies the call functionality. This path can include some parameter values
although they are distinguishable from the constants only by semantics (e.g. /users/megwhitman/type
/ceo, where “megwhitman” and “ceo” are parameters while “users” and “type” are constants). The third
part is the QueryString which is a list of key-value pairs (e.g. user= megwhitman & type=ceo). The pairs
are separated by the “&” sign and the entire QueryString is separated from the path by the “?” sign. A full
URI may look something like this:

http://www.shopping.hp.com/en_US/home-office/-/products/Tablets/Tablets?SearchParameter
=ElitePad


         The verb – The verb can be any word describing the operation you want to perform on the URI.
In HTTP, the five most commonly used verbs are: GET, POST, PUT, DELETE, and PATCH.
Note that the operation for each verb is determined by the server although there are some common
conventions in this area.

The payload (data) – This is the data sent to the server with the request.

For example, if we want to save a text file to the server, we can send the content of the text file as the
payload.

Test Case

     The example application under test is a todoMVC application which manages a ‘todo’ list. This
application has a REST API, as follows:

/todos, GET, No Payload – Retrieves all the todos currently in the list
/todos, POST, { isFinished :, todoText: } – Creates a new todo on the server with the text provided in
the payload by theparameter.
/todos/, PUT, {id:, todoText: , isFinished:< isFinished>} – Updates the todo with id with the text and
finished state < isFinished>

Note that all the data passed to and received from the server is in the JavaScript Object Notation (JSON)
format
 which is gradually becoming the standard format for data transfer.

HP LoadRunner allows us to easily simulate HTTP calls through the web_custom_request function.
We want to simulate a business process as follows:

1) Get the existing todos from the server

2) Add two new todos

3) Update the last todo added with a new text

Step 1

We use recording to ‘learn’ this step. In VuGen we create a new Web - HTTP/HTML script and record
a browser opening the todoMVC application. When the application starts, it gets all the todos currently
stored on the server through the GET API call. We can easily find the correct step in the recorded script
by looking at the URL argument. In this case the argument is - "URL=http://localhost:3000/todos"
(since the application is running locally on port 3000 on my machine). The relevant step is:

web_custom_request("todos",
"URL=http://localhost:3000/todos",
"Method=GET",
"Resource=1",
"RecContentType=application/json",
"Referer=http://localhost:3000/",
"Snapshot=t66.inf",
LAST);

The “Method” argument is the REST verb (GET in this case), and the “Snapshot” argument links to the
correct snapshot file on the disk. The snapshot of this step can be viewed in the Snapshot Viewer:






We can see that the response from the server is a list of all the todos presented by our application in JSON
format.

Step 2

Adding a new todo is very simple. We create our own web_custom_request step with the parameters
required by thePOST REST API. The created step looks something like this:

web_custom_request("Add Todo",
"URL=http://localhost:3000/todos",
"Method=POST",
"Resource=0",
"EncType=application/json",
"Mode=HTTP",
"Body={\"isFinished\":false,\"todoText\":\"This is VuGen\"}",
LAST);

A few things to notice here:

1) The “Method” (verb) is POST as required by the REST API.

2) We specified the “EncType” parameter to inform the server that the payload is going to be in JSON
format.

3) We added our payload to the “Body” parameter in JSON format.

Since writing the JSON in the middle of the script may be a bit cumbersome, we can add it as an extra
file to the script. To do this simply right-click the “Extra Files” node in the Solution Explorer and select
“Add Files to Script…”, and choose the data.json file we prepared earlier. On a fresh installation of
LoadRunner you may need to specify the .json extension as a valid extension for extra files. You can
also do this after adding the file to your script. In VuGen, select Tools > Options > Scripting > Script
Management and add the .json extension to the Allowed Extensions list. Once the file is added, the project
looks something like this:

                               
                                        


Now we can add the file as our payload by specifying the BodyFilePath parameter:
web_custom_request("Add Todo from file",
"URL=http://localhost:3000/todos",
"Method=POST",
"Resource=0",
"EncType=application/json",
"Mode=HTTP",
"BodyFilePath=data.json",
LAST);

Step 3

We want to update the last todo with some new values. To do this, we use another web_custom_request
with the PUTverb as specified by the REST API. This is very similar to the step that adds a new todo:

web_custom_request("Update Todo",
"URL=http://localhost:3000/todos/3",
"Method=PUT",
"Resource=0",
"EncType=application/json",
"Mode=HTTP",
"Body={\"id\":3, \"isFinished\":false,\"todoText\":\"Updated the name\"}",
LAST);

This command updates the todo with id = 3 with the string “Updated the name”.

As with the previous step, you can manage the JSON text as a file, rather than writing it directly into
the script.

Conclusion

We’ve seen how easy it is to create a simple load test with a REST API using HP LoadRunner.
The web_custom_requestfunction is versatile enough to cover both simple and complex cases, thus
simplifying REST API testing.