Checking in work done on AUS acceptance tests. Please see README for instructions on how to get started and set things up.

This commit is contained in:
mike.morgan%oregonstate.edu 2006-09-08 09:55:22 +00:00
parent 8ded00e282
commit 43ee106c73
25 changed files with 424 additions and 0 deletions

64
webtools/aus/tests/README Normal file
View File

@ -0,0 +1,64 @@
AUS Acceptance Tests
====================
The purpose of this set of documents is to verify behavior of AUS by
testing all possible inputs and outputs for expected outcomes.
Required Tools
==============
The aus XML generation code found in mozilla/webtools/aus/xml
PHP
Apache w/ ModRewrite
The data directory found here, to be used as a synthetic build data source
PyFit: http://www.python.org/pypi/PyFit
FitNesse: http://fitnesse.org/FitNesse.DownLoad
JRE 1.5: http://java.sun.com/javase/downloads/
Setup
=====
AUS XML
Check out the current mozilla/webtools/aus/xml (or the tag you want to test)
Set it up, following the README
Use the data directory in mozilla/webtools/aus/tests/data as it's datasource
PyFit and FitNesse
python setup.py install for PyFit
./run.sh in fitnesse directory -- assuming you have it pointing to the right java, you're good to go
you may need to do ./run.sh -p 8080 if port 80 is already taken
Using FitNesse
Create a new wiki page that is runnable
go to http://localhose:8080/VerifyAUS
copy-paste Verify.txt in there
adjust your TEST_RUNNER path to point to the PyFit directory (mine will be wrong, since it's a mac)
go to properties, and check [x] test to make it a runnable page
Set up the PyFit test module in your PyFit/fit directory
go to your PyFit/fit directory
create a diretory named 'aus' in your PyFit/fit/ directory
move Verify.py into your aus directory
put Feedparser in the same directory as Verify.py (http://feedparser.org/)
touch __init__.py in the aus directory (PyFit needs this, apparently)
Running the test
click on "Test"
If your host is pointing to your AUS XML install, you should be good to go
Feedparser
Troubleshooting
===============
Did you copy config-dist.php -> config.php for the AUS XML stuff?
Does your server have the right rewrite for AUS XML? See htaccess.dist.
FixtureRenames error? Go to FitNess home directory and "touch FixtureRenames.txt" to fix.
Python is barfing? Make sure you have Feedparser somewhere.
Stuck? Talk to morgamic in IRC.

92
webtools/aus/tests/Verify.py Executable file
View File

@ -0,0 +1,92 @@
"""
Python translation of fit..
which is copyright (c) 2002 Cunningham & Cunningham, Inc.
Released under the terms of the GNU General Public License version 2 or later.
"""
import urllib2
import feedparser # http://feedparser.org/
from fit.ColumnFixture import ColumnFixture
auth_handler = urllib2.HTTPBasicAuthHandler()
auth_handler.add_password('khan!', 'khan.mozilla.org', 'morgamic', 'carebears')
opener = urllib2.build_opener(auth_handler)
urllib2.install_opener(opener)
class Verify(ColumnFixture):
_typeDict={"host": "String",
"product": "String",
"version": "String",
"build": "String",
"platform": "String",
"locale": "String",
"channel": "String",
"complete": "String",
"partial": "String",
"updateType": "String",
"osVersion": "String",
"lastURI": "String",
"newURI": "String",
"hasUpdate": "Boolean",
"hasComplete": "Boolean",
"hasPartial": "Boolean",
"isValidXml": "Boolean",
"isMinorUpdate": "Boolean",
"isMajorUpdate": "Boolean"}
def __init__(self):
self.osVersion = "osVersion"
self.lastURI = ""
self.lastXML = ""
# Checks if an update element exists.
def hasUpdate(self):
return ('</update>' in self.getXml())
# Checks if the expected complete patch exists.
def hasComplete(self):
return (self.complete in self.getXml())
# Check if the expected partial patch exists.
def hasPartial(self):
return (self.partial in self.getXml())
# Check if the update type is "minor".
def isMinorUpdate(self):
return ("type=\"minor\"" in self.getXml())
# Check if the update type is "major".
def isMajorUpdate(self):
return ("type=\"major\"" in self.getXml())
# Check if the AUS XML document is well-formed.
def isValidXml(self):
return (feedparser.parse(self.getXml()).bozo==0)
# Gets and returns an AUS XML document.
def getXml(self):
newURI = self.buildUri();
print newURI
if (self.lastURI == newURI):
return self.lastXML
newXML = urllib2.urlopen(newURI).read()
self.lastURI = newURI
self.lastXML = newXML
return newXML
# Builds an AUS URI based on our test data.
def buildUri(self):
return self.host + "/" + \
self.product + "/" + \
self.version + "/" + \
self.build + "/" + \
self.platform + "/" + \
self.locale + "/" + \
self.channel + "/" + \
self.osVersion + "/update.xml"

View File

@ -0,0 +1,86 @@
!1 Variables
!2 Environment
!define COMMAND_PATTERN {python %m -v %p}
!define TEST_RUNNER {/Users/morgamic/pyfit/fit/FitServer.py}
!2 Globals
!define host {http://khan.mozilla.org/~morgamic/austest/update/2}
!define product {Synthetic}
!define version {1.0}
!define platform {platform}
!define locale {locale}
!1 Patches
1 only a complete
2 both complete and partial
|aus.Verify|
|host|product|version|build|platform|locale|channel|complete|partial|hasUpdate?|hasComplete?|hasPartial?|isValidXml?|
|${host}|${product}|${version}|1000000001|${platform}|${locale}|channel|complete001|partial001|true|true|false|true|
|${host}|${product}|${version}|1000000002|${platform}|${locale}|channel|complete002|partial002|true|true|true|true|
!1 Invalid Input
1 no update is served for an invalid build id
|aus.Verify|
|host|product|version|build|platform|locale|channel|complete|partial|hasUpdate?|hasComplete?|hasPartial?|isValidXml?|
|${host}|${product}|${version}|0000000000|${platform}|${locale}|channel|complete|partial|false|false|false|true|
!1 Channels and Fallback Channels
1 update exists for partner channel
2 update exists for normal channel
|aus.Verify|
|host|product|version|build|platform|locale|channel|complete|partial|hasUpdate?|hasComplete?|hasPartial?|isValidXml?|
|${host}|${product}|${version}|3000000001|${platform}|${locale}|channel-cck-partner|complete-partner-003|partial-partner-003|true|true|true|true|
|${host}|${product}|${version}|3000000001|${platform}|${locale}|channel|complete003|partial003|true|true|true|true|
1 update for partner channel falls back and offers normal patches (complete|partial)004
2 update exists as expected for normal channel
|aus.Verify|
|host|product|version|build|platform|locale|channel|complete|partial|hasUpdate?|hasComplete?|hasPartial?|isValidXml?|
|${host}|${product}|${version}|4000000001|${platform}|${locale}|channel-cck-partner|complete004|partial004|true|true|true|true|
|${host}|${product}|${version}|4000000001|${platform}|${locale}|channel|complete004|partial004|true|true|true|true|
1 update exists only on partner channel
2 update does not exist for normal channel
|aus.Verify|
|host|product|version|build|platform|locale|channel|complete|partial|hasUpdate?|hasComplete?|hasPartial?|isValidXml?|
|${host}|${product}|${version}|5000000001|${platform}|${locale}|channel-cck-partner|complete-partner-005|partial-partner-005|true|true|true|true|
|${host}|${product}|${version}|5000000001|${platform}|${locale}|channel|complete|partial|false|false|false|true|
1 no update exists for partner channel
2 no update exists for normal channel
|aus.Verify|
|host|product|version|build|platform|locale|channel|complete|partial|hasUpdate?|hasComplete?|hasPartial?|isValidXml?|
|${host}|${product}|${version}|6000000001|${platform}|${locale}|channel-cck-partner|complete|partial|false|false|false|true|
|${host}|${product}|${version}|6000000001|${platform}|${locale}|channel|complete|partial|false|false|false|true|
!1 Build ID Validation
1 don't serve update if build version in uri is newer than build version in *.txt
2 don't serve update if build version in uri is newer than build version in *.txt, fallback channel
|aus.Verify|
|host|product|version|build|platform|locale|channel|complete|partial|hasUpdate?|hasComplete?|hasPartial?|isValidXml?|
|${host}|${product}|${version}|7000000001|${platform}|${locale}|channel|complete|partial|false|false|false|true|
|${host}|${product}|${version}|7000000001|${platform}|${locale}|channel-cck-partner|complete|partial|false|false|false|true|
!1 Major and Minor updates
1 minor update
2 major update
|aus.Verify|
|host|product|version|build|platform|locale|channel|complete|partial|hasUpdate?|isMinorUpdate?|isMajorUpdate?|hasComplete?|hasPartial?|isValidXml?|
|${host}|${product}|${version}|8000000001|${platform}|${locale}|channel|complete|partial|true|true|false|true|true|true|
|${host}|${product}|${version}|8000000002|${platform}|${locale}|channel|complete|partial|true|false|true|true|true|true|
!1 os version compatibility
1 supported os version, or unknown os version
2 unsupported or blocked platform (exists in $unsupportedPlatforms in aus2 config)
|aus.Verify|
|host|product|version|build|platform|locale|channel|osVersion|complete|partial|hasUpdate?|hasComplete?|hasPartial?|isValidXml?|
|${host}|${product}|${version}|9000000001|${platform}|${locale}|channel|Web 2.0|complete|partial|true|true|true|true|
|${host}|${product}|${version}|9000000001|${platform}|${locale}|channel|Windows_98|complete|partial|false|false|false|true|
!1 Nightly Updates
1 one-off update serving both complete and partial
2 outdated (>1 off) update serving only a complete
3 version mapping to another branchVersion (1.0->1.x)
4 version with no branchVersion in AUS config (6.0->?)
TODO: add aus.Nightly and adjust fixtures to include variable versions.

View File

@ -0,0 +1,9 @@
complete
http://synthetic.1.0.platform.buildid.locale.channel/complete-partner-003
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
2006020101
1.0
1.0
http://detail.url/content.html

View File

@ -0,0 +1,8 @@
partial
http://synthetic.1.0.platform.buildid.locale.channel/partial-partner-003
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
2006020101
1.0
1.0

View File

@ -0,0 +1,9 @@
complete
http://synthetic.1.0.platform.buildid.locale.channel/complete001
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
2006010101
1.0
1.0
http://detail.url/content.html

View File

@ -0,0 +1,9 @@
complete
http://synthetic.1.0.platform.buildid.locale.channel/complete002
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
2006010102
1.0
1.0
http://detail.url/content.html

View File

@ -0,0 +1,8 @@
partial
http://synthetic.1.0.platform.buildid.locale.channel/partial002
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
2006010102
1.0
1.0

View File

@ -0,0 +1,9 @@
complete
http://synthetic.1.0.platform.buildid.locale.channel/complete-partner-003
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
3000000002
1.0
1.0
http://detail.url/content.html

View File

@ -0,0 +1,8 @@
partial
http://synthetic.1.0.platform.buildid.locale.channel/partial-partner-003
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
3000000002
1.0
1.0

View File

@ -0,0 +1,9 @@
complete
http://synthetic.1.0.platform.buildid.locale.channel/complete003
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
3000000002
1.0
1.0
http://detail.url/content.html

View File

@ -0,0 +1,8 @@
partial
http://synthetic.1.0.platform.buildid.locale.channel/partial003
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
3000000002
1.0
1.0

View File

@ -0,0 +1,9 @@
complete
http://synthetic.1.0.platform.buildid.locale.channel/complete004
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
4000000002
1.0
1.0
http://detail.url/content.html

View File

@ -0,0 +1,8 @@
partial
http://synthetic.1.0.platform.buildid.locale.channel/partial004
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
4000000002
1.0
1.0

View File

@ -0,0 +1,9 @@
complete
http://synthetic.1.0.platform.buildid.locale.channel/complete-partner-005
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
5000000002
1.0
1.0
http://detail.url/content.html

View File

@ -0,0 +1,8 @@
partial
http://synthetic.1.0.platform.buildid.locale.channel/partial-partner-005
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
5000000002
1.0
1.0

View File

@ -0,0 +1,9 @@
complete
http://synthetic.1.0.platform.buildid.locale.channel/complete002
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
2006000000
1.0
1.0
http://detail.url/content.html

View File

@ -0,0 +1,8 @@
partial
http://synthetic.1.0.platform.buildid.locale.channel/partial002
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
2006000000
1.0
1.0

View File

@ -0,0 +1,10 @@
complete
http://synthetic.1.0.platform.buildid.locale.channel/complete008
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
8000000003
1.0
1.0
http://detail.url/content.html
minor

View File

@ -0,0 +1,8 @@
partial
http://synthetic.1.0.platform.buildid.locale.channel/partial008
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
8000000003
1.0
1.0

View File

@ -0,0 +1,10 @@
complete
http://synthetic.1.0.platform.buildid.locale.channel/complete008
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
8000000003
1.0
1.0
http://detail.url/content.html
major

View File

@ -0,0 +1,8 @@
partial
http://synthetic.1.0.platform.buildid.locale.channel/partial008
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
8000000003
1.0
1.0

View File

@ -0,0 +1,10 @@
complete
http://synthetic.1.0.platform.buildid.locale.channel/complete009
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
9000000002
1.0
1.0
http://detail.url/content.html
minor

View File

@ -0,0 +1,8 @@
partial
http://synthetic.1.0.platform.buildid.locale.channel/partial009
SHA1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12345
9000000002
1.0
1.0