我试图在另一个HitMe类中使用CommonDefinations类中的变量值,但由于某种原因,可变值的值在HitMe类中显示为null。我正在使用CommonDefinations类扩展HitMe类。不确定有什么问题。以下是课程。 类CommonDefinations
package com.abc.def;
public class CommonDefinations{
public String sUrl = "www.yahoo.com"
public String jobUrlCheck() {
sUrl = (System.getProperty("CONTEXT_URL") == null ? sUrl : System.getProperty("CONTEXT_URL"));
System.out.println("Base Url: " + sUrl);
return sUrl;
}
}
类HitMe
package com.abc.ghi;
import com.abc.def.CommonDefinations;
public class HitMe extends CommonDefinations {
@Test(priority=1)
public final void hitMeNow() throws Exception {
System.out.println("Url is " +sUrl);
}