关于java继承关系的疑问

背景:在写测试用例套件,下面的Base和Login就是测试集里的两个类
代码如下,Login继承Base,执行测试集后,这个Base和Login都会被执行,这样的话相当于执行了两遍beforeTest(),想请教一下如何不执行Base中的方法?


public class Base {
    public static WebDriver driver;
    public static  File file;
    
      @BeforeTest
      public void beforeTest() {
          file=new File("src\\main\\resources\\chromedriver.exe");
          System.setProperty("webdriver.chrome.driver",file.getAbsolutePath());
          System.out.println(file.getAbsolutePath());
          driver = new ChromeDriver(); //初始化driver
          driver.manage().window().maximize();
      }
}

public class Login extends Base {

      @BeforeTest
      public void f() throws InterruptedException, IOException {
          driver.get("http://******:****/cloud-manager/index/");
//          登录
          driver.findElement(By.xpath("//*[@id='LAY-user-login-username']")).sendKeys("hhh");;
          driver.findElement(By.xpath("//*[@id='LAY-user-login-password']")).sendKeys("111111");
          driver.findElement(By.xpath("//*[@id='LAY-user-login-vercode']")).sendKeys("123");
          driver.findElement(By.xpath("//*[@id='subBtn']")).click();
    }
    
}

这个继承没关系,而是@BeforeTest注解的原因,如果不想执行Base的可以注释掉这个注解,但是driver 不就NullPoint了吗