Skip to content

Commit

Permalink
Updated selenium and tweaked tests
Browse files Browse the repository at this point in the history
  • Loading branch information
psiinon committed Jun 1, 2012
1 parent efd9bc2 commit 6e62579
Show file tree
Hide file tree
Showing 43 changed files with 38 additions and 6 deletions.
8 changes: 6 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,16 @@
<!-- Your servlet engine must be running when you start this test -->

<!-- Start ZAP with UI -->
<!--
<ant antfile="zap-build.xml" target="startZap" inheritAll="false"/>
-->

<!-- OR Start ZAP in background -->
<!--
IMPORTANT - there is a bug in ZAP 1.4.0 which means ZAP running in daemon mode will exit
when you save the session
-->
<!--
<ant antfile="zap-build.xml" target="startZapDaemon" inheritAll="false"/>
-->

<!-- Run the standard tests -->
<junit printsummary="yes" fork="yes">
Expand Down
Binary file added lib/ant.jar
Binary file not shown.
Binary file added lib/apache-mime4j-0.6.jar
Binary file not shown.
Binary file added lib/bsh-1.3.0.jar
Binary file not shown.
Binary file added lib/cglib-nodep-2.1_3.jar
Binary file not shown.
Binary file added lib/commons-codec-1.6.jar
Binary file not shown.
Binary file added lib/commons-collections-3.2.1.jar
Binary file not shown.
Binary file added lib/commons-exec-1.1.jar
Binary file not shown.
Binary file added lib/commons-io-2.0.1.jar
Binary file not shown.
Binary file added lib/commons-jxpath-1.3.jar
Binary file not shown.
Binary file added lib/commons-logging-1.1.1.jar
Binary file not shown.
Binary file added lib/cssparser-0.9.5.jar
Binary file not shown.
Binary file added lib/guava-11.0.1.jar
Binary file not shown.
Binary file added lib/hamcrest-core-1.1.jar
Binary file not shown.
Binary file added lib/hamcrest-library-1.1.jar
Binary file not shown.
Binary file added lib/htmlunit-2.9.jar
Binary file not shown.
Binary file added lib/htmlunit-core-js-2.9.jar
Binary file not shown.
Binary file added lib/httpclient-4.1.3.jar
Binary file not shown.
Binary file added lib/httpcore-4.1.3.jar
Binary file not shown.
Binary file added lib/httpmime-4.1.3.jar
Binary file not shown.
Binary file added lib/ini4j-0.5.2.jar
Binary file not shown.
Binary file added lib/jcommander-1.13.jar
Binary file not shown.
Binary file added lib/jna-3.4.0.jar
Binary file not shown.
Binary file added lib/jna-platform-3.4.0.jar
Binary file not shown.
Binary file added lib/json-20080701.jar
Binary file not shown.
Binary file added lib/junit-4.10.jar
Binary file not shown.
Binary file added lib/junit-dep-4.10.jar
Binary file not shown.
Binary file added lib/nekohtml-1.9.15.jar
Binary file not shown.
Binary file added lib/operadriver-v0.11.jar
Binary file not shown.
Binary file added lib/protobuf-java-2.4.1.jar
Binary file not shown.
Binary file added lib/sac-1.3.jar
Binary file not shown.
Binary file added lib/selenium-java-2.21.0.jar
Binary file not shown.
Binary file removed lib/selenium-java-client-driver.jar
Binary file not shown.
Binary file removed lib/selenium-server-standalone-2.5.0.jar
Binary file not shown.
Binary file added lib/serializer-2.7.1.jar
Binary file not shown.
Binary file added lib/testng-6.0.1-nobsh-noguice.jar
Binary file not shown.
Binary file added lib/webbit-0.4.6-full.jar
Binary file not shown.
Binary file added lib/xalan-2.7.1.jar
Binary file not shown.
Binary file added lib/xercesImpl-2.9.1.jar
Binary file not shown.
Binary file added lib/xml-apis-1.3.04.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions local.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Directory to deploy to
# /opt/tomcat/webapps
deploy.dir=C:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\webapps
deploy.dir=C:\\Program Files\\Apache Software Foundation\\Tomcat 7.0\\webapps

# The application being tested
zap.target=http://localhost:8080/
Expand All @@ -12,6 +12,7 @@ zap.addr=localhost
# The ZAP port
zap.port=8090
# The ZAP home directory
zap.dir=C:\\Program Files\\OWASP\\Zed Attack Proxy
# zap.dir=C:\\Program Files\\OWASP\\Zed Attack Proxy
zap.dir=C:\\Program Files (x86)\\OWASP\\Zed Attack Proxy
# The default ZAP session name
zap.session=zap.session
25 changes: 24 additions & 1 deletion src/com/thebodgeitstore/selenium/tests/FunctionalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
package com.thebodgeitstore.selenium.tests;

import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
Expand Down Expand Up @@ -49,6 +49,7 @@ public void checkMenu(String linkText, String page) {
}

public void checkMenuLinks(String page) {

driver.get(site + page);
checkMenu("Home", "home.jsp");

Expand All @@ -64,6 +65,9 @@ public void checkMenuLinks(String page) {
driver.get(site + page);
checkMenu("Your Basket", "basket.jsp");

driver.get(site + page);
checkMenu("Search", "search.jsp");

}

public void tstMenuLinks() {
Expand All @@ -72,6 +76,7 @@ public void tstMenuLinks() {
checkMenuLinks("contact.jsp");
checkMenuLinks("login.jsp");
checkMenuLinks("basket.jsp");
checkMenuLinks("search.jsp");
}

public void registerUser(String user, String password) {
Expand Down Expand Up @@ -154,11 +159,21 @@ public void tstAddProductsToBasket() {
driver.findElement(By.id("submit")).click();
}

public void tstSearch() {
driver.get(site + "search.jsp?q=doo");

// TODO check the results!
//driver.findElement(By.name("q")).sendKeys("doo");

}

public void testAll() {
tstMenuLinks();
tstRegisterUser();
tstRegisterAndLoginUser();
tstAddProductsToBasket();
tstSearch();

}

public void tearDown() throws Exception {
Expand All @@ -181,4 +196,12 @@ protected void setSite(String site) {
this.site = site;
}

public static void main(String[] args) throws Exception {
FunctionalTest test = new FunctionalTest();
test.setUp();
test.testAll();
test.tearDown();

}

}
6 changes: 5 additions & 1 deletion zap-build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@
<ignoreAlert risk="Low" reliability="Warning"/>
will ignore all alerts with a Low risk and Warning reliability
The url, param and other fields are all regexs
-->
-->

<ignoreAlert alert="X-Content-Type-Options header missing" risk="Low" reliability="Warning"/>
<ignoreAlert alert="Cross Site Request Forgery" risk="Medium" reliability="Warning"/>
<ignoreAlert alert="Cookie set without HttpOnly flag" risk="Low" reliability="Warning"/>
<ignoreAlert alert="X-Frame-Options header not set" risk="Informational" reliability="Warning"/>
</alertCheckTask>
</target>

Expand Down

0 comments on commit 6e62579

Please sign in to comment.