So today, I tried UISpec4J. It is too early for me to comment on the overall quality of this library, but the first impression is quite good. However, their documentation fails to provide the reader with a quick, fully-working example (which is the single most important piece of information that the user of a library needs). The following fragment is my attempt to fill this gap: take it, compile it, run it.
The subject program:
import java.awt.event.*;
import javax.swing.*;
public class Win extends JFrame
{
private static final long
serialVersionUID = -9206602636016215477L;
public Win()
{
JPanel panel = new JPanel();
final JButton b = new JButton("A Button");
b.setVisible(false);
JButton t = new JButton("Toggle");
t.addActionListener(new ActionListener()
{
boolean show = false;
public void actionPerformed(ActionEvent e)
{
show = !show;
b.setVisible(show);
}
});
panel.add(t);
panel.add(b);
getContentPane().add(panel);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
...and the test program:
import org.junit.Test;
import org.uispec4j.*;
import org.uispec4j.assertion.UISpecAssert;
public class Win_Test
{
static
{
UISpec4J.init();
}
@Test
public void test1() throws Exception
{
Panel panel = new Panel(new Win());
Button b = panel.getButton("A Button");
Button t = panel.getButton("Toggle");
t.click();
UISpecAssert.assertTrue(b.isVisible());
t.click();
UISpecAssert.assertFalse(b.isVisible());
t.click();
UISpecAssert.assertTrue(b.isVisible());
}
}
Comments:
- The constructor of the tested widget (class Win) should not display the widget. This will make UISpec4J angry because it runs the tested window in some private, hidden, realm.
- The test program will need both the JUnit and the UISpec4J jars to compile
- The current version supports Java 5 but not Java 6.
Post is very useful. Thank you, this useful information.
Start your journey with In Software Training in Bangalore and get hands-on Experience with 100% Placement assistance from experts Trainers @eTechno Soft Solutions Located in BTM Layout Bangalore.
eTechno Soft Solutions
December 12, 2019 at 4:47 PMyour blog' s design is simple and clean and i like it. Your blog posts about Online writing Help are superb. Please keep them coming. Greets!
data science training in bangalore
data science training institute in bangalore
Prwatech
March 30, 2021 at 10:03 PMI think this is one of the best blog for me because this is really helpful for me. Thanks for sharing this valuable information
internship meaning | internship meaning in tamil | internship work from home | internship certificate format | internship for students | internship letter | Internship completion certificate | internship program | internship certificate online | internship graphic design
Lokeswari
November 16, 2021 at 12:38 PMDownload Tableau Desktop for Windows PC from FileHorse. 100% Safe and Secure ✓ Free Download (32-bit/64-bit) Latest Version 2022.Tableau Desktop Free Activation Key
tech2
October 27, 2022 at 10:36 AMBulk Image Downloader Crack is an application specifically developed to help you download Full Sized images from almost any web gallery or web forum.Bulk Image Downloader Twitter
haseeb
October 27, 2022 at 11:24 AM