Showing posts with label Per page SZ selenium 2 Framework - with maven. Show all posts
Showing posts with label Per page SZ selenium 2 Framework - with maven. Show all posts

Sunday

Selenium 2 - Per page SZ selenium 2 Framework - with maven

Structure of the project:

Step1:
Create the following project

uk.co.shopzilla.qa.regression and create various package in it.

1. Configuration
2. Data
3. Dsl
4. 4test
5. Util
6. Verifiers

Step 2:
In configuration create classes
1. Configuration
2. Enviorment
3. Page Identifier
4. Page Info
5. Site
6. SubdomainAndPath
7. TextIdentifier

C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\configuration\Configuration.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\configuration\ConfigurationTest.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\configuration\Environment.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\configuration\PageIdentifier.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\configuration\PageInfo.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\configuration\Site.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\configuration\SubdomainAndPath.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\configuration\TextIdentifier.java

Step3:
In data put classes:
1. Configurations
2. Footer
3. Pages
4. Texts
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\data\Configurations.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\data\Footers.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\data\Pages.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\data\Texts.java


Step 4:
In DSL give other classes for link , POD specific application
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\AbstractPositionedPod.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\BreadCrumbsPod.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\FooterBanner.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\FooterLink.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\FooterPod.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\Home_page.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\Home_page_Element.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\Home_page_pod.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\HotCategoryPod.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\Item.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\Link.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\Page.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\PageRequest.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\PageRequestImpl.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\PaginationLink.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\Position.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\PositionedPod.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\ProductListPod.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\RedirectLink.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\RelatedSearchesContractedPod.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\RelatedSearchesPod.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\ScorchingProductPod.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\SponsoredLinksPod.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\dsl\With.java

Step 5
IN Test give the test class
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\test\Cool7ZTest.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\test\Cool8CTest.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\test\Cool8ETest.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\test\Cool8ITest.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\test\CoolTest.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\test\CoolTest2.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\test\Freq.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\test\Home_SZTest.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\test\Hot10JTest.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\test\Hot7STest.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\test\Hot7TTest.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\test\HotTest.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\test\MapExample.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\test\ScorchingNonCatTest.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\test\ScorchingTest.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\test\SetExample.java
C:\eu-regression-test\src\test\java\uk\co\shopzilla\qa\regression\test\SpecificTests.java

Step 6:
In Verifiers provide all the verifiers functions
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\verifiers\BreadCrumbsPodVerifier.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\verifiers\FooterBannerVerifier.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\verifiers\FooterPodVerifier.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\verifiers\HomePageVerifier.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\verifiers\HotCategoryPodVerifier.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\verifiers\MatureWarningVerifier.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\verifiers\ProductListPodVerifier.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\verifiers\RelatedSearchesContractedPodVerifier.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\verifiers\RelatedSearchesVerifier.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\verifiers\ScorchingProductPodVerifier.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\verifiers\SponsoredLinksPodVerifier.java

Step7: In framework provide the path of all Drivers
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\framework\ChromeDriverFactory.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\framework\Driver.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\framework\FirefoxWebDriverFactory.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\framework\HtmlUnitDriverFactory.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\framework\InternetExplorerDriverFactory.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\framework\WebDriverFactory.java

Step 8: Util provide interface for Page
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\util\PageTest.java
C:\eu-regression-test\src\main\java\uk\co\shopzilla\qa\regression\util\RegressionTester.java

Step 9: Library
Webdriver 2
TestNG
Maven

Step 9 POM file
Step 9 POM file replace and !!!> to >
Step 9 POM file replace !!! To and !!! to

!!!?xml version="1.0" encoding="UTF-8"?!!!
!!!project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"!!!
!!!modelVersion!!!4.0.0!!!/modelVersion!!!
!!!groupId!!!uk.co.shopzilla.qa!!!/groupId!!!
!!!artifactId!!!eu-regression-test!!!/artifactId!!!
!!!packaging!!!jar!!!/packaging!!!
!!!version!!!1.0-SNAPSHOT!!!/version!!!
!!!prerequisites!!!
!!!maven!!!2.2!!!/maven!!!
!!!/prerequisites!!!
!!!name!!!EU Regression Tests!!!/name!!!

