Where does a relative path point?
QuizMediumJava only
Your test opens Path.of("testdata/users.csv"). It works in the IDE (your code editor) but fails on the CI server (a server that runs tests automatically). Which statements are true? Pick all that apply.
- A relative path is resolved against the working directory (
user.dir) of the JVM - A relative path is resolved against the folder of the class file
- Putting the file under
src/test/resourcesand reading it withgetClass().getResourceAsStream("/users.csv")works from any working directory - Using an absolute path such as
C:\\Users\\me\\users.csvis the best fix
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.