We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More
This site is now read-only. You can still browse and search as usual. Learn More
Helen's reply got me thinking... Could we just use the powers of JavaScript directly?
function test()
{
var str = "type1=12345678901234567890111&type2=3.0.00&type3=1234567811";
var strarr = str.split('&');
for (var i = 0; i < strarr.length; i++) {
var typearr = strarr[i].split('=');
Log.Message(strarr[i]);
switch (typearr[0]) {
case 'type1':
Log.Message("TYPE1: length = " + typearr[1].length);
break;
case 'type2':
Log.Message("TYPE2: length = " + typearr[1].length);
break;
case 'type3':
Log.Message("TYPE3: length = " + typearr[1].length);
break;
default:
Log.Message("unrecognized type");
break;
}
}
}
produces
If type1 is supposed to be 23 chars, then char 31 had better be "t"
in a similar fashion
char 44 should also be "t"
That would be the simplest way to check. If you want the test to be more flexible, then you can parse the string and look for "type1" and then count some number of chars after that, then repeat that for each substring.
You can do any of the aqString functions in a keyword test using Run Code Snippet.
If you need help with either of these approaches, just ask!
Hi Marsha_R I'm note sure I under the
"If type1 is supposed to be 23 chars, then char 31 had better be "t"
in a similar fashion
char 44 should also be "t""
Part of your post.
type1=12345678901234567890111 - if were to count each numeric as an individual id have 23 total numerics if that makes sense. So I want to count everything after the equal for type1.
I believe this is what I need to do "That would be the simplest way to check. If you want the test to be more flexible, then you can parse the string and look for "type1" and then count some number of chars after that, then repeat that for each substring."
Thanks again, can you explain this part further please and thank you again.
Will you always be counting to 23 for type 1, or do you want to make it flexible and work for any length?
The field is meant to have a specific length so if the value is either not long enough or ends up being to long the item should be flagged as failing or throw a warning to the logs.
So I believe setting a static expectation would work.
When you build the long string, can you put the & delimiter at the end of the string (after item3) as well?