1、testNG需要了解的知识
ITestContext这个类可以直接在方法参数里使用,主要作用是可以通过它的context.getSuite()直接获取suite的相关信息。还可以通过它的 context.getCurrentXmlTest().getAllParameters() 获取xml中suite标签内所有parameter参数对应值。还可以通过
context.getCurrentXmlTest().getXmlClasses().get(0).getAllParameters() 获取test内第一个class中所有parameter参数对应值。
2、java需要注意
父类中调this
继承时,对于方法覆盖时,new的谁,this就指向谁,多态性决定,this.test()指向子类中的test()
如果是成员变量,this在哪个类就指向哪个类的成员变量,成员变量没有多态性,this.a指向父类中的属性a
3、实现数据驱动的关键


@Test中的dataProvider和@Dataprovider中的name一致

浙公网安备 33010602011771号