Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method System.getProperty("java.io.tmpdir") returns 'C:\Windows' directory after update to testng 0.6.10 in Eclipse Java EE IDE for Web Developers #903

Closed
doctordrue opened this issue Nov 30, 2015 · 11 comments

Comments

@doctordrue
Copy link

When using TestNG after update it to 0.6.10 version with Eclipse IDE property "java.io.tmpdir" becomes to "C:\Windows"
Using

Eclipse Java EE IDE for Web Developers.

Version: Mars.1 Release (4.5.1)
Build id: 20150924-1200

and Microsoft Windows 10

For example this code:

    public static void main(String[] args) {
        System.out.println(System.getProperty("java.io.tmpdir"));
    }

returns C:\Users\Andrey\AppData\Local\Temp\
but this one:

    @Test
    public void f() {
        System.out.println(System.getProperty("java.io.tmpdir"));
    }

returns C:\WINDOWS\

@cbeust
Copy link
Collaborator

cbeust commented Nov 30, 2015

How is that a TestNG issue?

@atassaad
Copy link

To prove it's TestNG, here are the steps:
1- In the configuration force java.io.tmpdir to your temp dir (In AppData). Eclipse uses that and every method that is invoked before the tagged scopes uses it.
4- Run in the debugger even with the java.io.tmpdir override above. Every call within a tagged method (@BeforeSuite for instance) will invariably return java.io.tmpdir = C:\Windows\ regardless of what the override was.
Also:
2- Run the test until firefox is launched, then kill the test, leaving firefox up.
3- Try to do anything useful with the browser, since it's set to tmpdir C:\Windows, pretty much nothing works (especially javascript).

@missedone
Copy link
Contributor

@atassaad
could you check the command line used to launch the testng process within Eclipse, by clicking "Window (on top level menu) -> Show view -> Error Log", you will see log entries starts with "[TestNGLaunchConfigurationDelegate] Launching:", double click it to view the whole info.

BTW, do you use maven to manage your java project? do you have any "argLine" configuration defined for maven-surefire-plugin or maven-failsafe-plugin in the pom.xml?
Also, do you see this issue if run test with maven? or pure testng command line?

@doctordrue
Copy link
Author

I don't use maven in this test project.
This is the launch string with testng-eclipse 6.9.9 (i replaced my home path to %USERHOME%):

[TestNGLaunchConfigurationDelegate] Launching:
  Classpath: D:\Work\EclipseWorkspace\testngeclipse\bin %USERHOME%\.p2\pool\plugins\org.testng.eclipse_6.9.9.201510270734\lib\testng.jar %USERHOME%\.p2\pool\plugins\org.testng.eclipse_6.9.9.201510270734\lib\jcommander.jar %USERHOME%\.p2\pool\plugins\org.testng.eclipse_6.9.9.201510270734\lib\bsh-2.0b4.jar %USERHOME%\.p2\pool\plugins\org.testng.eclipse_6.9.9.201510270734\lib\snakeyaml.jar
  VMArgs:    -ea
  Class:     org.testng.remote.RemoteTestNG
  Args:      -serport 52373 -d D:\Work\EclipseWorkspace\testngeclipse\test-output D:\Work\EclipseWorkspace\testngeclipse\testng.xml
java -ea -classpath D:\Work\EclipseWorkspace\testngeclipse\bin:%USERHOME%\.p2\pool\plugins\org.testng.eclipse_6.9.9.201510270734\lib\testng.jar:%USERHOME%\.p2\pool\plugins\org.testng.eclipse_6.9.9.201510270734\lib\jcommander.jar:%USERHOME%\.p2\pool\plugins\org.testng.eclipse_6.9.9.201510270734\lib\bsh-2.0b4.jar:%USERHOME%\.p2\pool\plugins\org.testng.eclipse_6.9.9.201510270734\lib\snakeyaml.jar org.testng.remote.RemoteTestNG -serport 52373 -d D:\Work\EclipseWorkspace\testngeclipse\test-output D:\Work\EclipseWorkspace\testngeclipse\testng.xml

and it's return java.io.tmpdir=%USERHOME%\AppData\Local\Temp\ as windows short path (DOS-style).
And this one is a launch string with testng-eclipse 6.9.10, that returns java.io.tmpdir=C:\Windows\

