You can mark arbitrary parts of script code as test cases. Such “test cases” will be included in the Summary report as a separate entry. You can also send the results of such “test cases” to an external test management system (for instance, Zephyr for Jira).
aqTestCase.Begin method sets the starting point for the code fragment you want to mark as a test case.
To set the ending point, use the
|aqTestCaseObj||An expression, variable or parameter that specifies a reference to an aqTestCase object|
|ExternalTestCase||[in]||Optional||String||Default value: Empty string|
The method is applied to the following object:
The method has the following parameters:
Specifies the name under which the code fragment will be added to the Summary report.
Note: The test engine does not check whether test cases with the same name already exist in your project suite. You can have multiple test cases with the same name.
Specifies the name of the external test (for example, a Zephyr test case) to which you want to bind the results of the specified code fragment.
To bind test results to a Zephyr test case, specify the needed test case as follows:
Your project must be bound to a Jira project and the specified Zephyr case must exist in it. To learn more about TestComplete integration with Zephyr for Jira and about binding TestComplete projects to Jira projects, see Integration With Zephyr for Jira.
If the specified external test does not exist, an error will be posted to the TestComplete test log.
aqTestCase.End methods do not allow creating nested test cases. The
End method call must alway follow the
Begin method call.
If you call the
aqTestCase.Begin method without calling an accompanying
aqTestCase.End method, TestComplete will treat all the executed code (from the
aqTestCase.Begin method call to the end of the run) as a single test case.
However, in this case, TestComplete will not send test results to an external test management system (if it is specified by the
aqTestCase.Begin method’s ExternalTestCase parameter).
aqTestCase.End methods do not necessarily need to belong to the same routine. They can belong to different routines as long as the proper call order is kept: the routine that calls the
aqTestCase.Begin method must run before the routine that calls the
To make sure that the ending point is always set properly in your test cases, we recommend that you use the Begin and End methods along with handling exception statements.
You can use the methods in data-driven tests to isolate individual iterations through a data source.
The following sample code marks a part of the
Main routine as the Create an order test:
def main(): page = Aliases.browser.page panel = page.Aspnetform.panel panel.Username.SetText("Tester") panel.Password.SetText("test") panel.submitbutton.Click() page.Wait() # Sets the beginning of the "Create an order" test aqTestCase.Begin("Create an order"); try: page.Aspnetform.table.cell1.linkOrder.Click() page.Wait() cell = page.Aspnetform.table.cell.panelContent.tableorder.cell cell.selectProduct.ClickItem("ScreenSaver") #... cell.panel.linkProcess.Click() page.Wait() page.Aspnetform.table.cell1.linkViewAllOrders.Click() page.Wait() except Exception as e: #... finally: # Sets the end of the "Create order" test aqTestCase.End() table = page.Aspnetform.table.cell.panelContent.panel.table table.Cell(1, table.ColumnCount - 1).ImageButton(0).Click() page.Wait() #... Aliases.browser.Close()