BeforeSuite 在 Testng 中出现套件问题

BeforeSuite Trouble With Suite of Suites in Testng

我有一套房如下。这些套件单独执行时,包含测试的父 class 中的 @BeforeSuite 方法按预期运行。但是当我将这些套件组合在一个父套件中时,@BeforeSuite 只执行一次。

这是预期的行为吗?或者应该为每个套件文件执行一次 BeforeSuite 方法?

<?xml version="1.0" encoding="UTF-8"?>
<suite name="Parent Regression Suite">
    <suite-files>
           <suite-file path="./testng_xmls/LoginTests.xml" ></suite-file>
           <suite-file path="./testng_xmls/Info.xml" ></suite-file>
    </suite-files>
</suite>

尝试为以下对象添加参数:

@BeforeSuite(alwaysRun = true)

如果需要,还有 AfterSuite。

我想通了这个问题。问题出在别处。 Beforesuite 代码被跳过了第二个套件!代码修复后 @BeforeSuite 现在对每个套件文件执行一次。