1

I am using QAF framework BDD2 for regression automation. I know how to setup setup() and teardown() webdriver in testNG but I am not sure do we have capability to set up the same QAF BDD2 setup() and teardown(). Kindly help with some examples.

I will provide a usecase which helps to understand exactly I am looking for:

  1. whenever I wanted to run the test suite, I want to create a custom downloads folder in c:/users/XXX. Where this folder contains all my test downloads.
  2. At setup() I want to implement createCustomFolder() method to create the custom folder before the test suite begins
  3. At the end of all tests in test suite. I want to implement teardown() methods where it contains delete files() deletes the files inside the custom folder and delete custom folder() delete the folder.
user861594
  • 5,733
  • 3
  • 29
  • 45
Satish A
  • 83
  • 6
  • Share the code sample, you are talking about. With qaf you don't need webdriver setup/teardown code even when using testng – user861594 Feb 13 '22 at 16:57
  • Hi, I do not have sample code created yet however I have edited my original post and added usecase so that you can understand the scenario i am looking for? – Satish A Feb 15 '22 at 03:04

1 Answers1

1

You can take benefit of testng listener and qaf listeners. For example, in above use case, implement testng suite listener and do the needful in before and after suite methods:

public class MySuiteListener implements ISuiteListener{

   public void onStart(ISuite suite) {
     //create directory
   }

   public void onFinish(ISuite suite){
     //delete directory
   }

}

You can register TestNG listener thorough configuration file

<suite name="MYAPP Tests">
  <listeners>
    <listener class-name="com.example.MySuiteListener" />
  </listeners>

  <test name="QAF-BDD-Test">
     <classes>
        <class name="com.qmetry.qaf.automation.step.client.text.BDDTestFactory2" />
     </classes>
</test>
user861594
  • 5,733
  • 3
  • 29
  • 45