!!!parent!!!
!!!artifactId!!!root!!!/artifactId!!!
!!!groupId!!!com.shopzilla.common!!!/groupId!!!
!!!version!!!1.12!!!/version!!!
!!!/parent!!!

!!!properties!!!
!!!webdriver.version!!!0.9.7376!!!/webdriver.version!!!
!!!/properties!!!

!!!scm!!!
!!!developerConnection!!!scm:git:ssh://git@git.shopzilla.com/qa/eu-regression-test!!!/developerConnection!!!
!!!/scm!!!

!!!dependencies!!!
!!!dependency!!!
!!!groupId!!!org.seleniumhq.webdriver!!!/groupId!!!
!!!artifactId!!!webdriver-common!!!/artifactId!!!
!!!version!!!${webdriver.version}!!!/version!!!
!!!/dependency!!!
!!!dependency!!!
!!!groupId!!!org.seleniumhq.webdriver!!!/groupId!!!
!!!artifactId!!!webdriver-htmlunit!!!/artifactId!!!
!!!version!!!${webdriver.version}!!!/version!!!
!!!/dependency!!!
!!!dependency!!!
!!!groupId!!!org.seleniumhq.webdriver!!!/groupId!!!
!!!artifactId!!!webdriver-firefox!!!/artifactId!!!
!!!version!!!${webdriver.version}!!!/version!!!
!!!/dependency!!!
!!!dependency!!!
!!!groupId!!!org.seleniumhq.webdriver!!!/groupId!!!
!!!artifactId!!!webdriver-ie!!!/artifactId!!!
!!!version!!!${webdriver.version}!!!/version!!!
!!!/dependency!!!
!!!dependency!!!
!!!groupId!!!org.seleniumhq.webdriver!!!/groupId!!!
!!!artifactId!!!webdriver-chrome!!!/artifactId!!!
!!!version!!!${webdriver.version}!!!/version!!!
!!!/dependency!!!
!!!dependency!!!
!!!groupId!!!com.google.guava!!!/groupId!!!
!!!artifactId!!!guava!!!/artifactId!!!
!!!version!!!r08!!!/version!!!
!!!/dependency!!!
!!!dependency!!!
!!!groupId!!!log4j!!!/groupId!!!
!!!artifactId!!!log4j!!!/artifactId!!!
!!!version!!!1.2.15!!!/version!!!
!!!/dependency!!!
!!!dependency!!!
!!!groupId!!!org.testng!!!/groupId!!!
!!!artifactId!!!testng!!!/artifactId!!!
!!!version!!!5.12.1!!!/version!!!
!!!/dependency!!!
!!!dependency!!!
!!!groupId!!!org.mockito!!!/groupId!!!
!!!artifactId!!!mockito-all!!!/artifactId!!!
!!!version!!!1.8.5!!!/version!!!
!!!/dependency!!!
!!!/dependencies!!!


!!!build!!!
!!!defaultGoal!!!test!!!/defaultGoal!!!
!!!pluginManagement!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!version!!!2.5!!!/version!!!
!!!configuration!!!
!!!parallel!!!true!!!/parallel!!!
!!!threadCount!!!10!!!/threadCount!!!
!!!environmentVariables!!!
!!!host.override!!!${host.override}!!!/host.override!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/pluginManagement!!!
!!!/build!!!

!!!profiles!!!
!!!profile!!!
!!!id!!!env-dev!!!/id!!!
!!!activation!!!
!!!activeByDefault!!!true!!!/activeByDefault!!!
!!!property!!!
!!!name!!!env!!!/name!!!
!!!value!!!dev!!!/value!!!
!!!/property!!!
!!!/activation!!!
!!!/profile!!!

