【问题标题】:Correlating values and assign a value to that correlated match关联值并为该关联匹配分配一个值
【发布时间】:2021-11-17 23:29:05
【问题描述】:

我有一个场景,我需要提交始终设置为 password1 的部分密码。

我需要将其提交到的地方称为安全短语,它会随机化您需要插入密码的哪一部分。

示例: First Login

Second Login

所以基本上我必须在第一次登录时添加 sw1,在第二次登录时添加 sr1,这可以更改为系统选择的任何组合。

所以在 Vugen 上,我已经能够看到哪个字段是必需的,并且该输入字段描述了一个 ID,如下例所示:

  • Action.c(82):通知:保存参数“Piece1 = field1”。 (p)
  • Action.c(82):通知:保存参数“Piece2 = field2”。 (一)
  • Action.c(82):通知:保存参数“Piece3 = field3”。 (s)
  • Action.c(82):通知:保存参数“Piece4 = field4”。 (s)
  • Action.c(82):通知:保存参数“Piece5 = a20b7612”。 (w)
  • Action.c(82):通知:保存参数“Piece6 = a8ea1d7e”。 (o)
  • Action.c(82):通知:保存参数“Piece7 = field7”。 (r)
  • Action.c(82):通知:保存参数“Piece8 = field8”。 (d)
  • Action.c(82):通知:保存参数“Piece9 = B3ad5546c”。(1)

当您提交这些必填字段时,它如下所示: "Body=a20b7612=w&a8ea1d7e=o&B3ad5546c=1&登陆页面

我想说的是,有没有办法将密码的每个字母分配给每个piecex 值(括号中的值),然后一旦piecex 不等于fieldx 和其中一个随机 ID 让它在 Body= 的括号中提交该值?

任何建议都将不胜感激。

谢谢

【问题讨论】:

    标签: c loadrunner autocorrelation vugen


    【解决方案1】:

    我这样做了:

    List<string> Array2 = Get<List<string>>("c_surephraseIDs_41");
    List<string> Array1 = new List<string> { "p", "a", "s", "s", "w", "o", "r", "d", "1" };
    List<string> Array3 = new List<string> { "", "", "", "", "", "", "", "", "" };
    int j = 0;
    
    for (int i = 0; i < 9; i++) {
    
        if (Array2[i].Length > 6) {
                                    
            Array3[j] = Array2[i] + "=" + Array1[i];
    
            if (j == 0) {
                Set<string>("PPleft1", Array2[i]);
                Set<string>("PPright1", Array1[i]);
            }
            if (j == 1) {
                Set<string>("PPleft2", Array2[i]);
                Set<string>("PPright2", Array1[i]);
            }
            if (j == 2) {
                Set<string>("PPleft3", Array2[i]);
                Set<string>("PPright3", Array1[i]);
            }
    
            //WriteMessage(Array3[j]);
            j++;
        }
    }
    
    

    【讨论】:

    • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
    猜你喜欢
    • 2021-10-23
    • 2022-01-20
    • 1970-01-01
    • 2019-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多