Ask a Question

Semantic error when generating phone number

JesseHedges
New Contributor

Semantic error when generating phone number

I'm using the DataSource Generator to generate a random phone number to use in my tests. I'm using the Custom String type, so I can specify an area code like so: %PHONE(408-XXX-XXXX) However, about 30% of the time, it generates an invalid phone number like 408-0XX-XXXX or 408-1XX-XXXX and I get a "semantic error" message in my response, because the phone number format is invalid.

For US phone numbers, how would I modify my Custom String to make this work? Or is it controlled by the application? If so, could we get that fixed?

1 REPLY 1
Samuel_Young
New Contributor

Jesse,

 

While not quite as beautified, the following string will return phone numbers and allow for more custom options.

%INT(4,4,false, 1)%INT(0,0,false, 1)%INT(8,8,false, 1)-%INT(2,9,false, 1)%INT(1,9,false, 1)%INT(1,9,false, 1)-%INT(1,9,false, 1)%INT(1,9,false, 1)%INT(1,9,false, 1)%INT(1,9,false, 1)

 

Cheers

 
 
 
cancel
Showing results for 
Search instead for 
Did you mean: