Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TestNG in Eclipse, Reference to undefined variable env.DOMAIN_PATH

I just got a error when I try to run a unit test in Eclipse with TestNG, the error message is: Reference to undefined variable env.DOMAIN_PATH

but this problem does not exist when I run it in Intellj or with maven.

any one experience this problem?

I use Eclipse Mars.2 Release (4.5.2), and updated TestNG plugin version 6.9.12.201607091356

thanks.

like image 248
sujoe Avatar asked Sep 22 '16 14:09

sujoe


2 Answers

When I was trying to run TestNG, I got the same error. I changed the preferences in Eclipse for TestNG -> Maven so that systemPropertyVariables and environmentVariables are unchecked, and I was able to run the test cases successfully.

Before

Screenshot of Maven preferences with systemPropertyVariables and environmentVariables checked.

After

Screenshot of Maven preferences with systemPropertyVariables and environmentVariables now unchecked.

like image 162
justnisar Avatar answered Sep 30 '22 21:09

justnisar


I faced the same issue. and for me, it worked by unchecking all the options from Preferences->TestNG-> Maven.

enter image description here

like image 36
JavaTech Avatar answered Sep 30 '22 23:09

JavaTech