是否可以使用TestNG实现以下设计模式?

时间:2022-02-10 21:06:31

I'm working in a test suite and I'm currently trying to implement the following design based on the following xml:

我正在测试套件中工作,我目前正在尝试基于以下xml实现以下设计:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="none">
    <parameter name="server" value="http://www.smartdate.com/"/>
      <test name="Test" preserve-order="false">
        <classes>
            <class name="testscripts.SetUp"/>
            <class name="testscripts.TestHome"/>
        </classes> 
  </test>
</suite>

In this short example I want the following:

在这个简短的例子中,我想要以下内容:

  1. Run SetUp configurations (this class only defines @BeforeSuite, @AfterSuite and may be other annotations like @BeforeClass, @AfterClass, no @Test methods here).
  2. 运行SetUp配置(此类仅定义@BeforeSuite,@ AfterSuite,可能是@BeforeClass,@ AfterClass,此处没有@Test方法等其他注释)。

  3. Run all the following classes, in this example just one, "TestHome" but maintaining the previous configurations.
  4. 运行以下所有类,在此示例中仅使用一个“TestHome”,但保留以前的配置。

Now the question is, is this possible?

现在的问题是,这可能吗?

Thank you in advance, Nahuel

纳谢尔提前谢谢你

1 个解决方案

#1


0  

Well, have you tried your proposed design at all? It should work. Try it and report back if something is not working as expected.

好吧,你有没有尝试过你提出的设计?它应该工作。尝试并报告一些事情是否按预期工作。

#1


0  

Well, have you tried your proposed design at all? It should work. Try it and report back if something is not working as expected.

好吧,你有没有尝试过你提出的设计?它应该工作。尝试并报告一些事情是否按预期工作。