my first trial commit of Authbahn test suite.
This commit is contained in:
Hiroki Ohtani
2014-10-14 11:42:56 +09:00
parent f005c2b1f5
commit d18abf3083
3 changed files with 55 additions and 0 deletions

11
compliance/README.md Normal file
View File

@@ -0,0 +1,11 @@
# Autobahn Testsuite
General information and installation instructions are available at http://autobahn.ws/testsuite .
## Running the test suite
$ wstest -m fuzzingserver
$ python test_fuzzingclient.py

View File

@@ -0,0 +1,9 @@
{
"url": "ws://localhost:8642",
"options": {"failByDrop": false},
"outdir": "./reports/clients",
"webport": 8080,
"cases": ["*"],
"exclude-cases": [],
"exclude-agent-cases": {}
}

View File

@@ -0,0 +1,35 @@
#!/usr/bin/env python
import websocket
import json
import traceback
SERVER = 'ws://127.0.0.1:8642'
AGENT = 'py-websockets-cleint'
ws = websocket.create_connection(SERVER + "/getCaseCount")
count = json.loads(ws.recv())
ws.close()
success = 0
failed = 0
for case in range(1, count+1):
url = SERVER + '/runCase?case={}&agent={}'.format(case, AGENT)
try:
ws = websocket.create_connection(url)
opcode, msg = ws.recv_data()
if opcode in (websocket.ABNF.OPCODE_TEXT, websocket.ABNF.OPCODE_BINARY):
ws.send(msg, opcode)
success += 1
except Exception as e:
failed += 1
print("[Faield] Test Case: " + str(case))
print(traceback.format_exc())
finally:
ws.close()
print("Ran {} test cases. success: {}, faield: {}".format(case, success, failed))
url = SERVER + '/updateReports?agent={}'.format(AGENT)
ws = websocket.create_connection(url)