[TestNGLaunchConfigurationDelegate] Launching:
  Classpath: D:\Work\EclipseWorkspace\testngeclipse\bin %USERHOME%\.p2\pool\plugins\org.testng.eclipse_6.9.10.201511281504\lib\testng.jar %USERHOME%\.p2\pool\plugins\org.testng.eclipse_6.9.10.201511281504\lib\jcommander.jar %USERHOME%\.p2\pool\plugins\org.testng.eclipse_6.9.10.201511281504\lib\bsh-2.0b4.jar %USERHOME%\.p2\pool\plugins\org.testng.eclipse_6.9.10.201511281504\lib\snakeyaml.jar
  VMArgs:    -ea
  Class:     org.testng.remote.RemoteTestNG
  Args:      -serport 52569 -d D:\Work\EclipseWorkspace\testngeclipse\test-output D:\Work\EclipseWorkspace\testngeclipse\testng.xml
java -ea -classpath D:\Work\EclipseWorkspace\testngeclipse\bin:%USERHOME%\.p2\pool\plugins\org.testng.eclipse_6.9.10.201511281504\lib\testng.jar:%USERHOME%\.p2\pool\plugins\org.testng.eclipse_6.9.10.201511281504\lib\jcommander.jar:%USERHOME%\.p2\pool\plugins\org.testng.eclipse_6.9.10.201511281504\lib\bsh-2.0b4.jar:%USERHOME%\.p2\pool\plugins\org.testng.eclipse_6.9.10.201511281504\lib\snakeyaml.jar org.testng.remote.RemoteTestNG -serport 52569 -d D:\Work\EclipseWorkspace\testngeclipse\test-output D:\Work\EclipseWorkspace\testngeclipse\testng.xml

I can't see differences.

Also adding string -Djava.io.tmpdir=%TEMP% to run configuration solve the problem with temp directory, but other Windows environment parameters problems stay on, for example Selenium Webdriver returns that exception when calling FirefoxDriver.quit():

Dec 01, 2015 11:46:42 AM org.openqa.selenium.os.ProcessUtils killWinProcess
WARNING: Process refused to die after 10 seconds, and couldn't taskkill it
java.lang.NullPointerException: Unable to find executable for: taskkill

With testng plugin 6.9.9 installed from http://beust.com/eclipse-old/eclipse_6.9.9.201510270734 i have no such problems.
So I have no any ideas what caused the problem: testng, tesng-eclipse plugin or someone else.

@missedone
Copy link
Contributor

ok, let's try to narrow down the issue.
could you try with old version of testng (e.g. 6.9.9) for your project. to do so, since your project is not maven based, you need to copy the testng jar file and its dependencies like jcommander, bsh to your project and add them to the project classpath, pls make sure they are on font of testng 6.9.10

@atassaad
Copy link

atassaad commented Dec 1, 2015

My installation on that Windows machine is very simple:
eclipse + TestNG. It worked before 6.10 and that's the only update since Wednesday. I was using 6.9.9 as I tend to be the office canary when it comes to updates.
We always launch tests locally from within eclipse (until they go to jenkins) by running a TestNG XML file as...
We use maven to manage the projects: I do not think we have either maven-surefire-plugin argLine parameters or the maven-failsafe-plugin but I'll check. I'll get you the command line from the log when I get to the office.
Since I'm dead in the water until I get this back up (I should remember always to thank you for the wonderful tool), how to I install TestNG within eclipse without recompiling it from elemental particles?

@doctordrue
Copy link
Author

@missedone
Ok. I'll try to do this.
First I have installed latest testng-eclipse from http://beust.com/eclipse.
Next I copied .jar files from .p2\pool\plugins\org.testng.eclipse_6.9.9.201510270734\lib to my project directory and added testng.jar, testng-remote.jar, bsh-2.0b4.jar and jcommander.jar to project classpath.
Then I run project by "right click on testng.xml --> Run As --> TestNG Suite"
2015-12-01 13_16_26-java - testngeclipse_src_testngeclipse_testtmppath java - eclipse

and java.io.tmpdir still returns *C:\Windows*
2015-12-01 13_21_58-java - testngeclipse_src_testngeclipse_testtmppath java - eclipse
Launch string was:

