0

I'm trying to select a Gui testing framework tool for a swing based application. I started to have a look on FEST and created a Demo program to check how fast the run time is.

My demo program (code bellow) took about 85000 millisec to complete which appeared very slow to me.

So my question is this the normal speed of Fest ?

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);
    }
}
Houssem
  • 1
  • 1

1 Answers1

0

The fixture has a settings() function that returns the Settings object where the delay times are stored.

Change that times to a more fitted value:

public static void main(String[] args)
{
    main.settings().idleTimeout(2000);

It seems that FEST waits for the finish of all processing on the JVM before you can go to the next step of the test.

This setting is the timeout to try the next step without waiting for all the stuff to stop (in my case it never stops, and i dont know why). So FEST always fall into the timeout clause which by default is 10000ms (or 10s).

You have to figure out the values for each type of operation in the settings.

It will depends on your hardware and the amount of stuff your program computes.

Note: The main.settings() in my code refers to your final FrameFixture main, not the main method.