File Content

def path = fs.writeText('my-test-file.txt', 'hello world') fs.textContent('my-test-file.txt').should == 'hello world\nid=15' 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 .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}") { // ... }

Copy

def dir = fs.createDir("my-dir") fs.copy("data/message.txt", dir) def dir = fs.tempDir("fs-copy") fs.copy("data/message.txt", dir) fs.copy("data/message.txt", "data/new-message.txt")

Unzip

def dir = fs.tempDir('for-unzip') fs.unzip('data/data.zip', dir)