Is it possible to write data to a file inside a JSR223 Assertion using javascript as the language? How can it be done?
0
votes
2 Answers
6
votes
It is somehow possible.
Due to security reasons you cannot access file system in JavaScript, but according to JSR223 specification is is not only possible to call scripts from Java but you can do the opposite thing - call Java from scripts, in your case from JavaScript. The relevant code would be:
var writer = new java.io.PrintWriter('your_file.txt')
writer.write('hello')
writer.close()
Reference material and code snippets:
