How to get the project path in command line

我怕爱的太早我们不能终老 提交于 2020-01-25 21:13:51

问题


I create a TestNG project in Eclipse, and I use System.getProperty("user.dir") to get the base folder (like "D:\project\selenium") of the project, but when I run the TestNG in the command line, the base folder returns "C:\users\username\", is there any way to solve this question?


回答1:


A similar issue was fixed in the latest version of the eclipse plugin: https://github.com/cbeust/testng/issues/903

You should try to upgrade the plugin.




回答2:


Probably the issue is that when you run it via command line, your user.dir corresponds to your global user directory (C:\users\username).

Before you run your tests, try to change your current directory to the one where your Eclipse project is hosted (i.e. cd D:\project\selenium). And after that run your tests.

Unfortunately I do not have Windows at hand right now, so can't test it by myself.



来源:https://stackoverflow.com/questions/34080696/how-to-get-the-project-path-in-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!