!!!!-- site-selection profiles --!!!
!!!profile!!!
!!!id!!!BR_GB!!!/id!!!
!!!build!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!configuration!!!
!!!environmentVariables!!!
!!!BR_GB!!!true!!!/BR_GB!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/build!!!
!!!/profile!!!
!!!profile!!!
!!!id!!!LW_GB!!!/id!!!
!!!build!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!configuration!!!
!!!environmentVariables!!!
!!!LW_GB!!!true!!!/LW_GB!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/build!!!
!!!/profile!!!
!!!profile!!!
!!!id!!!SZ_GB!!!/id!!!
!!!build!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!configuration!!!
!!!environmentVariables!!!
!!!SZ_GB!!!true!!!/SZ_GB!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/build!!!
!!!/profile!!!
!!!profile!!!
!!!id!!!PC_FR!!!/id!!!
!!!build!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!configuration!!!
!!!environmentVariables!!!
!!!PC_FR!!!true!!!/PC_FR!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/build!!!
!!!/profile!!!
!!!profile!!!
!!!id!!!SZ_FR!!!/id!!!
!!!build!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!configuration!!!
!!!environmentVariables!!!
!!!SZ_FR!!!true!!!/SZ_FR!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/build!!!
!!!/profile!!!
!!!profile!!!
!!!id!!!BR_DE!!!/id!!!
!!!build!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!configuration!!!
!!!environmentVariables!!!
!!!BR_DE!!!true!!!/BR_DE!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/build!!!
!!!/profile!!!
!!!profile!!!
!!!id!!!SG_DE!!!/id!!!
!!!build!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!configuration!!!
!!!environmentVariables!!!
!!!SG_DE!!!true!!!/SG_DE!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/build!!!
!!!/profile!!!
!!!profile!!!
!!!id!!!SZ_DE!!!/id!!!
!!!build!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!configuration!!!
!!!environmentVariables!!!
!!!SZ_DE!!!true!!!/SZ_DE!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/build!!!
!!!/profile!!!
!!!profile!!!
!!!id!!!all-sites!!!/id!!!
!!!build!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!configuration!!!
!!!environmentVariables!!!
!!!BR_GB!!!true!!!/BR_GB!!!
!!!SZ_GB!!!true!!!/SZ_GB!!!
!!!LW_GB!!!true!!!/LW_GB!!!
!!!SZ_FR!!!true!!!/SZ_FR!!!
!!!PC_FR!!!true!!!/PC_FR!!!
!!!BR_DE!!!true!!!/BR_DE!!!
!!!SG_DE!!!true!!!/SG_DE!!!
!!!SZ_DE!!!true!!!/SZ_DE!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/build!!!
!!!/profile!!!

!!!!-- environment selection profiles --!!!
!!!profile!!!
!!!id!!!stage!!!/id!!!
!!!build!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!configuration!!!
!!!environmentVariables!!!
!!!environment!!!STAGE!!!/environment!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/build!!!
!!!/profile!!!
!!!profile!!!
!!!id!!!production!!!/id!!!
!!!build!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!configuration!!!
!!!environmentVariables!!!
!!!environment!!!PRODUCTION!!!/environment!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/build!!!
!!!/profile!!!
!!!profile!!!
!!!id!!!master!!!/id!!!
!!!build!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!configuration!!!
!!!environmentVariables!!!
!!!environment!!!MASTER!!!/environment!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/build!!!
!!!/profile!!!
!!!profile!!!
!!!id!!!branch!!!/id!!!
!!!build!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!configuration!!!
!!!environmentVariables!!!
!!!environment!!!BRANCH!!!/environment!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/build!!!
!!!/profile!!!
!!!profile!!!
!!!id!!!localhost!!!/id!!!
!!!properties!!!
!!!host.override!!!http://localhost:8085!!!/host.override!!!
!!!/properties!!!
!!!/profile!!!

