Validation

fs.textContent('my-test-file.txt').should == 'hello world\nid=15'

Content Extraction

Use .data to access actual file content for further processing def actualFileContent = fileTextContent.data Use extractByRegexp to extract content from a file by regular expression def id = fileTextContent.extractByRegexp("id=(\\d+)") http.get("/customers/${id}") { // ... }

Write To File

def path = fs.writeText('my-test-file.txt', 'hello world')

Replace File Content

Use replaceText to replace text in place fs.replaceText(path, ~/(\d+)/, '"$1"') a=1 b=2 a="1" b="2"

Wait For Content

fs.textContent declares file content, but doesn't access it right away. WebTau reads file content when validation happens. Here is an example of waiting on file content: def fileTextContent = fs.textContent('my-test-file.txt') fileTextContent.waitTo contain('id=15') Use takeSnapshot and waitTo change to wait for any file change: def textContent = fs.textContent(path) textContent.takeSnapshot() ... textContent.waitTo change