Delay.SpeedFactor works backwards

Bug reports.
befair
Posts: 14
Joined: Thu Dec 15, 2011 8:07 pm

Delay.SpeedFactor works backwards

Post by befair » Thu Jan 19, 2012 7:51 pm

Operating systems: Windows 7 Professional sp1, Windows XP Professional sp3
Ranorex versions: 3.1.3, 3.0.1
Issue 1: Neither the API documentation (http://www.ranorex.com/Documentation/Ranorex/), the tutorial (http://www.ranorex.com/Documentation/Ra ... torial.pdf), nor the user guide shipped with Ranorex adequately describe the operation of Delay.SpeedFactor.
There is a post in the forum (http://www.ranorex.com/forum/unable-to- ... -t820.html) that does say something about the operation, but either it is wrong, or the functionality has been broken. I vote for it being broken. "and if you set the Delay.SpeedFactor you can globally scale all delays, so for example if you use Delay.Seconds(10) in some locations, and you set
SpeedFactor = 0.5 then all delays are reduced to 5 seconds.
"
Issue 2: Operation is the opposite of what is decribed in the posting, and is opposite to the intuitive understanding of the operation. It doesn't really matter to me which way it works. I just needed a way to know. Please add to the documentation.
Here is a bit of code that demonstrates this:
CODE: SELECT ALL
//
/*
 * Created by Ranorex
 * User: u0019165
 * Date: 2012-01-19
 * Time: 12:57
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using System.Threading;
using System.Drawing;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using WinForms = System.Windows.Forms;

using Ranorex;
using Ranorex.Core;
using Ranorex.Core.Reporting;
using Ranorex.Core.Testing;

namespace SpeedFactor
{
    class Program
    {
        [STAThread]
        public static int Main(string[] args)
        {
            Keyboard.AbortKey = System.Windows.Forms.Keys.Pause;
            int error = 0;
            
            string logFileName = "Reports/Test.rxlog";
            Report.Setup(ReportLevel.Info, logFileName, true);
       
            
  			Mouse.DefaultMoveTime = 50;
			Keyboard.DefaultKeyPressTime = 0;
			Delay.SpeedFactor = 1.0;
			
            try
            {
            	Report.Info("Delays are 6 seconds");
            	Report.Info("speed factor = 1.0");
            	Report.Info(System.DateTime.Now.ToString());
            	Report.Info("Delaying");
            	Delay.Milliseconds(6000);
            	Report.Info(System.DateTime.Now.ToString());
            	
            	Delay.SpeedFactor = 0.5;
            	Report.Info("speed factor = 0.5");
            	Report.Info(System.DateTime.Now.ToString());
            	Report.Info("Delaying");
            	Delay.Milliseconds(6000);
            	Report.Info(System.DateTime.Now.ToString());
            	
            	Delay.SpeedFactor = 2.0;
            	Report.Info("speed factor = 2.0");
            	Report.Info(System.DateTime.Now.ToString());
            	Report.Info("Delaying");
            	Delay.Milliseconds(6000);
            	Report.Info(System.DateTime.Now.ToString());
            }
            catch (Exception e)
            {
                Report.Error("Unexpected exception occurred: " + e.ToString());
                error = -1;
            }
            return error;
        }
    }
}

The output is:
2012/01/19 13:16:12.886 INFO User Delays are 6 seconds

2012/01/19 13:16:12.889 INFO User speed factor = 1.0

2012/01/19 13:16:12.906 INFO User 2012-01-19 13:16:12

2012/01/19 13:16:18.909 INFO User 2012-01-19 13:16:18

2012/01/19 13:16:18.916 INFO User speed factor = 0.5

2012/01/19 13:16:18.923 INFO User 2012-01-19 13:16:18

2012/01/19 13:16:30.930 INFO User 2012-01-19 13:16:30

2012/01/19 13:16:30.938 INFO User speed factor = 2.0

2012/01/19 13:16:30.945 INFO User 2012-01-19 13:16:30

2012/01/19 13:16:33.952 INFO User 2012-01-19 13:16:33

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Delay.SpeedFactor works backwards

Post by Support Team » Fri Jan 20, 2012 2:52 pm

Hi,

You are absolutely correct. The docs don't really describe it, and I unfortunately got the example wrong in that post :oops:
The correct way is that the higher the speed factor, the shorter the delays are. We fill fix the API doc for it; But IMHO its not counter-intuitive.

Michael
Ranorex Team
.
Image

befair
Posts: 14
Joined: Thu Dec 15, 2011 8:07 pm

Re: Delay.SpeedFactor works backwards

Post by befair » Fri Jan 20, 2012 6:24 pm

Probably just me thinking backwards. I asked a couple of other people how they thought it would work, and they thought it worked the way it does. Anyway thanks for fixing.