Testcomplete Run Keyword Test from Script

Published
Length
3 min read

Luis Felipe Dias

All posts

To make TestComplete run keyword test from script files, call the keyword test object from your code. You pass test values into the object and start the run. Teams use this pattern to mix visual test steps with custom code logic. Still, test runners often run with broad permissions across staging and production systems. This wide reach creates risk when scripts read or change live data. How to make TestComplete run keyword test from script TestComplete stores visual keyword tests and code fil

Run Keyword Test: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

To make TestComplete run keyword test from script files, call the keyword test object from your code. You pass test values into the object and start the run. Teams use this pattern to mix visual test steps with custom code logic. Still, test runners often run with broad permissions across staging and production systems. This wide reach creates risk when scripts read or change live data.

How to make TestComplete run keyword test from script

TestComplete stores visual keyword tests and code files in the same project tree. Each keyword test acts as an object that your script can call. When the script runs, it finds the test by name and starts the steps. This setup lets engineers write loops or conditions in code while keeping simple UI steps in visual blocks.

Passing data between the two layers is a core part of the design. You define input variables on the keyword test before you call it. The script sends strings, numbers, or database rows into those variables at start time. When the visual steps finish, the script reads the result and moves to the next task. Teams also import external modules to share helper logic across many test projects.

This hybrid flow works well for complex apps. A script can query an API or database to set up test state. Next, the script starts the keyword test to click buttons and check forms on the screen. After the UI check ends, the script cleans up the test records. Everything runs inside one job on the build machine.

What native test setups solve and what they leave open

The native project structure solves code reuse across QA teams. Less technical testers can build visual flows for standard screens. Developers can wrap those flows in code to handle complex setup work or error recovery. You do not have to rewrite visual tests just to add a loop or a custom data check.

Yet this native setup leaves a major security gap open during test runs. Test scripts often need database credentials and API keys to prepare state and check results. Teams usually store these keys in project variables or build machine settings. Once the test runner logs in, the database role decides what the session can do.

Run Keyword Test: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Standard roles only check who logs in at the start of the session. They do not check what individual queries or commands do in flight. A flawed cleanup script can drop a shared table or change thousands of rows by mistake. If a test queries real user tables, unmasked emails, phone numbers, or card numbers flow right into the test logs. Build logs then store that sensitive data in plain text where anyone on the team can read it.

Managing credentials and data exposure in automated test runs

Securing automated tests requires tighter control over how test runners talk to backend systems. Instead of giving the test runner static keys with wide write rights, teams should limit every query. Test scripts should only run approved statements against test schemas. Destructive commands need a block or an approval step before they touch shared databases.

Data privacy is just as vital during test checks. When a script pulls records to feed a keyword test, data masking should rewrite sensitive fields in the results. Rewriting card numbers and national IDs in flight keeps real data out of test logs and screenshots. This step lets the UI test run with safe dummy strings while the backend stays protected.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Can a script pass variables into a keyword test?

Yes, you can define parameters on the keyword test inside your project. When the script calls the test object, it passes the needed values right into those inputs.

How do you get a result back from a keyword test?

A keyword test can set a return value or update a shared project variable before it ends. The calling script then reads that value on the next line of code to decide the next step.

Why do automated UI tests risk exposing sensitive data?

Test scripts often query shared databases to find real test accounts and verify app changes. Without field masking, those queries pull real emails or phone numbers into screen captures and build logs.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.