!!!!-- driver selection profiles --!!!
!!!profile!!!
!!!id!!!htmlUnit!!!/id!!!
!!!build!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!configuration!!!
!!!environmentVariables!!!
!!!HTMLUNIT!!!true!!!/HTMLUNIT!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/build!!!
!!!/profile!!!
!!!profile!!!
!!!id!!!firefox!!!/id!!!
!!!build!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!configuration!!!
!!!environmentVariables!!!
!!!FIREFOX!!!true!!!/FIREFOX!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/build!!!
!!!/profile!!!
!!!profile!!!
!!!id!!!ie!!!/id!!!
!!!build!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!configuration!!!
!!!environmentVariables!!!
!!!IE!!!true!!!/IE!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/build!!!
!!!/profile!!!
!!!profile!!!
!!!id!!!chrome!!!/id!!!
!!!build!!!
!!!plugins!!!
!!!plugin!!!
!!!artifactId!!!maven-surefire-plugin!!!/artifactId!!!
!!!configuration!!!
!!!environmentVariables!!!
!!!CHROME!!!true!!!/CHROME!!!
!!!/environmentVariables!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/build!!!
!!!/profile!!!



!!!/profiles!!!

!!!!--
For more information on publishing project documentation for a project, visit:
http://wiki.shopzilla.com/index.php?title=Open_Source
--!!!
!!!reporting!!!
!!!plugins!!!
!!!plugin!!!
!!!groupId!!!org.apache.maven.plugins!!!/groupId!!!
!!!artifactId!!!maven-project-info-reports-plugin!!!/artifactId!!!
!!!version!!!2.2!!!/version!!!
!!!inherited!!!true!!!/inherited!!!
!!!reportSets!!!
!!!reportSet!!!
!!!reports!!!
!!!report!!!index!!!/report!!!
!!!/reports!!!
!!!/reportSet!!!
!!!reportSet!!!
!!!id!!!sunlink!!!/id!!!
!!!reports!!!
!!!report!!!javadoc!!!/report!!!
!!!/reports!!!
!!!inherited!!!true!!!/inherited!!!
!!!configuration!!!
!!!links!!!
!!!link!!!http://java.sun.com/javase/6/docs/api/!!!/link!!!
!!!/links!!!
!!!/configuration!!!
!!!/reportSet!!!
!!!/reportSets!!!
!!!/plugin!!!
!!!plugin!!!
!!!artifactId!!!maven-checkstyle-plugin!!!/artifactId!!!
!!!version!!!2.5!!!/version!!!
!!!/plugin!!!
!!!plugin!!!
!!!artifactId!!!maven-docck-plugin!!!/artifactId!!!
!!!version!!!1.0!!!/version!!!
!!!/plugin!!!
!!!plugin!!!
!!!artifactId!!!maven-javadoc-plugin!!!/artifactId!!!
!!!version!!!2.7!!!/version!!!
!!!configuration!!!
!!!bottom!!!!!!![CDATA[Copyright © {inceptionYear}-{currentYear} Shopzilla.com. All Rights Reserved.]]!!!!!!/bottom!!!
!!!links!!!
!!!link!!!http://java.sun.com/javase/6/docs/api/!!!/link!!!
!!!/links!!!
!!!linksource!!!true!!!/linksource!!!
!!!quiet!!!true!!!/quiet!!!
!!!show!!!private!!!/show!!!
!!!sourcepath!!!${basedir}/src/main/java;${basedir}/src/test/java!!!/sourcepath!!!
!!!/configuration!!!
!!!/plugin!!!
!!!plugin!!!
!!!artifactId!!!maven-jxr-plugin!!!/artifactId!!!
!!!version!!!2.2!!!/version!!!
!!!/plugin!!!
!!!plugin!!!
!!!artifactId!!!maven-pmd-plugin!!!/artifactId!!!
!!!version!!!2.5!!!/version!!!
!!!configuration!!!
!!!targetJdk!!!1.6!!!/targetJdk!!!
!!!/configuration!!!
!!!/plugin!!!
!!!plugin!!!
!!!groupId!!!org.codehaus.mojo!!!/groupId!!!
!!!artifactId!!!cobertura-maven-plugin!!!/artifactId!!!
!!!version!!!2.4!!!/version!!!
!!!/plugin!!!
!!!plugin!!!
!!!groupId!!!org.codehaus.mojo!!!/groupId!!!
!!!artifactId!!!findbugs-maven-plugin!!!/artifactId!!!
!!!version!!!2.3.1!!!/version!!!
!!!configuration!!!
!!!threshold!!!Normal!!!/threshold!!!
!!!/configuration!!!
!!!/plugin!!!
!!!/plugins!!!
!!!/reporting!!!

