question

sushma avatar image
sushma asked sushma posted

Storing summarize in a variable and iterating through each line

Hi,

 

I have stored summary of test results using summarize in a variable  - summary.  Here is what I get with summarize:

Completion Result: Pass
Test Case:         ut
Location:          project://myTestProject/test_cases/ut.fftc
Owner:             
Start Time:        Tue Feb 21 15:48:09 PST 2012
Duration:          00:00:03
Total Issues:      4
Report Id:         2953



Execution issues for this test case:
Sev. Proc. Step Message                                                                   
------------------------------------------------------------------------------------------------------------------------------------------------------
info main       Execution started                                                         
info main       Testbed used in execution: project://myTestProject/topologies/generic.tbml
pass main  2    Response contains "Usage: itestrt <options>"                              
pass main  3    Response does not contain " no iTest in"                                  

 

I would like to send this file to a remote linux server.  I do not want to use FTP/SSH.  I would like to iterate through summary and add each line to a file on that linux server using echo, since I have a session open.  But here each word separated by a space is considered as a line and is echoed.  

Is there any way I can inject a new line when storing as a variable using summarize ?  Or is there any other way tp do this ?  

I also tried storing summarize in a file, but then I need SSH or FTP to copy that over.  

 

Here's a snippet of what I am doing:

summarize

eval                            puts $summary

foreach                      summaryLine [response summary]

            command     session     echo $summaryLine >> /temp/result.txt

 

Thanks,

Sushma 

iTest
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
sushma avatar image
sushma answered sushma posted

Well I think, this should work.  But it's not. 

 

File ut2.txt doesnot contain anything after the execution.  I tried 3 options below:

1. Enabled command substitution and issued: echo "$summary" >> file.

2. Enabled command substitution and issued :echo  \$summary >> file.

3. Disabled cmd substitutionand issued: echo "$summary" >> file.

 

Am I missing anything here ?

 

Thanks,

Sushma

 

 


echo1.jpg (97.8 KiB)
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.