I want to know what is the correct way of setting up a folder directory within SOAPUI. Should I use setup scripts within each testcase or testsuite level or should they be setup within a groovy script step whenever required?
Currently I decided to use the groovy script method only because if I use it in a setup script, it means I have to run the setup script first to get the folder directory before I can run the test case that contains a script assertion.
Below is an example of my folder directory set up in a groovy script (called test script):
def date = new Date()
def folderTime = date.format("yyyy-MM-dd HH-mm-ss")
//Create a folder directory for the responses
RootResultFolder = dataFolder + "\\Log Smoke Test Data" + "\\xxx" + "\\xxx - " + folderTime + "\\"
CreateResultFolder = new File(RootResultFolder)
CreateResultFolder.mkdir()
...
context.setProperty( "RootResultFolder", RootResultFolder )
Below is my script assertion within a test step that uses the above folder directory:
def date = new Date().format("yyyy-MM-dd")
def time = new Date().format("HH.mm.ss")
def dataFolder = context.getProperty("RootResultFolder")
def fileName = xxx+ ".txt"
def rootFolder = dataFolder + fileName
def logFile = new File(rootFolder)
logFile.write "TEXT: " + xxx + "\n\n" +
JsonOutput.prettyPrint
Thank you
Test Run xxxxdirectory. Can be created multiple times even for the same day? If so, have you tried moving your current suite levelsetup scriptto test case level or script assertion itself? - RaoSOAPUI_HOME/bin/testrunner, then no such thing is needed, you can look at the documentation which accepts one directory to store all the results which is fine I believe. - Rao