Bulk actions are a common extension point within Enterprise Tester, exposed as features of the grid (normally a button, or selection field and button combination).
Bulk actions can be invoked asynchronously by issuing a POST request to the backgroundtasks collection resource, with the configuration information including the command being invoked passed in the Parameters collection, as show in the example below:
If we pull apart the above request we can see that we are:
- Invoking the command “BulkCopy”.
- Invoking the command scenario “BulkCopyScriptsScenario” – many commands have more then one associated scenario, and you must use the scenario applicable to your source and target package type, and the type of items you have selected.
- For move and copy operations there needs to be a target and source package (targetPackageId and sourcePackageId) – the source package is used as the “Root” of the bulk copy/move operation so that retain structure can calculate what folders are required.
- In the above example, our targetType and targetId is the same as the targetPackage.
- The selected items to copy “selections” – each selection features an Id and a Type (any type which is supported in TQL as a valid EntityType alias will work here i.e. Script and TestScript will both be treated as a TestScript entity type).
- “retainStructure” – which is a parameter specific to bulk/copy move to retain the packages related to the sourcePackage when copying to the targetPackage.
- Bulk Assign (AssignBulkActionScenario)
- Bulk Copy (BulkCopyAssignmentsScenario, BulkCopyRequirementsScenario, BulkCopyScriptsScenario)
- Bulk Create Assignments (BulkCreateScriptAssignmentsScenario)
- Bulk Create Scripts (BulkCreateScriptsScenario)
- Bulk Create Scripts From Agile Runs (BulkCreateScriptsFromAgileRunsScenario)
- Bulk Delete (BulkDelete)
- Bulk Move (BulkMoveAssignmentsScenario, BulkMoveRequirementsScenario, BulkMoveScriptsScenario)
- Export (CSV)
- Traceability (CSV)
- Update Script Statuses (UpdateScriptStatusBulkActionScenario)
CSV Export command
The CSV Export command is an example of an action which has a payload (an exported file) which you can download after completing the action – first, here is an example of a CSV export task being created:
As a result of creating this task, the response will indicate where the task updates can be fetched from via GET using the “Self” URL:
When the task has completed, fetching the task will include in it’s response details of the where you can then download the exported file from (indicated in the “exportedfile” link).