I am an automated tester in selenium and c# (not the greatest developer) but I have been tasked to find out the uptime and downtime of the website. Now I guess this script would be run everyday because my scripts run on a build server at 00.05am every night. So my question is how do I get the numbers? I have found a pretty good post on here which is similar but what I don't understand is, how to get the availability/uptime over a period of time? How did he get 86400)/100) * 97.91m? Check out the code guys
CultureInfo provider = CultureInfo.InvariantCulture;
DateTime first = DateTime.ParseExact("20.04.2015", "dd.MM.yyyy", provider);
DateTime last = DateTime.ParseExact("26.04.2015", "dd.MM.yyyy", provider);
TimeSpan time = last - first;
decimal secondsUptime = ((time.Days * 86400)/100) * 97.91m; //97.91 is the uptime calculated above for the time period.
// The problem is how to get this?
decimal secondsDowntime = ?
So the guy had problems getting the downtime and the posts answer was this:
decimal PercentDownTime = 100 - PercentUpTime;
decimal SecondsUpTime = (time.Seconds / 100) * PercentUpTime;
decimal SecondsDownTime = (time.Seconds / 100) * PercentDownTime;
This is ideally a monitoring problem. You may not need selenium for this. Few ways could be
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.