You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: "Added string.counterString to Domain Test Data"
4
4
authors: [alan]
5
5
tags: [release, test-data, domain]
6
+
date: 2026-05-20T10:30
7
+
---
8
+
9
+
`string.counterString` is now available in the domain model.
10
+
11
+
This is the first `string.*` domain addition that is not backed directly by Faker, and is implemented as a custom domain delegate.
12
+
13
+
<!-- truncate -->
14
+
15
+
## Why add it?
16
+
17
+
Counterstrings are useful for field-length and truncation testing because each marker shows its position in the generated text.
18
+
19
+
Example pattern:
20
+
21
+
`*3*5*7*9*12*15*`
22
+
23
+
If we entered the above into a field that truncated to 14 we would see:
24
+
25
+
`*3*5*7*9*12*15` - this looks incorrect because I'm expecting to see a number before an `*`, if I see a number without an `*` then I know there has been some truncation.
26
+
27
+
## Usage
28
+
29
+
`string.counterString(min, max, delimiter="*")`
30
+
31
+
- If only one integer is supplied, it is used as both min and max.
32
+
- If two integers are supplied, the lower value is used as min and the higher as max.
33
+
- Lowest allowed min is `1`.
34
+
- Delimiter defaults to `*`.
35
+
- If a delimiter longer than one character is passed, only the first character is used.
36
+
37
+
Examples:
38
+
39
+
```txt
40
+
Fixed15
41
+
string.counterString(15)
42
+
```
43
+
44
+
```txt
45
+
Range5to12
46
+
string.counterString(min=5, max=12)
47
+
```
48
+
49
+
```txt
50
+
HashDelimited
51
+
string.counterString(12, 12, "#")
52
+
```
53
+
54
+
## Take Care
55
+
56
+
We've added no limits to the length of the counterstrings to take care in your definitions. Sure you can create 1,000,000 rows with counterstrings that are 1,000,000 characters long, but I'm not sure if your computer is going to like generating that.
57
+
58
+
We default to a `1-25` character counterstring to mitigate this risk somewhat.
59
+
60
+
## Other counterstring resources
61
+
62
+
If you are interested in using CounterStrings in your testing then checkout this Chrome extension:
0 commit comments