This is my first time really writing an actual test, and the Automation
class is way awesome! Got it working within my app's code.Now I'm trying to
make it work with JUnit4
public class LoginTest extends Main implements Application { public
LoginTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension screenSize = toolkit.getScreenSize();
Locale.setDefault(new Locale("en", "PH"));
DesktopApplicationContext.main(LoginTest.class,
new String[]{"--width=" + ((int) screenSize.getWidth() -
250), "--height=" +
((int) screenSize.getHeight() - 240), "--center=true"});
}
@Test
public void testLogin() {
loginController.initPivotAutomationIDs();
PushButton pb = (PushButton) Automation.get("loginB");
TextInput usernameTi = (TextInput) Automation.get("usernameTI");
TextInput passwordTi = (TextInput) Automation.get("passowrdTI");
usernameTi.setText("user");
passwordTi.setText("user");
pb.press();
}
}
I get a NullPointerException for loginController, seems startup is not being
called, I initialize loginContoller in the startup method.
Oh well, I'll just extend LoginController and name it LoginControllerTest
and also implements Automatable and contain test codes.
I'm excited to make an ArrayList of Automatable then test everything!!! :D
Great morning everyone!
-
thirdy/vicente