0
我想爲基於swing的應用程序選擇Gui測試框架工具。 我開始看看FEST,並創建了一個Demo程序來檢查運行時間有多快。巨星運行速度
我的演示程序(代碼波紋管)花了大約85000毫秒來完成,這對我來說顯得非常慢。
所以我的問題是這個節日的正常速度?
public class DemoGui extends JFrame
{
private JPanel contentPane;
private JTextField textField;
private JPanel panel;
private JButton btnNewButton;
private JButton btnRun;
public static final int REPEAT = 10;
public static void runX(final JFrame window)
{
final FrameFixture main = new FrameFixture(window);
new Thread(new Runnable()
{
@Override
public void run()
{
final long start = System.currentTimeMillis();
for (int i = 0; i < REPEAT; i++)
{
main.textBox().deleteText().setText("this is a test demo");
main.button(JButtonMatcher.withText("OK")).click();
}
final long end = System.currentTimeMillis();
System.out.println("Exec Time : " + String.valueOf(end - start));
}
}).start();
}
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
try
{
DemoGui frame = new DemoGui();
frame.setVisible(true);
}
catch (Exception e)
{
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public DemoGui()
{
setTitle("DemoGui");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
textField = new JTextField();
contentPane.add(textField, BorderLayout.NORTH);
textField.setColumns(10);
panel = new JPanel();
contentPane.add(panel, BorderLayout.SOUTH);
btnRun = new JButton("run");
btnRun.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
runX(DemoGui.this);
}
});
panel.add(btnRun);
btnNewButton = new JButton("OK");
panel.add(btnNewButton);
}
}