How to load data from a excel sheet into 3 tables at a time

jenny32
Tera Guru

Hi,

I am new to Import Set and I wanted to load data into 3 tables from a excel sheet. The relationship between these tables is mentioned below

First table 'Test suite' has one-many relationship with second table 'Test Case' and the second table 'Test case' has one-many relationship with third table 'Test'. Here the second table 'Test Case' has a field 'test suite' which is referenced to the first table and third table 'Test' has 'test case' field which is referenced to second table.

I used import set to import the data's and created 3 transform maps.
I have written "onAfter" transform script in the second transform map where the target table is 'Test Case'.

This is my code:

answer=target.sys_id;

I have written "onBefore" transform script in the third transform map where the target table is 'Test'.

This is my code:

target.tm_test_case=answer;

Below image is a Test Suite record which contains 2 test case records.

find_real_file.png

Below image is first Test Case record which doesn't have 'Test' records listed down, which should have 2 test records as per requirement.

find_real_file.png

Below image is second Test Case record which have 'Test' records listed down.

find_real_file.png

Result should be:
I Test Suite record with 2 Test Case records and each Test case has 2 Test records to be loaded in appropriate tables.

But for me, the records are stored correctly in 'Test suite' and 'Test Case' tables

but the 'test' records are loaded only for the last 'Test Case' record. All the previous test case records doesn't contain any 'Test' records listed down in the related lists.

Can anyone please tell me what wrong i am doing here and how i can achieve this.

Chuck Tomasi Pradeep Sharma

Thanks,

Jenny

10 REPLIES 10

You would need to import these hierarchically (having the top level dependent suite done first, then test case, then test) with each referencing on each sheet. For example:



Sheet 1:


Suite 1


Suite 2


Suite 3



Sheet 2:


Case 1.1, Suite 1


Case 1.2, Suite 1


Case 2.1, Suite 2



Sheet 3:


Test 1.1.1, Case 1.1


Test 1.1.2, Case 1.1



and so forth.