In previous chapters, we’ve coded features for the version of the Execute Catalog Package Task built in this second edition of the book. It’s now time to test the Execute Catalog Package Task.
Manually Testing Use Cases
Test frameworks that automate redundancies in test generation, execution, and reporting exist. If your job is developing software all day every day, you either know about test frameworks or you will. You will occasionally encounter a testing requirement for which your chosen test framework is either incapable or “clunky.” In that case, you will need to build a manual test.
All good testing is a series of scenarios, expected answers or results (assertions), and measurement of the actual results. The combination of a scenario and assertion is referred to as a use case. A single use case may contain several assertions. When we perform testing, we work through each use case, measure results, and record the measurements.
I have a maxim: “All software is tested. Some intentionally.” I occasionally post this maxim in social media, as shown in Figure 21-1:
Software testing is meticulous and demanding work. We test some, not all, use cases in this chapter. If we tested all use cases, this chapter would be 150 pages, and my editor would (rightly) point out that this is a chapter, not a test plan.
Use Cases
In this section, we explore the following use cases for the Execute Catalog Package Task:
1.
Task existence
2.
Task validation
3.
Task Editor – General
The first few use cases involve visual inspection – simply checking to see if the Execute Catalog Package Task appears in the SSIS Toolbox and, if so, selecting the Execute Catalog Package Task in the SSIS Toolbox and verifying the toolbox description.
The tests are documented using a manual testing documentation format. The author has seen similar manual testing documentation presented in an Excel spreadsheet and prefers Word documentation for manual test documentation.
Testing Task Existence
Scenario: Build the ExecuteCatalogPackageTask solution, open a test SSIS project, and then open a test SSIS package. The Execute Catalog Package Task should appear in the SSIS Toolbox, as shown in Figure 21-2:
Assertion: The Execute Catalog Package Task appears in the SSIS Toolbox.
Measurement: True.
Assertion: When the Execute Catalog Package Task is selected in the SSIS Toolbox, the Execute Catalog Package Task description appears in the Information portion of the SSIS Toolbox.
Measurement: True.
Testing Task Validation
Scenario: Drag an Execute Catalog Package Task to the Control Flow canvas of a test SSIS package. Examine the Error List dialog, as shown in Figure 21-3:
Assertion: An Execute Catalog Package Task may be added to the Control Flow canvas of a test SSIS package.
Assertion: The validation errors raised by a newly added Execute Catalog Package Task are
Source Connection property is not properly configured.
SQL Server Instance Connection attempt failed.
Measurement: True.
Assertion: The earlier validation errors raised by a newly added Execute Catalog Package Task trigger an SSIS validation error:
There were errors during the task validation.
Measurement: True.
Testing the Task Editor
In the following test sections, we exercise the Execute Catalog Package Task Editor. Appearance and function are tested.
Scenario: Open the Execute Catalog Package Task Editor, as shown in Figure 21-4:
Sometimes the solution build succeeds, and one (or more than one) value is misaligned between the ExecuteCatalogPackageTask and ExecuteCatalogPackageTaskComplexUI classes. When such misalignment occurs, the editor will not display. Instead, an error will display.
Assertion: The Execute Catalog Package Task Editor opens without error.
Measurement: True, the Execute Catalog Package Task Editor opens without error.
Assertion: The Execute Catalog Package Task Editor surfaces three Views:
1.
General
2.
Settings
3.
Expressions
Measurement: True.
Assertion: The General View displays when the Execute Catalog Package Task Editor first opens.
Measurement: True.
Assertion: The General View displays the Execute Catalog Package Task Name and Description properties, and the property values are editable.
Measurement: True.
Scenario: Click the Settings view, as shown in Figure 21-5:
Assertion: The Settings View displays without error when Settings is selected.
Measurement: True.
Assertion: When Settings is selected, the Settings View displays the following categories and properties:
Connections
SourceConnection
SSIS Catalog Package Properties
Folder
Project
Package
SSIS Package Execution Properties
Use32bit
LoggingLevel
SSIS Package Synchronized Properties
Synchronized
MaximumRetries
RetryIntervalSeconds
OperationTimeoutMinutes
Measurement: True
Scenario: Click the SourceConnection property dropdown, as shown in Figure 21-6:
Assertion: The SourceConnection dropdown list displays all available ADO.Net connection managers without error.
Measurement: True.
Scenario: Configure the SourceConnection property value from the SourceConnection property dropdown, as shown in Figure 21-7:
Scenario: Close the Execute Catalog Package Task Editor, as shown in Figure 21-8:
Assertion: The validation errors raised by the Execute Catalog Package Task as currently configured are
There were errors during the task validation.
Folder property is not properly configured.
Value cannot be null.
Measurement: True.
Scenario: Open the Execute Catalog Package Task and navigate to the Settings view. Click the Folder property dropdown, as shown in Figure 21-9:
Assertion: The Folder dropdown list displays all available folders in the SSIS Catalog configured in the SourceConnection property without error. To verify, close the Execute Catalog Package Task Editor, and edit the SSIS package connection manager selected in the SourceConnection property, as shown in Figure 21-10:
Use SQL Server Management Studio (SSMS) to connect to the SourceConnection SQL Server instance. Open SSMS Object Explorer and expand Integration Services Catalogs. Expand the SSISDB node and observe SSIS Catalog folders, as shown in Figure 21-11:
The SSIS Catalog folders shown in Figure 21-11 match the list of SSIS Catalog folders shown in Figure 21-9.
Measurement: True.
Scenario: Configure the Folder property value from the Folder property dropdown, as shown in Figure 21-12:
Scenario: Close the Execute Catalog Package Task Editor, as shown in Figure 21-13:
Assertion: The validation errors raised by the Execute Catalog Package Task as currently configured are
There were errors during the task validation.
Value cannot be null.
Project property is not properly configured.
Measurement: True.
Scenario: Open the Execute Catalog Package Task and navigate to the Settings view. Click the Project property dropdown, as shown in Figure 21-14:
Assertion: The Project dropdown list displays all available projects in the SSIS Catalog folder configured in the Folder property without error. To verify, use SQL Server Management Studio (SSMS) to connect to the SourceConnection SQL Server instance. Open SSMS Object Explorer and expand Integration Services Catalogs. Expand the SSISDB node, and then expand the SSIS Catalog folder configured in the Execute Catalog Package Task Folder property, as shown in Figure 21-15:
The SSIS Catalog projects shown in Figure 21-15 match the list of SSIS Catalog projects shown in Figure 21-14.
Measurement: True.
Scenario: Configure the Project property value from the Project property dropdown, as shown in Figure 21-16:
Scenario: Close the Execute Catalog Package Task Editor, as shown in Figure 21-17:
Assertion: The validation errors raised by the Execute Catalog Package Task as currently configured are
There were errors during the task validation.
Value cannot be null.
Package property is not properly configured.
Measurement: True.
Scenario: Open the Execute Catalog Package Task and navigate to the Settings view. Click the Package property dropdown, as shown in Figure 21-18:
Assertion: The Package dropdown list displays all available packages in the SSIS Catalog project configured in the Project property without error. To verify, use SQL Server Management Studio (SSMS) to connect to the SourceConnection SQL Server instance. Open SSMS Object Explorer and expand Integration Services Catalogs. Expand the SSISDB node, expand the SSIS Catalog folder configured in the Execute Catalog Package Task Folder property, and then expand the SSIS Catalog project configured in the Execute Catalog Package Task Project property, as shown in Figure 21-19:
The SSIS Catalog packages shown in Figure 21-19 match the list of SSIS Catalog projects shown in Figure 21-18.
Measurement: True.
Scenario: Close the Execute Catalog Package Task Editor and view the Execute Catalog Package Task on the SSIS test package Control Flow, as shown in Figure 21-20:
Assertion: No validation errors are raised by the Execute Catalog Package Task as currently configured.
Measurement: True.
Testing Execution
We shift gears at this point in the test process. While I dearly love manual software testing and documenting test results in “test-speak” for posterity, not everyone shares my passion. Starting here, we switch to prose.
Currently, the Execute Catalog Package Task is configured as shown in Figure 21-21:
The current configuration tests asynchronous SSIS package execution because the Synchronized property – which maps to the SSIS Catalog execution parameter – is set to false, which is the default.
Execute the test SSIS package. If all goes as planned, the test SSIS package with the Execute Catalog Package Task will succeed, as shown in Figure 21-22:
Observe the Progress/Execution Results tab to validate the instrumentation messages raised as events, as shown in Figure 21-23:
Test synchronous SSIS package execution by opening the Execute Catalog Package Task editor and updating the Synchronized property to True, as shown in Figure 21-24:
Click the OK button to close the Execute Catalog Package Task Editor, and execute the test SSIS package in the debugger. If all goes as planned, the test SSIS package with the Execute Catalog Package Task will succeed, as shown in Figure 21-25:
View the Progress/Execution Results tab to validate asynchronous execution event messages are present, as shown in Figure 21-26:
Configure the Execute Catalog Package Task to synchronously execute an SSIS package that fails, as shown in Figure 21-27:
As expected, the SSIS package and Execute Catalog Package Task fail, as shown in Figure 21-28:
Observe the Progress/Execution Results tab as shown in in Figure 21-29:
Configure the Execute Catalog Package Task to asynchronously execute the same SSIS package that fails, as shown in Figure 21-30:
As expected, the SSIS package and Execute Catalog Package Task succeed, as shown in Figure 21-31:
Verify the instrumentation messages found on the Progress/Execution Results tab are accurate for asynchronous execution, as shown in Figure 21-32:
Examine the SSIS Catalog All Executions Report.
Configure a longer-running (greater than 30 seconds) SSIS package built to succeed. Configure the SSIS package to execute synchronously, as shown in Figure 21-33:
If all goes according to plan, the SSIS package and Execute Catalog Package Task succeed, as shown in Figure 21-34:
Observe the Progress/Execution Results to verify the instrumentation messages accurately reflect the progress of the execution, as shown in Figure 21-35:
Configure a longer-running (greater than 30 seconds) SSIS package built to fail. Configure the SSIS package to execute synchronously, as shown in Figure 21-36:
If all goes according to plan, the SSIS package and Execute Catalog Package Task fail, as shown in Figure 21-37:
Verify the instrumentation messages found on the Progress/Execution Results tab are accurate for synchronous execution, as shown in Figure 21-38:
Configure the Execute Catalog Package Task to asynchronously execute the same SSIS package that fails, as shown in Figure 21-39:
As expected, the SSIS package and Execute Catalog Package Task succeed, as shown in Figure 21-40:
Test timeout functionality by configuring a long-running SSIS package built to succeed. Set the Synchronized property to True, and then configure the MaximumRetries and RetryIntervalSeconds properties so that the SSIS package execution MaximumRetries value is reached before the SSIS package execution completes, as shown in Figure 21-41:
If all goes according to plan, the SSIS package and Execute Catalog Package Task fail, as shown in Figure 21-42:
Examine the Progress/Execution Results tab to verify the correct event message – the event message indicating the SSIS package execution was canceled – displays, as shown in Figure 21-43:
The next step is to verify that the SSIS package execution was canceled in the SSIS Catalog. Open SSMS and connect to the SQL Server instance that hosts the SSIS Catalog. Open the All Executions report to view the status of the SSIS package execution, as shown in Figure 21-44:
If all goes according to plan, the All Executions SSIS Catalog report in SSMS should indicate the SSIS package execution was canceled.
Conclusion
In this chapter, we applied one manual testing technique for testing validation and then tested the Execute Catalog Package Task execution functionality.
The next step is to build an installer file to ease propagation of the Execute Catalog Package Task in an enterprise.
Now would be an excellent time to check in your code.