This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Page Objects | |
Within your web app's UI there are areas that your tests interact with. A Page Object simply models these as objects within the test code. This reduces the amount of duplicated code and means that if the UI changes, the fix need only be applied in one place. | |
Implementation Notes | |
PageObjects can be thought of as facing in two directions simultaneously. Facing towards the developer of a test, they represent the services offered by a particular page. Facing away from the developer, they should be the only thing that has a deep knowledge of the structure of the HTML of a page (or part of a page) It's simplest to think of the methods on a Page Object as offering the "services" that a page offers rather than exposing the details and mechanics of the page. As an example, think of the inbox of any web-based email system. Amongst the services that it offers are typically the ability to compose a new email, to choose to read a single email, and to list the subject lines of the emails in the inbox. How th |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[email protected] | 123456 | |
---|---|---|
[email protected] | 654321 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<jmeterTestPlan version="1.2" properties="2.9" jmeter="3.0 r1743807"> | |
<hashTree> | |
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true"> | |
<stringProp name="TestPlan.comments"></stringProp> | |
<boolProp name="TestPlan.functional_mode">false</boolProp> | |
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp> | |
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> | |
<collectionProp name="Arguments.arguments"> | |
<elementProp name="APP_URL" elementType="Argument"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) throws IOException { | |
// Setup firefox binary to start in Xvfb | |
String Xport = System.getProperty( | |
"lmportal.xvfb.id", ":1"); | |
final File firefoxPath = new File(System.getProperty( | |
"lmportal.deploy.firefox.path", "/usr/bin/firefox")); | |
FirefoxBinary firefoxBinary = new FirefoxBinary(firefoxPath); | |
firefoxBinary.setEnvironmentProperty("DISPLAY", Xport); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scenario "Searching restaurant in your Bangalore", { | |
given "the user is on the Google home page", { | |
end_user.is_the_google_home_page() | |
} | |
when "the end user types restaurant in search box", { | |
end_user.searches_for "restaurant" | |
} | |
then "they should location listing for 'BBQ Nation", { | |
end_user.should_see_search_result_page_with_word "BBQ Nation" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package core; | |
import java.util.concurrent.TimeUnit; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.firefox.FirefoxDriver; | |
import org.testng.ITestResult; | |
import org.testng.annotations.AfterMethod; | |
import org.testng.annotations.BeforeMethod; | |
import org.testng.annotations.Parameters; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package core; | |
import org.openqa.selenium.server.SeleniumServer; | |
import org.testng.annotations.AfterClass; | |
import org.testng.annotations.AfterSuite; | |
import org.testng.annotations.BeforeClass; | |
import org.testng.annotations.BeforeSuite; | |
import org.testng.annotations.Parameters; | |
import com.thoughtworks.selenium.DefaultSelenium; | |
import com.thoughtworks.selenium.Selenium; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LoginTest { | |
@Test | |
public void testLogin() { | |
login(userName, userPassword); | |
waitForCondition("selenium.isElementPresent(\""+UserDashboard.getDashboardLocator()+"\")", "60000"); | |
// Some assertion here | |
} | |
} | |
class UserDashboard { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Provides object ids or name for HTML object input | |
* | |
* @param inputType Could be checkbox, TextBox or Radio button | |
* @return objectId | |
* | |
*/ | |
public static String[] getInputObjects(String inputType) { | |
StringBuilder sb = new StringBuilder("var objectId = [];") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test(groups="non-grid", alwaysRun=true) | |
public void verifyTaggedBlogs() throws InterruptedException { | |
customVerification.verifyTrue(actualblogTag.equalsIgnoreCase(expectedBlogtag.trim()), "Expected Blogs with tag: " +expectedBlogtag+ | |
", While actual tag is: " +actualblogTag); | |
customVerification.verifyTrue(selenium.isElementPresent(getPageElement("BlogsHomePage", "NTad")), | |
customVerification.verifyTrue(selenium.isElementPresent(getPageElement("BlogsHomePag | |
customVerification.checkForVerificationErrors(); | |
} |
NewerOlder