!!!repositories!!!
!!!repository!!!
!!!id!!!internal-releases!!!/id!!!
!!!url!!!http://jvlinux.shopzilla.com:2099/nexus/content/repositories/internal-releases!!!/url!!!
!!!releases!!!!!!enabled!!!true!!!/enabled!!!!!!/releases!!!
!!!snapshots!!!!!!enabled!!!false!!!/enabled!!!!!!/snapshots!!!
!!!/repository!!!

!!!repository!!!
!!!id!!!internal-snapshots!!!/id!!!
!!!url!!!http://jvlinux.shopzilla.com:2099/nexus/content/repositories/internal-snapshots!!!/url!!!
!!!releases!!!!!!enabled!!!false!!!/enabled!!!!!!/releases!!!
!!!snapshots!!!
!!!enabled!!!true!!!/enabled!!!
!!!/snapshots!!!
!!!/repository!!!
!!!/repositories!!!

!!!/project!!!


Code of all classes in next post !


How to run:

Objectives

The regression test pack should:

  • do functional tests with the aim of preventing money-losing functional bugs, but not aimed at finding display-type bugs.
  • be robust in the face of cosmetic change, minimising the maintenance overhead and false negatives.
  • be possible to trigger with a single click or automatically from for instance Hudson.
  • run quickly (probably < 5 minutes) so that it is not only feasible to run them as for instance nightly jobs.
  • be easy to modify for developers, although they should be owned by QA.
  • have a maven-managed dependency between the site and the tests, so that we can ensure that test versions are synched with site versions.
  • be possible to parameterise so that the same tests can be run for all EU sites and with different combinations of browser versions, operating systems, etc.

Tools Evaluation

To date, we've been using Selenium as the framework for regression testing, both in the EU and the US. There are, however, many alternatives out there. We've taken a brief look at the following:

We've also been considering which language to use for controlling the automation. Since we have at least one QA and all developers being most proficient in Java, and since most of the tools are written in Java (even though tools like Selenium can be automated via Perl, etc.), we feel Java is the most suitable language.

