Skip to content

Commit

Permalink
working web and cmd line mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Oberstein committed Sep 19, 2013
1 parent 3ea868f commit e614fd2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
5 changes: 4 additions & 1 deletion autobahntestsuite/autobahntestsuite/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,11 @@ def progress(runId, testRun, testCase, result, remaining):

class ITestCase(Interface):
"""
Tests are instantiated as objects providing this interface.
They have their run() method called exactly once before
being disposed.
"""
index = Attribute("""Test case index.""")
index = Attribute("""Test case index - a tuple of ints.""")
description = Attribute("""Test case description.""")
expectation = Attribute("""Test case expectation.""")
params = Attribute("""Test case parameters.""")
Expand Down
1 change: 1 addition & 0 deletions autobahntestsuite/autobahntestsuite/wampfuzzing.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def runAndObserve(self, specName, observers_ = [], saveResults = True):
specId, spec = yield self._testDb.getSpecByName(specName)
casesByTestee = yield self._testDb.generateCasesByTestee(specId)
_observers = observers_[:]
#_observers = observers_

## publish WAMP event on test case finished
##
Expand Down
30 changes: 17 additions & 13 deletions autobahntestsuite/autobahntestsuite/wstest.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,25 @@ def __init__(self):

def startService(self):

if self.mode == "import":
return self.startImportSpec(self.options['spec'])
try:

elif self.mode == "export":
return self.startExportSpec(self.options['testset'], self.options.get('spec', None))
if self.mode == "import":
return self.startImportSpec(self.options['spec'])

elif self.mode == "fuzzingwampclient":
return self.startFuzzingWampClient(self.options['testset'])
elif self.mode == "export":
return self.startExportSpec(self.options['testset'], self.options.get('spec', None))

elif self.mode == "web":
return self.startWeb(debug = self.debug)
elif self.mode == "fuzzingwampclient":
return self.startFuzzingWampClient(self.options['testset'])

else:
pass
elif self.mode == "web":
return self.startWeb(debug = self.debug)

else:
pass
except Exception, e:
print e
reactor.stop()


methodMapping = {
Expand Down Expand Up @@ -300,18 +305,17 @@ def startFuzzingWampClient(self, specName):
"""
Start a WAMP fuzzing client test run using a spec previously imported.
"""

testSet = WampCaseSet()
testDb = TestDb([testSet])
testRunner = FuzzingWampClient(testDb)

def progress(runId, testRun, testCase, result, remaining):
if testCase:
print "%s - %s%s (%d tests remaining)" % (testRun.testee.name, "PASSED : " if result.passed else "FAILED : ", testCase.__class__.__name__, remaining)
print "%s - %s %s (%d tests remaining)" % (testRun.testee.name, "PASSED : " if result.passed else "FAILED : ", testCase.__class__.__name__, remaining)
else:
print "FINISHED : Test run for testee '%s' ended." % testRun.testee.name

runId, resultIds = yield testRunner.runAndObserve(specName, observers = [progress])
runId, resultIds = yield testRunner.runAndObserve(specName, [progress])

print
print "Tests finished: run ID %s, result IDs %d" % (runId, len(resultIds))
Expand Down
2 changes: 1 addition & 1 deletion examples/fuzzingwampclient/local.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"mode": "fuzzingwampclient",

"caseset": "wamp",
"cases": ["*"],
"cases": ["2.1.1.*"],
"exclude": [],

"options": {
Expand Down

0 comments on commit e614fd2

Please sign in to comment.