Forum Discussion

JackSparrow's avatar
JackSparrow
Frequent Contributor
8 years ago

Driver Script with Python

Hi All,

 

  • Am new to Test-Complete and I like to develop a driver script just like the driver script which normally use in UFT.
  • Excel having the Test Cases and Status of Execution Either Pass or Failed for each test case .
  • At the end of execution creating the HTML reports.

 

So can you please suggest or give an examples with using python and is there any builtin functions of test-complete which will help in building the Driver script using python.

 

2 Replies

  • baxatob's avatar
    baxatob
    Community Hero

    You can create the driver class and implement there any required functionality:

     

     

    class Driver:
          def __init__(self):
              # Implement all preconditions here. E.g. setup test environment.
              
          def __del__(self):
              # Implement all post-conditions here. E.g. stopping services.
              
          def testing(self, testSuite):
              # Drive your tests here         

    def generate_report(self):
    # ...

    ...

    And then run it: 

     

     

    testSuite = ["Test_1", "Test_2", "Test_3"]

    def main(): driver = Driver() driver.testing(testSuite)
    driver.generate_report()

     

     

    • JackSparrow's avatar
      JackSparrow
      Frequent Contributor

      Thanks

       

      Now can I write the class Driver in one script1[TestComplete] and other New script2 having the test suit and the main.