我正在使用 selenium 来自动化销售点应用程序的一些测试。因为外部程序用于管理应用程序和外部设备(打印机、钱箱...)之间的通信,所以一次只能打开一个浏览器会话,否则外部程序会混淆(例如:现金抽屉事件一个浏览器会话在另一个中触发)。
我目前一直在我的 testng.xml 文件中执行以下操作:
<suite name="Test Suite" verbose="10" preserve-order="True">
<test name="Item Entry -- Quantity Required -- Basic" annotations="JDK">
<parameter name = "filepath" value = "C:\Java Projects\Gravity\config\US\" />
<classes>
<class name="tests.itementry.quantityrequired.BasicPath"/>
</classes>
</test>
<test name = "Item Entry -- Quantity Required -- Cancel">
<classes>
<class name = "tests.itementry.quantityrequired.Cancel" />
</classes>
</test>
</suite>
我之前尝试指定包而不是类,但这导致测试并行运行(同时打开多个浏览器)。我知道另一种选择是将测试组合到一个类中(这可能是最好的设计选择???),但我认为最好让每个场景都有自己的类。
关于如何配置我的 testng.xml 文件或将测试场景转换为 testng 测试的任何建议都会很棒。