Giter VIP home page Giter VIP logo

Comments (14)

cbeust avatar cbeust commented on July 17, 2024

I'm sorry but I don't understand the description of the problem...

from testng-eclipse.

anthavio avatar anthavio commented on July 17, 2024

I have in Run Configuration for TestNG test VM argument
-Dlogistika.root.dir=${workspace_loc:gdit}/logistika-lib/work
Test is started in gdit directory a it calls System.getProperty("logistika.root.dir") and correct full path was returned.
After today's TerstNG plugin upgrade, test fails on FileNotFoundException because path returned now is relative and prefixed with project name (gdit)

from testng-eclipse.

cbeust avatar cbeust commented on July 17, 2024

Based on your description, I don't see anything that might be caused by the TestNG plug-in: you pass a property with -D and retrieve it with System.getProperty().

You might want to check how Eclipse expands ${workspace_loc:gdit}.

from testng-eclipse.

anthavio avatar anthavio commented on July 17, 2024

Quick test made me even more confused
@test
public void test() {
System.out.println("From test " + System.getProperty("logistika.root.dir"));
}

public static void main(String[] args) {
    System.out.println("From main " + System.getProperty("logistika.root.dir"));
}

Sysout:
From test ${workspace_loc:gdit}/logistika-lib/work
From main W:\devel\project\gdit\trunk/logistika-lib/work
But we have been using this for moths...
Can I get older version of plugin somewhere?

from testng-eclipse.

cbeust avatar cbeust commented on July 17, 2024

Yes, as indicated in the Download section of the doc:

http://beust.com/eclipse-old/

(these are update sites)

from testng-eclipse.

anthavio avatar anthavio commented on July 17, 2024

So after downgrade to TestNG 5.14.6.20110207_1250 it works again
Sysout:
From test W:\devel\project\gdit\trunk/logistika-lib/work

from testng-eclipse.

anthavio avatar anthavio commented on July 17, 2024

Still not working in 5.14.10.20110304_1036 :(

from testng-eclipse.

anthavio avatar anthavio commented on July 17, 2024

Still not working in 6.0.0.20110318_0929 :(
Why is this ticket it closed?
I guess we were left behind...

from testng-eclipse.

chrisdolan avatar chrisdolan commented on July 17, 2024

I've reproduced this problem when upgrading from the TestNG eclipse plugin from 5.12 to 6.0.1. Downgrading TestNG fixes the problem. Is there anything I can do to help get to the root cause of this issue?

from testng-eclipse.

cbeust avatar cbeust commented on July 17, 2024

I still have no idea what "gdit" means in this context. If I run this from TestNG, I get:

Property:${workspace_loc:gdit}/logistika-lib/work

If I run it as a Java application (printing the value of the system property in main), I get an error dialog saying "Variable references non-existent resource ${workspace_loc:gdit}.

Please give me something I can reproduce.

from testng-eclipse.

chrisdolan avatar chrisdolan commented on July 17, 2024

On Apr 28, 2011, at 5:35 PM, cbeust wrote:

I still have no idea what "gdit" means in this context. If I run
this from TestNG, I get:

Property:${workspace_loc:gdit}/logistika-lib/work

If I run it as a Java application (printing the value of the system
property in main), I get an error dialog saying "Variable references
non-existent resource ${workspace_loc:gdit}.

Please give me something I can reproduce.

The "gdit" is not important. It's just the name of an Eclipse project
in the user's workspace, and the workspace_loc expands to the path to
that project. Without the ":gdit" it expands to the path to the
current project, whatever that is. It's a standard eclipse variable.
The point is that under TestNG 5.12, the variable is expanded
correctly, just as it does in other launchers (Run, Debug, Profile,
Emma, etc). But under TestNG 6.0 (and 5.14 according to the other
commenter) the variables are not populated. So, something has changed
in the launch starting TestNG 5.14. I did a diff of testng-eclipse
5.12.0.6 vs 5.14.1.4 (git commits
ecbbaef and
41bb506) but I couldn't see anything
obvious that could cause the regression.

Chris

from testng-eclipse.

cbeust avatar cbeust commented on July 17, 2024

I'm looking into the issue but off the top of my head, I don't remember changing anything that might have impacted that. For some reason, Eclipse is no longer expanding the ${workspace:projectName} variable and I have no idea how to make it do that.

from testng-eclipse.

svenhoff avatar svenhoff commented on July 17, 2024

I'm also facing the problem described in this issue.

I checked the code on master branch and found the problem has been introduced in commit 495317e of org.testng.eclipse.launch.TestNGLaunchConfigurationDelegate.
In TestNGLaunchConfigurationDelegate the org.testng.eclipse.ui.util.ConfigurationHelper.getJvmArgs(ILaunchConfiguration) is used to get VM arguments instead of org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate.getVMArguments(ILaunchConfiguration). AbstractJavaLaunchConfigurationDelegate performs a variable substitution.

The problem could be fixed by making the testng plugin dependent on org.eclipse.core.variable and perform variable substitution in ConfigurationHelper as shown in the patch below.

diff --git plugin.xml plugin.xml
index 4e6dfbc..e2aa999 100644
--- plugin.xml
+++ plugin.xml
@@ -37,6 +37,7 @@
       <import plugin="org.eclipse.search"/>
       <import plugin="org.eclipse.ltk.core.refactoring"/>
       <import plugin="org.eclipse.ltk.ui.refactoring"/>
+      <import plugin="org.eclipse.core.variables"/>
   </requires>

   <extension-point id="reporterListenerContributorSchema" name="%reporterListenerContributor.name" schema="schema/reporterListenerContributorSchema.exsd"/>
diff --git src/main/org/testng/eclipse/ui/util/ConfigurationHelper.java src/main/org/testng/eclipse/ui/util/ConfigurationHelper.java
index ddeb12c..c8ef2c1 100644
--- src/main/org/testng/eclipse/ui/util/ConfigurationHelper.java
+++ src/main/org/testng/eclipse/ui/util/ConfigurationHelper.java
@@ -2,6 +2,7 @@

 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.variables.VariablesPlugin;
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationType;
@@ -151,6 +152,7 @@
        try {
            result = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,
                result);
+           result = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(result);
        } catch (CoreException e) {
            e.printStackTrace();
        }

from testng-eclipse.

cbeust avatar cbeust commented on July 17, 2024

This looks good, could please you issue a pull request?

Thanks a lot for taking the time to figure this out!

from testng-eclipse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.