Research Article

Synthesis of Test Scenarios Using UML Sequence Diagrams

Procedure 5

Function GenerateTestScenario.
Input:   𝐼 𝑇 𝑀 , an intermediate testable model of a given scenario
  graph with initial node, 𝑖 𝑛 .
Output:   𝑇 , a collection of test scenarios forming the test suite.
Data:   𝐡 , a set of base paths which is initially empty
   𝑃 𝑗 : a set of internal paths corresponding to a composite node,
   𝐢 𝑗 .
1: Generate base path, 𝑑 𝑏 from ITM
2:  𝐡 = 𝐡 βˆͺ 𝑑 𝑏      //  Add 𝑑 𝑏 to the set of base paths
3:  while 𝐡 β‰  𝑒 π‘š 𝑝 𝑑 𝑦   do
4:   for path 𝑑 𝑖 ∈ 𝐡   do
5:   Let 𝑑 𝑖 = ⟨ 𝑛 0 , 𝑛 𝑖 1 , 𝑛 𝑖 2 , … , 𝑛 𝑖 𝑝 , … 𝑛 𝑖 π‘ž ⟩ be a sequence
     of adjacent nodes in 𝑑 𝑖
6:   for all   𝑛 𝑖 𝑗 ∈ 𝑑 𝑖   do
7:    if 𝑛 𝑖 𝑗 is not a composite node then
8:      𝑇 = 𝑇 βˆͺ 𝑑 𝑖    // 𝑑 𝑖 is fully expanded and it
       is added to the test suite 𝑇
9:     Remove 𝑑 𝑖 from 𝐡
10:    else
11:      for composite node 𝑛 𝑖 𝑗 ∈ 𝑑 𝑖   do
12:       Get internal paths corresponding to the node 𝑛 𝑖 𝑗
13:       Let 𝑃 𝑗 = { 𝑝 1 , … , 𝑝 π‘š } denote π‘š internal paths
        corresponding to the composite node 𝑛 𝑖 𝑗
14:        for 𝑝 𝑖 ∈ 𝑃 𝑗   do
15:        Replace the node 𝑛 𝑖 𝑗 in 𝑑 𝑖 with the internal path
          𝑝 𝑖 and let the expanded form of 𝑑 𝑖 be 𝑑 ξ…ž 𝑖
16:         𝐡 = 𝐡 βˆͺ 𝑑 ξ…ž 𝑖     // Add 𝑑 ξ…ž 𝑖 to 𝐡
17:        end for
18:      end for
19:     end if
20:    end for
21:   end for
22:  end while
Algorithmβ€”Test scenario generation from ITM