java多行字符串在有理函数测试中表现奇怪
我只是想知道为什么它会这样。
在IBM RFT 6.x版本中集成了eclipse IDE。 我运行以下几行以从另一个程序获取文本输出。
String Text = "";
String Text_Value = "";
Text = (String) outputText().getProperty(".value");
Text_Value = (String) outputText().getProperty(".value");
outputText().getProperty(".value") 捕获的原始输出是
2011-09-27 19:11:05.996 [Process ID:0x00000000] show cpup sc11
************************************************************
CPU0 Usage : 3.2%
CPU1 Usage : 6.29%
Smooth CPU Usage : 4.65%
Real CPU Usage : 4.65%
------------------------------------------------------------
CPU Usage Sample Rate : 2(s)
CPU OverLoad Level[1] : 10%
CPU OverLoad Level[2] : 20%
CPU OverLoad Level[3] : 90%
CPU OverLoad Level[4] : 95%
CPU Peak Usage : 99.88%
CPU Peak Usage Time : 2008-10-31 20:12:54
------------------------------------------------------------
The History Real CPU Usage :
No %CPU %CPU %CPU %CPU %CPU %CPU %CPU %CPU
0 3.87 4.76 4.72 4.76 4.76 4.69 4.65 4.65
1 4.69 4.65
************************************************************
,这里发生了奇怪的事情。 我得到了字符串变量
Text = "\r\n2011-09-27 19:11:05.996 [Process ID:0x00000000] show cpup sc11"
,
Text_Value = "\r\n2011-09-27 19:11:05.996 [Process ID:0x00000000] show cpup sc11\r\n************************************************************\r\n.....4.69 4.65
\r\n************************************************************"
Text_Value 正是我想要的,但文本总是在“show cpup sc11”中被截断。
预计双线也会做同样的事情。
当我尝试程序的其他输出时。这不会发生。这两个变量是相同的。
I just wonder why it act this way.
In IBM RFT 6.x version integrated with a eclipse IDE .
I run the follow lines to get a text output from another program.
String Text = "";
String Text_Value = "";
Text = (String) outputText().getProperty(".value");
Text_Value = (String) outputText().getProperty(".value");
the original output captured by outputText().getProperty(".value") is
2011-09-27 19:11:05.996 [Process ID:0x00000000] show cpup sc11
************************************************************
CPU0 Usage : 3.2%
CPU1 Usage : 6.29%
Smooth CPU Usage : 4.65%
Real CPU Usage : 4.65%
------------------------------------------------------------
CPU Usage Sample Rate : 2(s)
CPU OverLoad Level[1] : 10%
CPU OverLoad Level[2] : 20%
CPU OverLoad Level[3] : 90%
CPU OverLoad Level[4] : 95%
CPU Peak Usage : 99.88%
CPU Peak Usage Time : 2008-10-31 20:12:54
------------------------------------------------------------
The History Real CPU Usage :
No %CPU %CPU %CPU %CPU %CPU %CPU %CPU %CPU
0 3.87 4.76 4.72 4.76 4.76 4.69 4.65 4.65
1 4.69 4.65
************************************************************
and the strange thing happens here.
I got the string variable
Text = "\r\n2011-09-27 19:11:05.996 [Process ID:0x00000000] show cpup sc11"
and
Text_Value = "\r\n2011-09-27 19:11:05.996 [Process ID:0x00000000] show cpup sc11\r\n************************************************************\r\n.....4.69 4.65
\r\n************************************************************"
The Text_Value is exactly what I want but the Text is always be cut off here in "show cpup sc11".
the twoline is expected to do the same thing.
when i try other output of the program.This would not happen.The two variable is same.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
应该是同步问题。由于控件未完全填充,您的
Text
被切断。执行Text_Value
行时,outputText() 对象已完全填充,因此Text_Value
不会被截断。您可以通过在Text
行之前插入sleep(10)
命令来证明这一点。将值 10 更改为足以使 outputText() 控件完全填充的任意秒数。It's probably a synchronization issue. Your
Text
is cut off because the control is not quite populated. By the timeText_Value
line is executed, the outputText() object is populated fully, soText_Value
is not truncated. You could prove this by inserting asleep(10)
command prior to theText
line. Change the value 10 to whatever arbitrary number of seconds is long enough for the outputText() control to have been fully populated.