The Simplest Way to Make Spanner and Testcomplete Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

You link spanner and testcomplete by giving your test runner a scoped database role. This setup lets automated UI tests check backend state right after every user action. Teams use Google Cloud Spanner to store mission data across many regions at once. They use TestComplete to run automated checks on desktop, web, and mobile apps. When both tools work together, a test script clicks a button and checks the database. This flow proves that the front end and the database agree on every single chang

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You link spanner and testcomplete by giving your test runner a scoped database role. This setup lets automated UI tests check backend state right after every user action.

Teams use Google Cloud Spanner to store mission data across many regions at once. They use TestComplete to run automated checks on desktop, web, and mobile apps. When both tools work together, a test script clicks a button and checks the database. This flow proves that the front end and the database agree on every single change. Without this direct check, broken writes can hide behind a green UI test screen.

How data and roles flow between spanner and testcomplete

A test run starts when the test runner launches your target app on a machine. The test script performs an action, such as submitting an order form in the browser. Next, the test runner opens a database session to check the stored record.

To log in, the test machine needs a Google Cloud identity with database permissions. You should set up a dedicated service identity just for your automated test suites. That identity uses a custom role that can only read from specific test tables.

Data flows from the cloud database back to the local test runner over encrypted channels. The test script reads the returned rows and compares them against expected test values. If the database row matches the input, the test step passes and moves forward. If the row is missing or wrong, the runner marks the test as failed.

Common failure modes and how to fix them

Many teams share one static service key across every test machine and developer laptop. When a key leaks or expires, every automated build breaks at the same time. Static keys also make it hard to see which person or job ran a query.

Another common risk comes from giving the test runner full admin rights on the database. A bug in a cleanup script can wipe out shared tables used by other teams. Broad roles also let test scripts read sensitive customer rows if someone points to production.

Unlogged queries create blind spots during security reviews and bug hunts. If five test runners share one login, the database log shows one generic user name. You cannot tie a slow query or a bad write back to a specific test run.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You can fix these issues by scoping roles and network paths between both systems. First, split your test roles into read roles for checks and write roles for setup. Give most test suites the read role so they cannot change records by mistake.

Second, replace static key files on test machines with short-lived identity tokens from your pipeline. When a build starts, the runner requests a fresh token that dies after the run.

Third, keep test data clean and safe by rewriting sensitive fields when queries run. Data masking rewrites matched fields like emails, phone numbers, card numbers, or national IDs in results. This step keeps real private strings out of test logs and screenshots on runner disks.

Setting up safe network paths for test runners

Your test machines often sit inside private build networks or on local engineer laptops. Your cloud database sits inside a protected cloud network with strict firewall rules. Opening the database to the public internet just for test runners invites huge security risks.

Instead, route all test traffic through a single controlled network path with strict identity checks. Every session should check who starts the test and which build job runs the script. This setup gives your security team a full log of every query and result count. Your engineers get fast feedback on database state without managing local keys or firewall rules.

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

Should TestComplete scripts write data directly to Spanner during a test?

Keep most test scripts read-only so they only check app results. Use separate setup scripts with scoped write roles to seed test rows before runs start.

How do we stop test logs from storing real customer emails or card numbers?

Use an isolated test database filled with fake records whenever you can. You can also apply data masking to rewrite emails and card numbers in query results.

How can we tell which test run caused a spike in database load?

Give each pipeline job its own identity instead of sharing one static account. You can also pass the build number in session tags to track every single query.

The query runs. The emails stay hidden.