Updated LoadRunner Date/Time sample script

A couple of days ago, I read Scott Moore’s interesting article about using multipliers to increment LoadRunner date/time variables by multiples of more than one day.

This made me look at my own date/time sample script, mentioned in an earlier post, and incorporate Scott’s suggestions in there. I added some sample code to check to see what day it was and calculate the number of days until next Monday.

Next Monday LoadRunner

Click the icon below to download the script containing this code together with other examples of date/time manipulation in LoadRunner.
zip
DateTimeSamples

 

For those of you who like to see “code” in posts, here is the “Next Monday” code in full…

//What date is next Monday?
lr_save_datetime(“%A”, DATE_NOW, “Today”);

if (strcmp (lr_eval_string(“{Today}”),”Monday”)==0)
{
lr_save_datetime(“%d/%m/%y”, DATE_NOW+(ONE_DAY*7), “DDMMYY”);
lr_output_message(“Today is Monday, next Monday’s Date is %s”,lr_eval_string(“{DDMMYY}”));
}
if (strcmp (lr_eval_string(“{Today}”),”Tuesday”)==0)
{
lr_save_datetime(“%d/%m/%y”, DATE_NOW+(ONE_DAY*6), “DDMMYY”);
lr_output_message(“Today is Tuesday, next Monday’s Date is %s”,lr_eval_string(“{DDMMYY}”));
}
if (strcmp (lr_eval_string(“{Today}”),”Wednesday”)==0)
{
lr_save_datetime(“%d/%m/%y”, DATE_NOW+(ONE_DAY*5), “DDMMYY”);
lr_output_message(“Today is Wednesday, next Monday’s Date is %s”,lr_eval_string(“{DDMMYY}”));
}
if (strcmp (lr_eval_string(“{Today}”),”Thursday”)==0)
{
lr_save_datetime(“%d/%m/%y”, DATE_NOW+(ONE_DAY*4), “DDMMYY”);
lr_output_message(“Today is Thursday, next Monday’s Date is %s”,lr_eval_string(“{DDMMYY}”));
}
if (strcmp (lr_eval_string(“{Today}”),”Friday”)==0)
{
lr_save_datetime(“%d/%m/%y”, DATE_NOW+(ONE_DAY*3), “DDMMYY”);
lr_output_message(“Today is Friday, next Monday’s Date is %s”,lr_eval_string(“{DDMMYY}”));
}
if (strcmp (lr_eval_string(“{Today}”),”Saturday”)==0)
{
lr_save_datetime(“%d/%m/%y”, DATE_NOW+(ONE_DAY*2), “DDMMYY”);
lr_output_message(“Today is Saturday, next Monday’s Date is %s”,lr_eval_string(“{DDMMYY}”));
}
if (strcmp (lr_eval_string(“{Today}”),”Sunday”)==0)
{
lr_save_datetime(“%d/%m/%y”, DATE_NOW+(ONE_DAY*1), “DDMMYY”);
lr_output_message(“Today is Sunday, next Monday’s Date is %s”,lr_eval_string(“{DDMMYY}”));
}

 

 

A great (free) way to receive SMS alerts

Introduction
For some time, I’ve been using IFTTT (if this then that) to simplify my online existence. For those of you who don’t know IFTTT is a free online service that monitors various information feeds and takes action when particular condition is met.

IFTTT describes these rules as “recipes” and a variety of different triggers can be used to prompt an action.

IFTTT sample recipe
IFTTT supports a variety of channels which can be used as triggers. Some are relatively simple such as date/time triggers; for example you may want to receive an email a few days before an important birthday. Others are more complex; for example you could use a trigger to notify you by SMS when you’re tagged in a Facebook photograph. Users can share recipes that they create with the wider IFTTT user base.

My problem
I’m a director of Vivit, the HP Software User Group and one of my responsibilities is social media, this means that I share some responsibility for the Vivit website.

Last week I was on holiday when the site suffered a temporary outage. This was due to a hardware failure and was rapidly resolved by our hosting provider. This got me thinking about how I could ensure that I received alerts when I didn’t have access to my Vivit email account.

Our site uptime is monitored using a free service from monitor.us and various Vivit directors receive email alerts in the event of a problem. I wanted to ensure that as well as the emails, I received SMS notifications of these problems.

The solution
I already had a gmail account and I arranged for email messages from monitor.us to be forwarded to my Gmail account. I gave IFTTT access to my gmail inbox and created a recipe to ask it to look for emails from no-reply@monitor.us (this is the account used by monitor.us for alerts).

My IFTTT recipe

Now each time that I receive an email alert, I get an SMS.

IFTTT checks my email every 15 minutes, which is more regularly than I check my own email. I have found this to be a pretty good way of keeping informed about problems.

Solution to problem when application stays minimised (Windows 7)

I had this problem today and it caused me some real grief until I sorted it out. I think that the problem is related to using difference screen resolutions at home and work. Yesterday I was working in the office where I typically use my laptop screen for monitoring e-mail, Twitter feeds etc. and my larger external monitor for “the task at hand”. Today I’m working at home where I have two large screens attached to my PC. To access information on my laptop, I typically RDP onto my laptop and display its output onto one of my two PC screens.

Some applications store information about the screen resolution and try to start up in the same positions as they were when you shut them down. This can cause problems. For example, this morning I tried to open an application, the application icon appeared in the windows taskbar but I couldn’t minimise or maximise the application. All I could do was close the application down by right clicking the icon in the taskbar.
To resolve this problem it is possible to maximise an application using the following steps. This ensures that the application becomes visible on a currently active screen.
Right click the taskbar to bring up task manager.
Right clickin the list of running applications and click Maximizeoday I’m working at home where I have two large screens attached to my PC. To access information on my laptop, I typically RDP onto my laptop and display its output onto one of my two PC screens.

 

Some applications store information about the screen resolution and try to start up in the same positions as they were when you shut them down. This can cause problems (as I discovered). For example, this morning I tried to open an application, the application icon appeared in the windows taskbar but I couldn’t minimise or maximise the application which meant that I couldn’t use it. All I could do was close the application down by right clicking the icon in the taskbar.

 

To resolve this problem it is possible to maximise an application using the following alternative method.
This ensures that the application becomes visible on a currently active screen.

 

  • Right click the taskbar to bring up task manager.
  • Right clickin the list of running applications and click Maximize.