Est-il possible de faire défiler un tableau et de sélectionner un caractère à partir du passwd
en utilisant la valeur ord[i]
? CodeComment faire une boucle dans un tableau dans un script beanshell dans jmeter 3.2
String ordinal = vars.get("ordinal");
String[] ord = ordinal.split(",");
log.info(ord[0]);
String passwd = vars.get("password");
requiredOrd = new ArrayList();
for(int i=0; i< ord.length; i++)
{
requiredOrd.add((passwd.charAt(ord[i])));
}
log.info(requiredOrd[0]);
message d'erreur
Returns comme suit:
2017-10-23 10: 23: 26270 ERREUR oajuBeanShellInterpreter: Erreur d'invocation de méthode de BSH: eval fichier sourcé: évaluation en ligne de: String ordinal = vars.get("ordinal"); String[] ord = ordinal.split(","); log.inf . . . '' : Error in method invocation: Method charAt(java.lang.String) not found in class'java.lang.String' 2017-10-23 10:23:26,270 WARN o.a.j.e.BeanShellPostProcessor: Problem in BeanShell script: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of:
chaîne ordinal = vars .get ("ordinal"); String [] ord = ordinal.split (","); log.inf. . . '': Erreur dans l'invocation de méthode: Méthode charAt (java.lang.String) introuvable dans class'java.lang.String '
Modified code original et et comprennent maintenant un message d'erreur – Nobody
https://stackoverflow.com/help/someone- réponses – user7294900