问题描述
我用 TestNG的
运行测试。我有几个测试套件( Suite1.xml 的 Suite2.xml 的和的 Suite3.xml 的),该组合在一间套房( MasterSuite.xml 的)。除了这些,我有我的地方配置等方法, @BeforeTest
,<$ C $类 TestBase.java
, C> @BeforeMethod , @BeforeSuite
, @AfterSuite
等
运行 @AfterSuite
方法关闭驱动程序( driver.quit()
)。
我要什么:运行的MASTERSuite
这将运行我所有的3间套房此起彼伏
问题:第一套房后( Suite1
)被执行,司机被关闭,因此, Suite2
无法运行。
我怎样才能解决这个问题/问题?
&LT;?XML版本=1.0编码=UTF-8&GT?;
&LT;!DOCTYPE套件系统http://testng.org/testng-1.0.dtd&GT;
&LT;套件名称=的MASTERSuite&GT;
&LT;套房文件&GT;
&LT;套房文件路径=Suite1.xml/&GT;
&LT;套房文件路径=Suite2.xml/&GT;
&LT;套房文件路径=Suite3.xml/&GT;
&LT; /套房文件&GT;
&LT; /套房&GT;
如果你想要相继运行一套房,而不是并行运行它们,那么就应该足以启动驱动程序@BeforeSuite方法。
在这样所有的套房都会有初始化的webdriver单独的实例。
I use testng
for running tests. I have several test suites(Suite1.xml, Suite2.xml and Suite3.xml), which are combined in one suite (MasterSuite.xml). Besides those, I have the class TestBase.java
, where I configure such methods as @BeforeTest
, @BeforeMethod
, @BeforeSuite
, @AfterSuite
, etc.
Running the @AfterSuite
method closes the driver (driver.quit()
).
What I want: run MasterSuite
which will run all my 3 suites one after another.
The problem: after the first suite (Suite1
) is executed, the driver is closed and thus, Suite2
can't be run.
How can I resolve this issue/problem?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="MasterSuite">
<suite-files>
<suite-file path="Suite1.xml" />
<suite-file path="Suite2.xml"/>
<suite-file path="Suite3.xml"/>
</suite-files>
</suite>
If you want to run one suite after another and not to run them in parallel, then it should be enough to start your driver in @BeforeSuite method.
In that way all your suites will have separate instance of WebDriver initialized.
这篇关于TestNG的多套房。 @AfterSuite方法关闭驱动程序套件1和2套房无法运行后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!