11
compliance/README.md
Normal file
11
compliance/README.md
Normal 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
|
||||||
|
|
||||||
|
|
9
compliance/fuzzingserver.json
Normal file
9
compliance/fuzzingserver.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"url": "ws://localhost:8642",
|
||||||
|
"options": {"failByDrop": false},
|
||||||
|
"outdir": "./reports/clients",
|
||||||
|
"webport": 8080,
|
||||||
|
"cases": ["*"],
|
||||||
|
"exclude-cases": [],
|
||||||
|
"exclude-agent-cases": {}
|
||||||
|
}
|
35
compliance/test_fuzzingclient.py
Normal file
35
compliance/test_fuzzingclient.py
Normal 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)
|
Reference in New Issue
Block a user