score:140

Accepted answer

run -> run configurations, select project, second tab: “arguments”. top box is for your program, bottom box is for vm arguments, e.g. -dkey=value.

score:0

yes this is the way:

right click on your program, select run -> run configuration then on vm argument

-denv=environmentname -dcucumber.options="--tags @ifthereisanytag"

then you can apply and close.

score:3

this will work for junit. for testng use following command

-ea -dmykey="value" -dmykey2="value2"

score:13

you can add command line arguments to your run configuration. just edit the run configuration and add -dmyprop=value (or whatever) to the vm arguments box.

score:49

you can use java system.properties, for using them from eclipse you could:

  1. add -dlabel="label_value" in the vm arguments of the test run configuration like this:

eclipse_vm_config

  1. then run the test:

    import org.junit.test;
    import static org.junit.assert.assertequals;
    
    public class main {
        @test
        public void test(){
            system.out.println(system.getproperty("label"));
            assertequals("label_value", system.getproperty("label"));
        }
    }
    
  2. finally it should pass the test and output this in the console:

    label_value
    

Related Query

More Query from same tag