我们使用我们公司的 Ranorex Studio 进行黑盒测试。我是关于黑盒测试的新手。对于第一个自动化测试,我想创建两个测试,它们使用通过添加记录模块生成的文件中的多种方法,并通过单击项目、按鼠标右键并选择“转换”将其更改为用户代码到用户代码'。
该代码具有表单的方法(名称由我重构)public void Mouse_Click_<something>(RepoItemInfo inputtagInfo, …)
。这意味着每当我想调用任何这样的方法时,我都应该传递一个RepoItemInfo
对象。如何定义“正确”对象来调用此方法?换句话说:在右边写什么info = ???????
?
根据 Ranorex 帮助页面,使用RepoItemInfo
作为用户代码操作的参数,可以实现多种可能性,例如提供智能测试操作框架、定义通用技术独立的获取/设置值操作、将多个相关操作组合到一个用户代码操作、实现复杂的验证等等。
我有以下代码:
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
}
}
}