The most promising tool is Selenium 2, even though it is only in the alpha stage. It has a really nice API that supports creating a DSL (http://webdriver.googlecode.com/svn/wiki/WebDriver_JAX_2008_Slides.pdf). This has the advantage of making the tests very readable at a high level while at the same time forcing the details of how an element on a page is identified into a thinner, reusable layer. An early sketch of what a test class can look like is (note how nothing of the actual tool used much less the HTML format of the page is propagated to this level - if we can maintain that, we can change web testing tools if Selenium 2 turns out not to be stable enough):

@RunWith(Parameterized.class)
public class HotTest {
private final Configuration configuration;

public HotTest(Configuration configuration) {
this.configuration = configuration;
}

@Test
public void testHot8BWalkin() throws Exception {
PageRequest request = configuration.getHot8BRequest();

Page page = request.fetch(With.trafficSource("wlk"));

SponsoredLinksPodVerifier.verify(page.getSponsoredLinksPod());
}

@Test
public void testHot8BGgl() throws Exception {
PageRequest request = configuration.getHot8BRequest();

Page page = request.fetch(With.trafficSource("ggl"));

SponsoredLinksPodVerifier.verify(page.getTopSponsoredLinksPod());
SponsoredLinksPodVerifier.verify(page.getBottomSponsoredLinksPod());
}

@Test
public void testHot8BMatureWarningNotAgreed() throws Exception {
PageRequest request = configuration.getHotMature8BRequest();

Page page = request.fetch(With.matureAgreed(false));

MatureWarningVerifier.assertIsWarning(page);
}

@Test
public void testHot8BMatureWarningAgreed() throws Exception {
PageRequest request = configuration.getHotMature8BRequest();

Page page = request.fetch(With.matureAgreed(true));

// check that the page is a regular hot page
SponsoredLinksPodVerifier.verify(page.getSponsoredLinksPod());

}

@Parameterized.Parameters
public static List getConfigurations() {
return Configurations.enabledConfigurations();
}

}

Solution Outline

This section lists some principles that are probably important to get the solution to meet the goals of being robust, parameterisable and easily modifiable by developers and QA both.

  • DSL: we should create a domain-specific language layer for the tests. This layer should define entities such as SponsoredLinksPods, ProductListPods and probably also ServiceInvocations. It creates a language that test flows and assertions can be written in, but doesn't contain any assertions or verifications in itself. It is the only place where direct interaction with the DOM is allowed.
  • Reusable tests: because we often reuse pods, we will probably want to be able to reuse tests. So, for instance, we should be able to do the same checks for SponsoredLinksPods in all Hot pages. Note that this kind of reuse is different from the DSL.
  • Injecting the WebDriver into the tests in order to enable running the same set of tests with different parameters.
  • Injecting parameters for country code and brand in order to enable running the same tests for different sites - note that it should ideally be possible to disable some tests for some sites, so that sites that don't do SLs can avoid testing for those, etc.


Running the tests

To run the tests, you need to check them out from their Git repository: http://git.shopzilla.com/cgit/cgit.cgi/qa/eu-regression-test/. You will also need an installation of Maven (preferably version 3.0, 2.2 as a minimum).

Once you've checked them out, change to the root directory of the regression pack and issue the following command:

mvn -PBR_GB

The tests should be executed against www.stage.bizrate.co.uk.

The following parameters can be used (by prepending -P to the strings listed below):

  1. Sites (you can specify many of these, tests will fail if none is specified)
    1. BR_GB
    2. SZ_GB
    3. LW_GB
    4. PC_FR
    5. SZ_FR
    6. BR_DE
    7. SG_DE
    8. SZ_DE
    9. all-sites (means, surprisingly, all the above)
  2. Environments (only one of these is valid - if none is specified, then 'stage' will be used)
    1. stage (will send requests to www.stage.)
    2. master (will send requests to www.master.)
    3. branch
    4. production
  1. Browsers (you can specify many of these, htmlUnit will be used if none is specified)
    1. htmlUnit
    2. firefox
    3. ie
    4. chrome

Here's a more complicated example that tests PC FR and BR GB against the master QA environment using Firefox and IE:

mvn -PPC_FR -PBR_GB -Pmaster -Pfirefox -Pie

or

mvn -PPC_FR -PBR_GB -Pproduction -Pfirefox -Pie

You can also select that only specific test class should be executed using the -Dtest=XX parameter of the Maven Surefire plugin (see http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#test):

mvn -PBR_GB -Dtest=HotTest

If desired, it is possible to override the default mechanism of specifying an environment to run the tests against, and instead specify a particular host that you want to test against. This is done by adding the flag '-Dhost.override=YOURHOST' to the command. With this setting, you can only specify a single site, as the test framework wouldn't know how to generate URLs for multiple sites running on a single host. Here's an example of targetting a single host:

mvn -PSZ_DE -Dhost.override=http://localhost:8085

Test Reports

TestNG generates reports in the target/surefire-reports directory, there is an index.html file there that gives you a report on what worked and not.


Hudson build

There is presently a Hudson build that runs the (simple) current test pack against PC_FR, SZ_DE and SZ_GB in staging every three hours: http://hudson001.shopzilla.laxhq:8420/hudson/view/All/job/eu-regression-test/