Search code examples
cloadrunnerautocorrelationvugen

Correlating values and assign a value to that correlated match


I have a scenario where I need to submit parts of a password that is always set to password1.

Where I need to submit it in is called a surephrase and it randomizes which part of your password you need to insert.

Example: First Login

Second Login

So essentially I would have had to add sw1 on the First Login and sr1 on the second login, and this can change to whichever combinations the system chooses.

So on Vugen I have been able to see that which field is required, and an ID is described to that input field as example below:

  • Action.c(82): Notify: Saving Parameter "Piece1 = field1". (p)
  • Action.c(82): Notify: Saving Parameter "Piece2 = field2". (a)
  • Action.c(82): Notify: Saving Parameter "Piece3 = field3". (s)
  • Action.c(82): Notify: Saving Parameter "Piece4 = field4". (s)
  • Action.c(82): Notify: Saving Parameter "Piece5 = a20b7612". (w)
  • Action.c(82): Notify: Saving Parameter "Piece6 = a8ea1d7e". (o)
  • Action.c(82): Notify: Saving Parameter "Piece7 = field7". (r)
  • Action.c(82): Notify: Saving Parameter "Piece8 = field8". (d)
  • Action.c(82): Notify: Saving Parameter "Piece9 = B3ad5546c".(1)

And when you submit those required fields it looks like below: "Body=a20b7612=w&a8ea1d7e=o&B3ad5546c=1&landingpage

What I would like to wrap my head around is, is there a way to assign each letter of the password to each piecex value, (the value in the bracket) and then once the piecex does not equal fieldx and one of those random ID's let it submit that value in the bracket in the Body= ?

Any advise would be appreciated at this point.

Thanks


Solution

  • I did this:

    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++;
        }
    }