Result is wrong when merge or create property list

Hi there,
Can you please help me, how to merge or create property list using to single list values. I was trying to merge or create property list using 2 single lists (testdataheader and testdatavalue) but actual result is differed with expected. Can you please help me.

For example: You can also set multiple properties at once, by specifying a list of keys:
set joe’s (height, weight) to ("5ft. 9in.", 143)
Script:
Put (: ) into currenttestdata
put file ScenarioFile as a list into MyDataFilePath
put line 1 of mydatafilepath into TestdataHeader
put testdataheader

put line 2 of mydatafilepath into testdatavalue
put testdatavalue

set currenttestdata's (TestdataHeader) to (testdataheader)
put currenttestdata
Expected Result:
TC_ID: TC2, TestData2: TestData2,…
Actual Result:
("TC_ID, TestData2, TestData3, TestData4, TestData5, TestData6, TestData7, TestData8, TestData9, TestData10" : "TC2, TestData2, TestData3, , TestData5, , TestData7, , TestData9,")

Comments

  • JonathanOSXJonathanOSX ForumAdmin admin
    You are going to need to post your data files for us to determine what the issue could be. There doesn't seem to be a problem with your syntax.

    Also, you will want to make sure you are on the latest release of eggPlant. There have been some fixes to that syntax.
  • EggplantMattEggplantMatt ForumAdmin admin
    You generally can't read from a file and say "as a list" and get the list you expect. What that does is to make whatever is read from the file a single item in a list. If you want to be able to read a list from a file, it needs to be properly formatted and then you can apply the value() function to it to turn it back into a list. If you run this code:
    put the standardFormat of (make:"Lotus", model:"Elan", color:"Red") into file "~/Temp/garage.txt" 
    
    The file contents will be:
    {color:"Red", make:"Lotus", model:"Elan"}
    
    If you then use the value() function on the contents of the file:
    put value(file "~/Temp/garage.txt")
    
    You will get your original list back as a property list.

    The alternative is to iterate through the contents of the file, break apart the strings you read in, and manually recreate the list.
Sign In or Register to comment.