A man pressing a button labeled "Automation"
| |

Seamlessly Integrating CenterTest with Your Test Manager

In our series of articles on CenterTest, we have explored its unique capabilities such as combined UI and API testing, Excel-based data-driven testing, and its ability to efficiently organize your tests. Today, we will dive into another remarkable feature of CenterTest – its ability to integrate seamlessly with any API-capable test manager; we’ll use TestRail for this article.

The Power of TestRail

TestRail is a comprehensive, web-based test management tool designed to efficiently manage, track, and organize software your test cases and their corresponding results. It offers unified reporting, historical data tracking, consistent metrics, traceability, improved collaboration, enhanced decision-making, easy access for non-technical stakeholders, increased efficiency, and timely notifications and alerts. But it will not run your tests. If only you could pair the power of CenterTest automation with the reporting capabilities of a test manager like TestRail. As it happens, you can!

TestRail provides several features that support test automation but CenterTest needs only two of these: Custom Fields and API Integration. As we dig into these, you’ll start to appreciate the power of using a test manager to save data while also providing test result monitoring for your organization. Let’s dig in.

Custom Fields

Custom Fields are just what they sound like, the ability to create or change fields for a specific purpose.  Because of the power and capabilities of CenterTest, it needs to retain specific data to properly run, manage, or restart tests. TestRail allows for Custom Fields for just this purpose. Let’s see a couple of examples:

CenterTest Keys are simply a list of key/value pairs in results to pass information to a tester or for restartability. For example, the Account Number and Policy Number are useful if a tester wants to review a document, or confirm the System Date for time travel testing. And knowing the Account or Policy number is critical when CenterTest is restarting a failed test.

AccountName=John Doe eyxPuxol7s
AccountNumber=7310242240
Address=898-800 Wilkins St, Bakersfield, CA 94404-0001
caseId=C205
Environment=local
InvoiceDate=08/07/2023
JobNumber=0061997973
PolicyEffectiveDate=08/07/2023
PolicyExpirationDate=02/07/2024
PolicyNumber=0412360847
PrimaryInsured=John Doe eyxPuxol7s
ProducerCode=100-002541 Armstrong (Premier)
ProducerCodeOfRecord=100-002541 Armstrong (Premier)
Product=Personal Auto
SystemDate=2023-08-07
TotalCost=683.00

CenterTest Issue simply provides a summary of the failure, usually the failure message. This can be displayed on the TestRail Dashboard letting you quickly determine the problem at a glance, and, more importantly, group errors together to easily prioritize failures or determine if a rerun or restart is in order, or if it’s time to change the system clock.

TestRail's user interface, showing a list of tests being run with listed AnkrPt issues

These two custom fields should begin to let you understand the power of custom fields. Whatever information you need, you can save it within your test manager. Next is how to get these into and out of CenterTest.

The API Layer

As stated earlier, TestRail does not run tests, but monitors the results of testing. CenterTest does this by communicating with the TestRail API integration giving it the ability to read, add, update, and monitor results within TestRail. The CenterTest TestManager abstraction layer plugs into any test manager with TestRail being just one. 

The Test Case

Every test definition in TestRail is known as a test case with a unique Test Case ID. CenterTest uses these Test Case IDs to connect runs to cases, either directly through an annotation or on a test row for data-driven testing.

@CenterTestCase(testCaseId = "C97")
public void run(ScenarioContext scenarioContext) {
  var context = scenarioContext.getInvocationContext("producer");
  var dataObject = new OotbData(scenarioContext.getTestData());
  PC.loginToPC(context).execute();
  PC.newPersonAccount(context).execute();
  PC.personalAutoSubmission(context, dataObject).execute();
}
A list of test cases from an AnkrPt test case file

Note: If the Test Case ID does not exist in TestRail, CenterTest can optionally create them in TestRail, letting you generate test cases when executing them for the first time.

The Test Result 

A quick mockup showing the flow of one test case to multiple test runs

Running tests is all about the results, and results are always associated with a test case. Each time a new test is run, a new test result is created and associated with its test case using the Test Case Id. This is done immediately upon starting a test to allow those monitoring results to see how many tests are active.

When a test completes, all relevant information about that test is saved including the results, pass/fail status, how long it took to run, and screens shots or recordings. CenterTest also adds additional information such as the endpoint URLs, the key/value pairings described above, detailed failure information, restartability information, and more. Anything and everything needed for later reference can be saved.

Running/rerunning vs Restarting

You may have noticed in the previous section the statement “a new test is run…”. That is because running/rerunning tests is different that restarting tests. What is the difference? 

Running/rerunning starts a test from the beginning as though it had never run before. This means everything is fresh and a new result is saved.

Restarting a test only occurs for tests that have failed; passed tests do not restart. Restarting starts a test from the point of failure by skipping steps that have been successfully completed based upon Restart Points. This means once an account, job, or policy has been created, that same account, job, or policy will be used when restarting, and all completed steps will be bypassed until you are at the point of failure, or as close to it as possible.  If you think back to the CenterTest Keys field earlier, you will notice that account, job, and policy were already created, so why create them again? If they already exist, just reuse them.

Steps to Integrate CenterTest with TestRail

Integrating CenterTest with TestRail via TestRail’s API is a straightforward process:

  1. API Access: Ensure you have API access enabled in your TestRail instance. This is typically found in TestRail’s Administration settings.
  2. Define Custom Fields: Your administrator creates the list of provided CenterTest fields.
  3. Configure CenterTest: In CenterTest, identify your TestRail instance’s URL and your API credentials to establish the connection between CenterTest and TestRail.
  4. Mapping Tests: In CenterTest, map each test to a corresponding test case in TestRail by providing the TestRail test case ID as a test annotation parameter in CenterTest.
  5. Test Execution & Result Update: When your CenterTest test runs, the results are automatically sent to the corresponding test case in TestRail. This includes test status along with any notes, messages, and other information produced from the test run.

Conclusion

The power of restartability, the ability to easily group failures to determine priority, identifying entities such as new accounts or policies, even identifying potential clock adjustments when needed; these capabilities need a way to store information for later retrieval. This can be done with databases, files, and test managers. Since test managers are capable of storing data in custom fields, why not take advantage of the added benefit of monitoring the test results at an organizational level? A clear win-win for test automation. 

The integration between CenterTest and TestRail provides a powerful solution for automating test case management. By removing the need for manual updates and ensuring timely and accurate reporting of test results, this integration boosts productivity, enhances test traceability, and improves the overall efficiency of the testing process. Whether you’re running UI tests, API tests, or data-driven tests in CenterTest, you can rest assured that your test management in TestRail will always be in sync.

Kim Filiatrault
Founder and President


Watch or read our other posts at Kimputing Blogs. You’ll find everything from Automated testing to CenterTest, Guidewire knowledge to general interest. We’re trying to help share our knowledge from decades of experience.

Similar Posts