Relative Paths in Java/Selenium/Maven -
i have test suite links csv file stored on local machine check values/string expected when run tests. using selenium(java) have linked maven run in jenkins build. have written method read in csv 2d array. works fine file path /home/usr/location
however need place csv file on many vms test production environments. when try change relative path such ~/location
file not found error.
i have correct permissions
i'd suggest keep csv file build, , on classpath (e.g. src/test/resources/csv/
) or whatever. should able csv file classpath.
or if need separate path, e.g. src/test/csv
should suffice. in case should able path using ./src/test/csv
(as working directory maven build project directory).
if want use user's home directory, go system properties, looking user.home
, please aware of possible issues described more here
alternatively, use kind of environment (or application-managed) property, make csv file located somewhere on file system, configure based on actual environment. mean starting application or tests -dcsv.location=/proper/location/data.csv
.
Comments
Post a Comment