genxgeek
genxgeek

Reputation: 13357

How to set current working directory for java test?

Can somebody tell me how I can set the current working directory for a given test? I have a test file test1Test.java and trying to figure out how I can find a file properties menu to edit the current working directory when the test is run?

I'm looking to just right click click on the file test1Test.java to do this but new to Intellij.

Upvotes: 2

Views: 7056

Answers (1)

b2Wc0EKKOvLPn
b2Wc0EKKOvLPn

Reputation: 2074

Assuming your test is part of a properly configured module, and the test itself is configured to be run by a given junit runner, all you need to do, right-click on the test in the project view and chose the run option. This will create a run configuration with the test name, and you can access that configuration and make sure that the working directory is the module the test belongs to.

You might refer to jetbrain documentation for further details.

Upvotes: 3

Related Questions