A replenishment Job is a Job that adds records to a Data Pool and maintains the records already in it. The Job runs ACCELQ Scenarios on a schedule or on demand, and those Scenarios use the Test Data Pool commands to count, add, update and delete records.
A single-use pool needs a replenishment Job because every test that fetches a record makes that record unavailable to other tests. A reusable pool can use one to keep reference data, such as rate plans, matching the application after an Environment is refreshed.
A replenishment Job has three parts:
- Replenishment logic: Scenarios that obtain new data and write it to the pool with the Test Data Pool commands.
- A template Job: a Job in the project that owns the pool, which runs those Scenarios.
- The pool setting: the template Job is selected as the pool's replenishment Job, together with a schedule.
[Image: Prepaid SIMs pool page with the Replenishment Job card showing the Job ID and name, its schedule and the next run]
How a Replenishment Job Works
Tests change the records of a single-use pool from Ready to Used, and the replenishment Job adds new Ready records. The Job can also update or delete the Used records.
The replenishment Job follows four rules:
- One replenishment Job per pool: a replenishment Job is optional, and a pool can have only one. It can be changed or removed at any time.
- A template Job in the owning project: the replenishment Job is always a template Job of the project that owns the pool. Every run of that template Job, whether scheduled or started manually, is a run of the replenishment Job.
- Shared pools are replenished by their owner: a project that a pool is shared with can fetch records in its tests. It cannot set up a replenishment Job for the pool, and its runs cannot add, update or delete the pool's records through commands.
- Commands change the pool only in this Job: the commands that add, update and delete records work only in a run of the pool's replenishment Job.
Setting Up the Replenishment Job
The replenishment Job is set on the pool's own page, in the Replenishment Job card above the records. Until a Job is set, the card shows None set, and records are added to the pool only by users, for example with Import from Excel.
The template Job has to exist before the setup. Create it in the project that owns the pool, and add the Scenarios or the Test Suite that hold the replenishment logic. For the steps to create a template Job, see Template Jobs.
- Open the pool from the Data Pools list.
- In the Replenishment Job card, start the setup. The Set up replenishment job dialog opens.
- In Template job, select the template Job that runs the replenishment Scenarios.
- Under Runs, select when the Job starts.
- Select Save.
[Image: Set up replenishment job dialog with the Template job list, the Runs options Daily, Weekly and On demand, and the Time field]
Template Job: What the Job Runs
The Template job list shows the template Jobs of the current project. The Environment, Variant and other run settings come from the template Job itself, so the replenishment Job runs exactly as that template Job is defined.
Runs: When the Job Starts
| Option | The Job starts | Also set |
| Daily | Every day at the selected time | Time |
| Weekly | Once a week, on the selected day and time | On (day of the week) and Time |
| On demand | Only when a user starts it from the pool page | Nothing |
The time is in the local time of the user who sets it. Select a time that falls before the test runs that use the pool, for example 2:00 AM for tests that run every morning.
After the Job is saved, the card shows the Job's ID and name, its schedule and the time of the next run.
Keep in mind: Setting up, changing or removing a replenishment Job requires a role with the Manage Data Pools privilege. Roles and privileges are described in User Roles and Access Control (RBAC).
Running and Monitoring the Job
The Replenishment Job card on the pool page shows the current state of the Job and holds the actions for it.
- Schedule: a scheduled Job shows when it runs and the time of the next run, for example "Every day at 2:00 AM". An on-demand Job shows that it runs only when started manually.
- Run in progress: the card shows a Running status and when the run started. View progress opens the run.
- Last run: after a run ends, the card shows its date, time and result. View report opens the report of that run.
[Image: Replenishment Job card during a run, with the Running status, View progress, and the menu showing Run now, Change job, or schedule, and Remove job]
Run now: Start a Run Immediately
Run now starts a run without waiting for the schedule. It is available for scheduled and on-demand Jobs. Use it after an Environment refresh, or when tests report that no record is available.
Change job, or schedule: Select a Different Job or Timing
Change job, or schedule opens the Change replenishment job dialog, which has the same fields as the setup dialog. Select a different template Job, a different Runs option, or a different day and time, and save.
Remove job: Stop Replenishing the Pool
Remove job removes the replenishment Job from the pool, and the card returns to None set. The records in the pool are not changed.
[Image: Replenishment Job card of an on-demand Job, with the last run date, the Succeeded result, View report and the Run now button]
Building the Replenishment Logic
The Scenarios in the template Job are regular ACCELQ Scenarios. Their logic obtains new data from the application or its back end, and then uses four Test Data Pool commands to work with the pool. Each command identifies the pool by its ID, as shown in the Data Pools list.
The Prepaid SIMs pool is replenished by a Job named "Load unassigned SIMs from Inventory DB". Its Scenario works in these steps:
- Count the Ready records with Data Class 5G-Ready SIM for the QAT Environment.
- When the count is below the target of 50, query the inventory database for the missing number of SIMs that are not assigned to a customer.
- Add those SIMs to the pool as new records.
- Delete the Used records that are no longer needed.
[Image: Logic Editor showing the replenishment Action with a Get count statement, a condition on the count, a database query and an Add records statement]
Get Count: The Number of Records in a Status
Get count of Ready records in Data Pool [Prepaid SIMs ID] with Data Class 5G-Ready SIM, for given Environment and Variant: QAT
The command returns the number of records in the selected status: Ready, Allocated, Used or Inactive. With Ready, the result is the number of records available to fetch. Leave the Data Class blank to count records of every Data Class.
The record scope sets the Environment and Variant the count is for:
- Current Environment and Variant: the ones the run is executing in. This is the default.
- Given Environment and Variant: the ones named in the statement. Either one can be left blank, but not both.
- All Environments and Variants: every record, whatever it is valid for.
A count for an Environment includes the records marked for that Environment and the records marked Any, because a test running in that Environment can fetch both.
Add Records: New Records in Ready Status
Add records newSims to Data Pool [Prepaid SIMs ID]
The records are given as JSON: one object for one record, or an array of objects for several records. Each record holds the pool's column names with their values, and up to three reserved keys.
| Key | Rule |
| Data Class | Required in every record. |
| Environment | Optional. One or more Environment names separated by commas. A missing or blank key means the record is valid for Any. |
| Variant | Optional. Follows the same rule as Environment. |
[
{"Data Class": "5G-Ready SIM", "Environment": "QAT", "MSISDN": "206-555-0142", "ICCID": "8901260411825507331", "PUK Code": "48213975", "SIM Type": "5G"},
{"Data Class": "eSIM Profile", "MSISDN": "303-555-0417", "ICCID": "8901260422408812645", "PUK Code": "90317264", "SIM Type": "eSIM"}
]
The first record is valid only for QAT. The second has no Environment key, so it is valid for Any.
- Records built from variables: when the values come from variables, such as the result of a database query, enter the records argument as an Expression that combines the JSON text with those variables.
- Encrypted columns: give the plain value, as for PUK Code in the example. The pool encrypts the value when it stores the record.
- Records that cannot be added: each record is checked separately. Valid records are added, and every record that is rejected is listed in the report with its position in the JSON and the reason. The step is reported as a warning when some records are rejected, and as a failure when no record is added.
- Result: the command returns the number of records added.
[Image: Records argument of an Add records statement entered as an Expression that combines the JSON text with the variables read from the inventory database]
Update Records: One Change to the Matching Records
Update Used records in Data Pool [Prepaid SIMs ID] with Data Class 5G-Ready SIM, for given Environment and Variant: QAT. Column match: none. Change: status to Ready
The command changes every record that matches its filters and returns the number of records updated. Each statement makes one kind of change.
| Change | New value | Example use |
| status | Ready, Used or Inactive | Set Used records back to Ready after the QAT database is restored |
| Data Class | A Data Class name | Move records to a renamed Data Class |
| Environment | One or more Environment names separated by commas, or Any | Correct the Environments a record is valid for |
| Variant | One or more Variant names separated by commas, or Any | Correct the Variants a record is valid for |
| column values | A JSON object of column names and new values | Change the fee of one rate plan |
A new Environment or Variant replaces the value the record had. Column values are changed only for the columns named in the JSON, and the other columns keep their values.
Reference data in a reusable pool is updated the same way. When the monthly fee of rate plan PO-80 changes in the application, this statement changes it in the Rate Plans pool:
Update all records in Data Pool [Rate Plans ID] with Data Class Postpaid, for all Environments and Variants. Column match: one column, Plan Code = PO-80. Change: column values: {"Monthly Fee": "85"}
Keep in mind: When records need new column values and a new status, change the column values first and set the status to Ready in a second statement. A test then cannot fetch a record whose data is only partly updated.
Delete Records: Permanent Removal of the Matching Records
Delete Used records from Data Pool [Prepaid SIMs ID] with Data Class 5G-Ready SIM, for all Environments and Variants. Column match: none
The command permanently removes every record that matches its filters and returns the number of records deleted. When the statement names an Environment or a Variant, a record that is also valid for other Environments or Variants is kept and only loses the named ones. Used records remain in a single-use pool as a history of what tests consumed, so delete them only when that history is no longer needed.
A delete for one Environment is the way to clear records after that Environment is refreshed. When the QAT database is restored, the SIMs that tests had not used yet no longer exist in QAT, and this statement removes them from the pool:
Delete Ready records from Data Pool [Prepaid SIMs ID] with Data Class 5G-Ready SIM, for given Environment and Variant: QAT. Column match: none
Selecting Records for Update and Delete
The Update records and Delete records commands act on every record that passes four filters: status, Data Class, record scope and column match. The filters apply together, and neither command takes a record ID.
Status: The Status the Records Have Now
The status filter is Used, Ready, Inactive or all. The value all covers Ready, Used and Inactive. Allocated records are held by a running test, so they are never updated or deleted.
Data Class: One Kind of Record or Every Kind
The Data Class filter limits the command to records of one Data Class. Leave it blank to include every Data Class.
Record Scope: All Records or One Environment and Variant
The record scope is either all Environments and Variants, which is the default, or a given Environment and Variant. With a given scope, Update and Delete follow one principle: a change made for one Environment does not affect what another Environment uses. The two commands apply that principle differently.
| A record valid for | Get count for QAT | Update for QAT | Delete for QAT |
| QAT | Counted | Updated | Deleted |
| QAT and UAT | Counted | Not changed | Kept, and QAT is removed from it |
| Any | Counted | Not changed | Not changed |
| UAT | Not counted | Not changed | Not changed |
Update matches exactly. A status or a column value belongs to the whole record, so a record shared with UAT cannot be updated for QAT only. To update shared records, name exactly what they are valid for, such as QAT, UAT.
Delete removes the given scope from each record. A record that is valid for nothing else is deleted. A record that is also valid for another Environment or Variant stays in the pool and no longer lists the given one.
When a statement gives both an Environment and a Variant, a record can be left unchanged. The table shows the result for one record that is valid for QAT and UAT, with the Variants Retail and Enterprise.
| Delete for | Result for this record |
| QAT | QAT is removed. The record stays valid for UAT. |
| QAT with Retail and Enterprise | QAT is removed. The record stays valid for UAT. |
| QAT with Retail | Not changed |
| QAT and UAT | The record is deleted. |
A delete for QAT with Retail cannot be applied to this record. The record would have to stay valid for QAT with Enterprise, and for UAT with both Variants, and one record cannot describe that combination. The report states how many records were left unchanged for this reason, and the step is reported as a warning.
These rules apply to both commands:
- Several names: give Environment or Variant names separated by commas.
- Records marked Any: they are not tied to one Environment or Variant, so a statement for a named Environment leaves them unchanged. Give the word Any to update or delete them.
- No filter on one of the two: leave the Environment or the Variant blank. At least one of them has to be given.
- Variables and Run Properties: both arguments accept them, so one statement can serve several Environments.
Keep in mind: Update and Delete have no current Environment and Variant option. The statement always names the Environment and Variant it changes, or covers all of them.
Column Match: Records with Specific Column Values
A column match limits the command to records whose columns hold the given values. It is the way to reach one record by its key, such as the rate plan with Plan Code PO-80.
- None: no column is checked. This is the default.
- One column: give the column and the value it must equal, such as Plan Code = PO-80.
- Multiple columns: give a JSON object of column names and values, such as {"SIM Type": "eSIM", "Rate Plan": "Prepaid 20"}. A record has to match all of them.
An encrypted column cannot be used in a column match. Data Class, Environment and Variant are not columns and have their own filters.
Where the Commands Run
The Add records, Update records and Delete records commands work only in a run of the pool's replenishment Job. This covers scheduled runs and runs started with Run now.
In every other run the statement fails with an error, the pool is not changed, and the logic continues. This applies to:
- Playback of the Action or Scenario
- A Scenario run that is started on its own
- Any other Job, including a Job in a project the pool is shared with
The Get count command has no such restriction. It works in any run, including in tests.
Keep in mind: Playback cannot add, update or delete records, so the replenishment logic has to be verified in a run of the replenishment Job. Set the Job to On demand, start it with Run now, and open View report to check the result.
Practical Tips
- Count before adding: read the Ready count and add only the number of records needed to reach the target. The pool then does not grow with every run.
- Build with On demand, then schedule: keep the Job on On demand while the logic is being built. Change it to Daily or Weekly once the report shows the expected records.
- Schedule ahead of the test runs: select a time early enough for the run to finish before the tests that use the pool start.
- Make environment-specific records valid for one Environment: a SIM provisioned in QAT belongs to QAT only. An update for QAT then reaches those records, and a delete for QAT removes them from the pool.
For how tests fetch and use pool records, see Data Pool Commands: Fetch and Use Records in Test Logic. For pool types, statuses, Data Classes and Record Scope, see ACCELQ Data Pool overview and concepts.
Comments
0 comments
Please sign in to leave a comment.