0

我只是想知道为什么它会这样。

在 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”中被截断。

预计两条线会做同样的事情。

当我尝试程序的其他输出时。这不会发生。这两个变量是相同的。

4

1 回答 1

0

应该是同步问题。你Text被切断了,因为控件没有完全填充。到执行时间Text_Value线时, outputText() 对象已完全填充,因此Text_Value不会被截断。sleep(10)您可以通过在该行之前插入一个命令来证明这一点Text。将值 10 更改为足以使 outputText() 控件完全填充的任意秒数。

于 2011-09-29T18:41:17.007 回答