0

We use the Ranorex Studio in our company for black-box testing. I am a newbie concerning black-box testing. For a very first automated test, I want to create two tests that use a number of methods from a file that was generated by adding a recording module and changing this to user code by clicking the items, pressing the right mouse button and selecting 'Convert to user code'.

The code has methods (where the names were refactored by me) of the form public void Mouse_Click_<something>(RepoItemInfo inputtagInfo, …). This means that whenever I want to call any such method, I should pass a RepoItemInfo object. How can I define the "proper" object to call this method? In other words: What to write on the right-hand side of info = ????????

According to the Ranorex help page, using RepoItemInfo

as arguments for user code actions enables a variety of possibilities such as providing a framework of smart test actions, defining generic technology independent get/set value actions, combining several related actions to one user code action, implementing complex validations and many more.

I have the following code:

namespace FirstTestProject
{
    public partial class OpenIVMAndJobsite
    {
        private GoSearchJobsite gsj;
        private RepoItemInfo info;

        /// <summary>
        /// This method gets called right after the recording has been started.
        /// It can be used to execute recording specific initialization code.
        /// </summary>
        private void Init()
        {
            // Your recording-specific initialization code goes here.
            gsj = new GoSearchJobsite();
            info = ???????;
        }

        public void JobsiteSearch()
        {
            gsj.Mouse_Click_Country(info, Properties.EAustrianCountries.Wien);
        }

        public void Mouse_Click()
        {
            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click at {X=0,Y=0}.");
            Mouse.MoveTo(0, 0);
            Mouse.Click(System.Windows.Forms.MouseButtons.Left);
        }

    }
    […]

    public partial class GoAndSearchInJobsite
    {
        /// <summary>
        /// This method gets called right after the recording has been started.
        /// It can be used to execute recording specific initialization code.
        /// </summary>
        private void Init()
        {
            // Your recording specific initialization code goes here.
        }

        public void Mouse_Click_Country(RepoItemInfo atagInfo, string country)
        {
            Report.Log(ReportLevel.Info, "Mouse", "<" + country + ">\r\nMouse Left Click item 'atagInfo' at 16;8.", atagInfo);
            atagInfo.FindAdapter<ATag>().Click("16;8");
        }

        […]

    }

    /// <summary>
    /// Description of Properties.
    /// </summary>
    public static class Properties
    {
        public enum EAustrianCountries
        {
            Alle,
            Burgenland,
            Kärnten,
            Niederösterreich,
            Oberösterreich,
            Salzburg,
            Steiermark,
            Tirol,
            Vorarlberg,
            Wien
        }

    }
}
Sae1962
  • 1,122
  • 15
  • 31

1 Answers1

2

Each item in the repository will have a corresponding ReportItemInfo object as well. For example, if you have a button as ButtonOK, you will also find ButtonOKInfo object. You can use it with repo.<window>.control mechanism. If you are dealing with window itself, the object will be repo.<window>.selfInfo.

Hope it helps.

Thanks, Manoj

Sae1962
  • 1,122
  • 15
  • 31
Manoj
  • 67
  • 3