A repository of notes about Performance Testing, Automation, RPA, and Web Design.

  • UiPath

    Show all posts related to UiPath

  • Windows

    Show all posts related to Windows

  • Web Design

    Show all posts related to Web Design

Showing posts with label Vugen. Show all posts
Showing posts with label Vugen. Show all posts

How to write logs with newline using IO.write in Ajax Truclient


Suppose you want to create your own log file, here's how to do that in Ajax Truclient using the Evaluate Javascript action from the Toolbox.




So, drag it onto your script, make sure it's inside an Action and not in vuser_init or vuser_end. It didn't work when I initially placed it inside vuser_init and I'm not sure why.

To write to a text file, basically you just need to use IO.write in this format

IO.write(filename[string], input[string], append[boolean], charset[string]);

In my case, since I want to add a timestamp and a newline after every log, here's what I used:

var currentDate = new Date();
IO.write("C:\\Data\\Logs\\logs.txt",currentDate.toLocaleString() + " >>> ",true,"UTF-8");
IO.write("C:\\Data\\Logs\\logs.txt","hello",true,"UTF-8");
IO.write("C:\\Data\\Logs\\logs.txt","\r\n",true,"UTF-8");
  • On line 1 I created a date variable
  • On line 2 I used toLocaleString() method to output the date time in a readable format based on the machine's default locale. In my case it's en-US. You can add parameters to this to specify a different locale. Also, make sure to escape the slashes on the path.
  • On line 3 I appended my log message which says hello
  • On line 4 I appended a carriage return and a newline using \r\n because sometimes \n alone doesn't work

Running it 3x produces this output. Note that it automatically creates the file if it doesn't exist BUT it doesn't create directories.


ALTERNATIVELY, you can also use the Generic API Action from the toolbox to execute the IO.write function.



Just change the category to IO, method name to write, and put it your arguments. It's essentially the same as IO.write but with less coding involved hehe



Hope this helps!

Share:

How to use isRegExpMatch descriptor on Ajax Truclient

For example you are waiting for an object with a message like

"6 card(s) processed successfully."

where 6 could be any number. Here's how to use isRegExpMatch descriptor to identify that object.

First, change the ID method of the object to Descriptors and open the Descriptors Editor.


Then, add a text property (if it's not already there) and set the operator to isRegExpMatch.
When using isRegExpMatch, make sure the value type is set to JS.


Now for the value, I'm not an exepert at regex so I make use of online regex tools to generate the correct expression. I use regexr.com, set the regex engine to Javascript, paste the text I want to match on the textarea, and play around with capturing groups until it matches the entire text.


Here's the regex expression that perfectly matches the entire text:

/(.*) card\(s\) processed successfully./g

There are other variations to this, but this is what worked for me hehe.

When entering the regex value back on the descriptors editor, make sure to include the open and close slashes and the g modifier at the end (in red).

If you notice, the parentheses in (s) are also escaped (in green).

You can always test the descriptor by highlighting the object when it's visible on the page.

Here's another example:

Say you want to match an object with a name like this, where there's a random alphanumeric element in between the path...

/objects/ProfDetTransfer/rows/2g6efbadc10f2d3aaf4d06e1e2307as/attributes/TargetMatterRel.DisplayName

Same thing! Pull up a regex editor..
- replace the dynamic parts with a capturing group
- escape the forward slashes
- enclose the pattern in slashes
- add a g modifier

Here's the expression for that:

\/objects\/ProfDetTransfer\/rows\/(.*)\/attributes\/TargetMatterRel.DisplayName

Hope this helps!

Share:

Start Recording button disabled in HP LoadRunner Vugen 11.50

I was trying to record a web application using Web/Http protocol, but somehow I couldn't begin recording because the "Start Recording" button is disabled.


Current setup:
HP LoadRunner Vugen 11.50
Internet Explorer 11 Cause:
Internet Explorer 11 is not supported by Vugen 11.50

Possible solutions:

  1.  Downgrade to Internet Explorer 10 or
  2. Upgrade to LoadRunner Vugen 12.00 or
  3. Install LoadRunner 11.52 service pack - this worked for me! I can't simply upgrade to Vugen 12 because it's team standard, and IE11 is the company standard browser hehe. In short I can't touch those two. Helpful links here and here.
Share:

Recording video applications using Ajax Truclient protocol

Version: HP Vugen 11.52
Protocol: Ajax Truclient IE

I had a recent task where the project team wanted to know how long it takes for several concurrent users to play a certain video. The goal really is to see how much buffering is happening as the users are increased, and if the server can handle it. The video is housed on Kaltura platform and by their specs, there's not one specific URL source for the video. The video file is chopped into chunks and delivered to several locations where the engine decides where best to host the files. This means we can't use the MediaPlayer protocol as it requires a single source URL.


Would be pretty cool to explore this protocol. But turns out we don't have a license for it so nevermind haha.

Trying out with Web/Http

At first we tried recording the application via good ol' Web/Http protocol. But there's no data that would compute for buffering time, so we moved on. The numbers we're getting from this method are response times from fetching the video resource and that barely says anything about the buffering time, so nope, wouldn't work. As much as possible we try to work on Web/Http first before trying Truclient because it eats up a lot of resources. That means we can't put too much users per load generator. Right now we only have 4 operational load gens, so the amount of users we can run on this test would be compromised by the protocol. However, Ajax Truclient is really the protocol we need, as advised by Protocol Advisor too (which is lost in Vugen 12!)

Moving on with Ajax Truclient IE

So Ajax it is! The steps are really simple, we load the URL then click on the play button then measure the transaction time from there.



As the video plays, the script waits for something that indicates the video has finished playing. In this case, the replay button. We end the transaction at that point.



Note that you have to adjust the timeout settings for waiting the replay button. Use the video duration and add an allowance for waiting. In this example, the video duration is almost 2 minutes or 119 seconds. To be safe, I'm putting a timeout of 300 seconds to allow the video to finish. You don't want your wait step to timeout while the video is still playing. Adjust this number according to how you see fit.

That's pretty much it! The response times we're getting for the Play transaction is definitely within the video duration range plus some considerable delay, probably due to network issues and whatnot, so yep - we're done here!

Blah

This is my first time to record a video application and believe me, it didn't come out this easy. The strategy was there but for some reason the network wouldn't cooperate with me! I worked on this application for weeks and weeks because the video just wouldn't load on my end. One time I'm getting a certificate error, the other time it's a 404, I have no idea what's keeping me from the playing the video. But anyhow, we changed seats and suddenly, the video started playing! So maybe it's just a damned network thing lol.

:)
Share: