AludraTest/aludratest

FileFieldImpl writes hard coded to target/classes

Closed this issue · 1 comments

FileFieldImpl should write its temporary files not hard-coded to target/classes/<myfile.dat> for multiple reasons:

  • It pollutes the target/classes directory, which could be packaged into a JAR, depending on Maven project configuration
  • Maven could be reconfigured to use another directory than "target" for the project build (although this is highly unlikely)
  • AludraTest does not need to be run with a Maven project at all.

Instead, I would suggest creating a temporary file using File.createTempFile, and delete it after use, or mark it for deletion on VM termination (file.deleteOnExit()).

OR, have a configuration property available in the seleniumWrapper.properties which allows specifying this temporary directory (and could have e.g. target/uploadedFiles as default).

JDK's temp file mechanism is not applicable, since the file name of the uploaded file is reported to the server and might matter for a specific test case. I chose the approach to use a folder "target/temp" and create it on demand if it does not exist. Files are not deleted after the test run to allow for easier issue analysis.