Resolves checkstyle errors for remaining p (#1091)
* Reduces checkstyle errors in page-object * Reduces checkstyle errors in partial-response * Reduces checkstyle errors in pipeline * Reduces checkstyle errors in poison-pill * Reduces checkstyle errors in priority-queue * Reduces checkstyle errors in private-class-data * Reduces checkstyle errors in property * Reduces checkstyle errors in prototype * Reduces checkstyle errors in proxy
This commit is contained in:
committed by
Ilkka Seppälä
parent
1fdc650545
commit
271d7ae9bd
@ -26,63 +26,60 @@ package com.iluwatar.pageobject;
|
||||
import java.awt.Desktop;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Page Object pattern wraps an UI component with an application specific API allowing you to
|
||||
* manipulate the UI elements without having to dig around with the underlying UI technology used. This is
|
||||
* especially useful for testing as it means your tests will be less brittle. Your tests can concentrate on
|
||||
* the actual test cases where as the manipulation of the UI can be left to the internals of the page object
|
||||
* itself.
|
||||
* manipulate the UI elements without having to dig around with the underlying UI technology used.
|
||||
* This is especially useful for testing as it means your tests will be less brittle. Your tests can
|
||||
* concentrate on the actual test cases where as the manipulation of the UI can be left to the
|
||||
* internals of the page object itself.
|
||||
*
|
||||
* <p>
|
||||
* Due to this reason, it has become very popular within the test automation community.
|
||||
* In particular, it is very common in that the page object is used to represent the html pages of a
|
||||
* web application that is under test. This web application is referred to as AUT (Application Under Test).
|
||||
* A web browser automation tool/framework like Selenium for instance, is then used to drive the automating
|
||||
* of the browser navigation and user actions journeys through this web application. Your test class would
|
||||
* therefore only be responsible for particular test cases and page object would be used by the test class
|
||||
* for UI manipulation required for the tests.
|
||||
* <p>Due to this reason, it has become very popular within the test automation community. In
|
||||
* particular, it is very common in that the page object is used to represent the html pages of a
|
||||
* web application that is under test. This web application is referred to as AUT (Application Under
|
||||
* Test). A web browser automation tool/framework like Selenium for instance, is then used to drive
|
||||
* the automating of the browser navigation and user actions journeys through this web application.
|
||||
* Your test class would therefore only be responsible for particular test cases and page object
|
||||
* would be used by the test class for UI manipulation required for the tests.
|
||||
*
|
||||
* <p>
|
||||
* In this implementation rather than using Selenium, the HtmlUnit library is used as a replacement to
|
||||
* represent the specific html elements and to drive the browser. The purpose of this example is just to
|
||||
* provide a simple version that showcase the intentions of this pattern and how this pattern is used
|
||||
* in order to understand it.
|
||||
* <p>In this implementation rather than using Selenium, the HtmlUnit library is used as a
|
||||
* replacement to represent the specific html elements and to drive the browser. The purpose of this
|
||||
* example is just to provide a simple version that showcase the intentions of this pattern and how
|
||||
* this pattern is used in order to understand it.
|
||||
*/
|
||||
public final class App {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
|
||||
|
||||
private App() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Application entry point
|
||||
*
|
||||
* <p>
|
||||
* The application under development is a web application. Normally you would probably have a
|
||||
* backend that is probably implemented in an object-oriented language (e.g. Java) that serves
|
||||
* the frontend which comprises of a series of HTML, CSS, JS etc...
|
||||
* <p>The application under development is a web application. Normally you would probably have a
|
||||
* backend that is probably implemented in an object-oriented language (e.g. Java) that serves the
|
||||
* frontend which comprises of a series of HTML, CSS, JS etc...
|
||||
*
|
||||
* <p>
|
||||
* For illustrations purposes only, a very simple static html app is used here. This main method
|
||||
* just fires up this simple web app in a default browser.
|
||||
* <p>For illustrations purposes only, a very simple static html app is used here. This main
|
||||
* method just fires up this simple web app in a default browser.
|
||||
*
|
||||
* @param args arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
|
||||
try {
|
||||
File applicationFile = new File(App.class.getClassLoader().getResource("sample-ui/login.html").getPath());
|
||||
File applicationFile =
|
||||
new File(App.class.getClassLoader().getResource("sample-ui/login.html").getPath());
|
||||
|
||||
// should work for unix like OS (mac, unix etc...)
|
||||
if (Desktop.isDesktopSupported()) {
|
||||
Desktop.getDesktop().open(applicationFile);
|
||||
|
||||
} else {
|
||||
// java Desktop not supported - above unlikely to work for Windows so try following instead...
|
||||
// java Desktop not supported - above unlikely to work for Windows so try instead...
|
||||
Runtime.getRuntime().exec("cmd.exe start " + applicationFile);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user