[TestNGLaunchConfigurationDelegate] Launching:
  Classpath: D:\Work\EclipseWorkspace\testngeclipse\bin D:\Work\EclipseWorkspace\testngeclipse\testng-6.9.9\testng.jar D:\Work\EclipseWorkspace\testngeclipse\testng-6.9.9\testng-remote.jar D:\Work\EclipseWorkspace\testngeclipse\testng-6.9.9\bsh-2.0b4.jar D:\Work\EclipseWorkspace\testngeclipse\testng-6.9.9\jcommander.jar
  VMArgs:    -ea
  Class:     org.testng.remote.RemoteTestNG
  Args:      -serport 54678 -d D:\Work\EclipseWorkspace\testngeclipse\test-output D:\Work\EclipseWorkspace\testngeclipse\testng.xml
java -ea -classpath D:\Work\EclipseWorkspace\testngeclipse\bin:D:\Work\EclipseWorkspace\testngeclipse\testng-6.9.9\testng.jar:D:\Work\EclipseWorkspace\testngeclipse\testng-6.9.9\testng-remote.jar:D:\Work\EclipseWorkspace\testngeclipse\testng-6.9.9\bsh-2.0b4.jar:D:\Work\EclipseWorkspace\testngeclipse\testng-6.9.9\jcommander.jar org.testng.remote.RemoteTestNG -serport 54678 -d D:\Work\EclipseWorkspace\testngeclipse\test-output D:\Work\EclipseWorkspace\testngeclipse\testng.xml

Next I tried a reverse situation: using testng 6.9.10 .jar files and install testng-eclipse plugin from http://beust.com/eclipse-old/eclipse_6.9.9.201510270734
and in this case java.io.tmpdir still returns me C:\Users\ANDREY~1\AppData\Local\Temp\ directory.
2015-12-01 13_33_40-java - testngeclipse_src_testngeclipse_testtmppath java - eclipse
Launch string was:

[TestNGLaunchConfigurationDelegate] Launching:
  Classpath: D:\Work\EclipseWorkspace\testngeclipse\bin D:\Work\EclipseWorkspace\testngeclipse\testng-6.9.10\bsh-2.0b4.jar D:\Work\EclipseWorkspace\testngeclipse\testng-6.9.10\jcommander.jar D:\Work\EclipseWorkspace\testngeclipse\testng-6.9.10\testng.jar D:\Work\EclipseWorkspace\testngeclipse\testng-6.9.10\testng-remote.jar
  VMArgs:    -ea
  Class:     org.testng.remote.RemoteTestNG
  Args:      -serport 54827 -d D:\Work\EclipseWorkspace\testngeclipse\test-output D:\Work\EclipseWorkspace\testngeclipse\testng.xml
java -ea -classpath D:\Work\EclipseWorkspace\testngeclipse\bin:D:\Work\EclipseWorkspace\testngeclipse\testng-6.9.10\bsh-2.0b4.jar:D:\Work\EclipseWorkspace\testngeclipse\testng-6.9.10\jcommander.jar:D:\Work\EclipseWorkspace\testngeclipse\testng-6.9.10\testng.jar:D:\Work\EclipseWorkspace\testngeclipse\testng-6.9.10\testng-remote.jar org.testng.remote.RemoteTestNG -serport 54827 -d D:\Work\EclipseWorkspace\testngeclipse\test-output D:\Work\EclipseWorkspace\testngeclipse\testng.xml

So it looks like testng-eclipse plugin issue?

@atassaad
Copy link

atassaad commented Dec 1, 2015

Yes. it does seem to be an issue with the newer version of TestNG 6.10.xxx. I copied the TestNG features and plugins folders from my Mac's install and put them into my Windows PC eclipse installation. My mac was at version org.testng.eclipse_6.9.9.201510270734. And now everything is back to normal.
Good news is I'm back in business. Let me know if you need any help.

@missedone
Copy link
Contributor

hi guys, could you try the latest updated plugin, and report back
thanks

@doctordrue
Copy link
Author

@missedone
It works good for me with latest update. Thanks for your work!

@atassaad
Copy link

atassaad commented Dec 4, 2015

Sorry this is a little late, but I just updated testing and I'd like to confirm that the new version works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants