Creating behavior-driven tests

To create a behavior-driven test, you first create the test assembly configuration and then the behavior test scenario, before running the behavior test scenario

About this task

Procedure

Create Test Assembly Configuration

  1. Configure the assembly that you want to use for the tests by pressing the Create Assembly Configuration button.
    This opens up a new screen
  2. Select the assembly you want to use, and provide a name and description.
    The assembly might, for example, include the Network Service or VNF that you want to test, or you have already created a VNF or Network Service assembly that includes the required test resources such as a probe or a traffic generator. Once you select the assembly descriptor, the properties for that are loading within the same popup window that can be changed and used for that Test Assembly configuration.

Create test scenario

  1. Click Create Scenario and enter a name and description.

    Once you have defined all Assembly Configurations that can be used in the tests that you are developing, you can click on Create Scenario. This is where you define the actual test cases and conditions that should be run. You provide a name and a scenario description. All saved scenarios will show up in the Scenario screen in a list from where you can edit or remove them.

    Once created, you are then presented with the scenario designer.

  2. Design the test scenario.

    On the right-hand side you have your palette of steps you can chose to include in your scenario. For example you first chose the test assembly configuration you created before by simply drag-and-drop to the middle canvas. You can then decide what state you want the test assembly in when you start the scenario, and what to do once the scenario is run. After you have selected the assembly configuration, you then need to design the stages for the scenario by drag-and-drop a step from the right-hand side onto the stage. You can define multiple stages, and one stage can include multiple steps.

  3. Extend the scenario.

    The behaviour driven test tools also include inbuilt metrics visualization when the scenario is run. For example if you want to test a scale out and look at the various metrics it is producing while performing the scale test scenario, you can create the scenario so that it instantiates the Assembly, then defines the metrics it should monitor for, then start recording those metrics. You can continue the design by then introducing or changing a resource to produce more test traffic, and then define that you expect to see a scale-out. Then once that is completed you design the steps in the opposite order so that it stops recording the metrics and removes the test assembly.

Run test scenario

  1. Once you have completed the scenario design, you can proceed to save it and then run the scenario.

    Once you run the scenario, you will see the ongoing scenario screen. On the right-hand side you will see metrics (if any). In the middle you see the stages and steps as it is executing these and you will see if these fail or pass. it will continue to move through the tests until the final step is passed.

    • While the test scenario is ongoing, you can go to Recent Assembly Instances screen in the Operations view, to see the Intent Execution graph to see all the tasks the Intent Engine is performing to automatically bring the assembly configurations through its lifecycle.

    Once the scenario is run, you can see these in the Results page in the Behaviour Driven test functionality.

  2. From the Results page, you can open all executed test scenarios or delete them.

Using Behavior Driven Testing in your CI/CD process

  1. The test scenarios can be run manually but can also be run automatically.
    As part of a CI/CD pipeline, it can be setup so that the pipeline triggers building the software after a change has been committed, packages and onboards the VNF or Network Service to the appropriate IBM® Telco Network Cloud Manager - Orchestration, and then executes the test scenario.