Hi,
My SUT has a diary page which can either be in 30 minute mode or 1 hour mode. When in 30 minute mode there is a gap of 30 mins between each of the TRs in the table body. See below:
TR1 12am
TR2 (no innertext)
TR3 1am
TR4 (no innertext)
TR5 2am
etc...etc...
When the diary is in 1 hour mode there is a gap of 1 hour between each TR, see below:
TR1 12am
TR2 (no innertext)
TR3 2am
TR4 (no innertext)
TR5 4am
etc...etc...
What I need to do is set up a test that will validate that the diary is in 1 hour mode when the user selects that this should be the case. This would be an easy test to create if the starting point of the diary was always 12AM (in such a case I would just validate that TR3 equals 2am, or that TR5 equals 4am) but it won't be. The start time will be dependent on the start time of the user's first appointment (i.e. it will change all the time). Hence, what I need to check is that the innertext value of TR3 is 2 hours more than the innertext value in TR1. But the inner text of TR1 will not be known until runtime. Is there a way I can do this? If not, can you suggest another means by which I can test this scenario?
Thanks in advance.
Martin
How to Validate Time Gaps
How to Validate Time Gaps
You do not have the required permissions to view the files attached to this post.
Re: How to Validate Time Gaps
How about something like this -
Code: Select all
Validate.IsTrue(GetInterval() == 1, "Validating diary is in 1 hour mode.");
public static int GetInterval(){
IList<DivTag> times = Host.Local.Find<DivTag>("/dom//div//th//div[@innertext!='all day']");
int diff = 0;
if(times.Count > 2){
int time1 = int.Parse(times[0].InnerText);
int time2 = int.Parse(times[1].InnerText);
diff = time2 - time1;
}
return diff;
}
Re: How to Validate Time Gaps
Thanks for the response.
I should have said, is there anyway to create this diary test soley through the use of the Ranorex GUI tools rather than having to write a piece of user code? I want to try and avoid manipulating user code if at all possible.
Thanks!
Martin
I should have said, is there anyway to create this diary test soley through the use of the Ranorex GUI tools rather than having to write a piece of user code? I want to try and avoid manipulating user code if at all possible.
Thanks!
Martin
Re: How to Validate Time Gaps
It is possible - you would prob have to restore your DB to a known state in your global set up then use a known user where you know what their start time is. If you want to do any clever dynamic things, you are going to have to learn a bit of programming imo....that is automation!
Re: How to Validate Time Gaps
OK Many thanks!