Convert JMeter Test Result to TestMan

Q

How to Convert JMeter Test Result to TestMan Data Model?

✍: FYIcenter.com

A

In order migrate JMeter test result to TestMan, we need to decide how to convert JMeter test result data to TestMan tables and fields.

One way to map JMeter test result to TestMan is described below:

  • 1. For each unique value of Test_Run_Case_Step.trid, create a record in Test_Run table.
  • 2. For each unique value of Test_Run_Case_Step.tcid within the same jmeter_test_result.trid, create a record in Test_Run_Case table.
  • 3. Each JMeter test result record represents a record in the Test_Run_Case_Step table.
  • 4. "Duration", "Total", and "Failed" in Test_Run and Test_Run_Case tables can be calculated from Test_Run_Case_Step table.

Here is the SQL script ConvertJMeterData.sql to convert the JMeter Test Result to TestMan tables:

-- ConvertJMeterData.sql

use TestMan; 

insert into Test_Run (
   Reference,     -- jmeter_test_result.trid
   TimeStamp      -- jmeter_test_result.timestamp
) select 
   trid,
   min(from_unixtime(timestamp/1000))
from jmeter_test_result 
group by trid;

insert into Test_Run_Case (
   Test_Run_ID,   
   Reference,     -- jmeter_test_result.tcid
   TimeStamp,     -- jmeter_test_result.timestamp
   Target,        -- jmeter_test_result.target
   Station,       -- jmeter_test_result.station 
   Tester,        -- jmeter_test_result.tester
   Name,          -- jmeter_test_result.tcname
   Component,     -- jmeter_test_result.component 
   Function,      -- jmeter_test_result.function
   Total
) select 
   r.ID,
   j.tcid,
   min(from_unixtime(j.timestamp/1000)),
   min(j.target), 
   min(j.station),
   min(j.tester),
   min(j.tcname),
   min(j.component),
   min(j.function),
   count(*)
from jmeter_test_result j, Test_Run r
where j.trid = r.reference
group by r.ID, j.tcid;

insert into Test_Run_Case_Step (
   Test_Run_Case_ID, 
   Timestamp,  -- jmeter_test_result.timestamp
   Duration,   -- jmeter_test_result.elapsed  
   Name,       -- jmeter_test_result.label    
   Success,    -- jmeter_test_result.success  
   Output      -- jmeter_test_result.output   
) select 
   c.ID,
   from_unixtime(j.timestamp/1000),  
   j.elapsed,    
   j.label,      
   if(j.success='true', 1, 0),
   j.output      
from jmeter_test_result j, Test_Run r, Test_Run_Case c
where j.trid = r.Reference
   and r.ID = c.Test_Run_ID
   and j.tcid = c.Reference;

See the next tutorial on how to update Test_Run and Test_Run_Case tables from Test_Run_Case_Step table.

 

Implementing TestMan in MySQL

⇒⇒Test Management Tutorials

2017-12-13, 285👍, 0💬