Automated Testing - Group home

What’s new in IBM Distribution for Galasa 1.0.2

  
Alongside IBM Z Virtual Test Platform (ZVTP) V2, we include the IBM Distribution for Galasa 1.0.0, a redistribution package of the open source Galasa integration test framework. Licensed ZVTP users can access full IBM support for the IBM Distribution for Galasa. The combination of ZVTP and Galasa allows you to automate both your pre and post deployment testing across any z/OS application. In the latest version, we have made some major improvements that increase the synergy between these two capabilities.

What’s new in IBM Distribution for Galasa 1.0.2


IBM Distribution for Galasa 1.0.2 includes new CICS managers which allow you to interact with a target CICS region as part of a test. This new capability allows you to define, install and alter resource definitions through the CICS Execute Master Terminal (CEMT) and CICS Execute Definition and Administration (CEDA) manager, and execute CICS API calls through the Command-level Interpreter (CECI) Manager. We have also released the VTP Manager which allows you to automate the recording of a VTP test within a Galasa test, empowering the two capabilities to work together.

New CICS Managers


Some Galasa users have already been using Galasa to query the status of CICS resources as part of an infrastructure test. These tests have been using the 3270 Manager to interact with the CICS transactions to obtain the status of different CICS resources. Such code was often used in multiple places of the test, making maintenance difficult and required the test automation engineer to manually understand the state of each transaction screen and handle edge cases. The new CICS managers hide all of this complexity and make accessing CICS resources easy and reliable. For example:

CicstsHashMap resource = cics.cemt().inquireResource(terminal, “PROGRAM”, “PRG1");
assertThat(resource.isParameterEquals(“status”, “Enabled”)).isTrue();

Will inquire on all the resource attributes of the program resource PRG1 and then validate that the program is enabled.
This manager is also useful if you want to test error cases within your test. A simple example would be to test the error the user receives when PRG1 is disabled. Of course, to test this you will need to set the program to be in the disabled state:

cics.cemt().setResource(terminal, “PROGRAM”, PRG1, “DISABLED”);

This tighter integration with CICS allows your test code to be more robust, more powerful and allows you to write a wider range of tests than before.

New VTP Manager


The biggest change for VTP customers will be the new VTP manager that allows a Galasa automation test to transparently trigger VTP recording for each of the test methods. This means that as Galasa runs your post-deployment testing, new VTP recordings can be automatically constructed and then used by future runs of your pre-deployment build and test pipeline. Let’s see how this works.Here is a snippet of a test that tests a CICS application by running a 3270 transaction:

@Test
public class AppIVT {

 @CicsRegion

 public ICicsRegion cics;

 @CicsTerminal

 public ICicsTerminal terminal;  

@Test

  public void testStartup() throws Exception{
   terminal.type(“TSQT”).enter().wfk();
   assertThat(terminal.retrieveScreen()).containsOnlyOnce(“TSQT Test Transaction”);
   terminal.pf3().wfk().clear();
  }
 }

This very basic test performs the following steps:
  • Enters the transaction `TSQT` onto a CICS terminal
  • Checks that the transaction started by asserting that the phrase `TSQT Test Transaction` appears on the screen
  • Exits the transaction by pressing PF3 and clears the screen
As it stands this is a very simple test that might form part of an Installation Verification Test (IVT) for a CICS-based application. However even in this simple test a thread of execution through one or many user programs might be run. Recording this test with VTP would allow that same IVT to be executed against newly-compiled user code without needing to install inside of CICS. Let’s look at how to invoke the new VTP manager to record this test as it is executed by Galasa.

Recording a test with the VTP Manager


The great news is that no changes to the Galsas test is necessary to enable this test to be recorded by the new VTP Manager. Just add the following properties to your Configuration Property Store (CPS):

vtp.recording.enable=true
vtp.cics.PRIMARY.transactions=TSQT
vtp.playback.hlq=CTS.YATESW.VTP

These three properties do the following:
  1. Enable VTP recording for all tests run as part of this Galasa ecosystem
  2. Only turn on recording for the transaction TSQT
  3. Write the playback files to a HLQ called `CTS.YATESW.VTP` - this will be extended at runtime to include the run ID and a unique recording number

When the test is run, you will see the following information added to the run log:

INFO d.g.v.m.i.VtpManagerImpl - Starting VTP Recording
...
INFO d.g.v.m.i.VtpManagerImpl - Stopping VTP Recording
...
INFO d.g.v.m.i.VtpManagerImpl - Writing VTP Recording
...
INFO d.g.v.m.i.VtpManagerImpl - Exporting VTP Recording

These messages show the VTP manager being invoked as part of the test lifecycle to automatically turn the recording on and off. Within the Results Archive Store, you will also see the following artifact under the `VTP` header:

Method: testStartup exported as: CTS.YATESW.VTP.L882.R1

This dataset will contain the VTP recording that can now be played back as part of your pre-deployment testing with VTP.  
But wait! - How did the VTP Manager know which CICS region to log onto to perform the recording? This is one of really useful parts of Galasa. In this test the CICS Manager is being used to contextually bind this test to a CICS region, therefore it knows all the CICS regions that are being used by this test. The VTP Manager uses the Manager to Manager SPI to inquire of the CICS manager the list of CICS regions used in this test and for a terminal to be provisioned for each of them. This means that the same configuration for the CICS regions is shared by the VTP manager.

What types of testing does this mean I can record?


Since we are recording everything that happens within the target CICS region, you can record any type of test that ends up running a CICS transaction. This includes non-terminal started transactions such as web services or API requests. Within the same test you can be driving a web UI, controlling WebSphere MQ messages or calling REST APIs. As long as these actions drive transactions in CICS, they will be recorded. Such tests mimic real user scenarios, recording them in VTP creates build-time automated tests that do not need the full middleware stack but retain the same real world validity as the full automated test.

Future Thoughts


Currently the VTP Manager can only record interactions with a CICS region, however we are always looking for ways to further integrate Galasa with VTP. If you would like to express your views, please head over to galasa.dev to get involved.