From d18abf30838dd03e7cd74b77826ad568c1e7c6f0 Mon Sep 17 00:00:00 2001 From: Hiroki Ohtani Date: Tue, 14 Oct 2014 11:42:56 +0900 Subject: [PATCH] refs #117 my first trial commit of Authbahn test suite. --- compliance/README.md | 11 ++++++++++ compliance/fuzzingserver.json | 9 ++++++++ compliance/test_fuzzingclient.py | 35 ++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 compliance/README.md create mode 100644 compliance/fuzzingserver.json create mode 100644 compliance/test_fuzzingclient.py diff --git a/compliance/README.md b/compliance/README.md new file mode 100644 index 0000000..5cef404 --- /dev/null +++ b/compliance/README.md @@ -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 + + diff --git a/compliance/fuzzingserver.json b/compliance/fuzzingserver.json new file mode 100644 index 0000000..6d4f4c0 --- /dev/null +++ b/compliance/fuzzingserver.json @@ -0,0 +1,9 @@ +{ +"url": "ws://localhost:8642", +"options": {"failByDrop": false}, +"outdir": "./reports/clients", +"webport": 8080, +"cases": ["*"], +"exclude-cases": [], +"exclude-agent-cases": {} +} diff --git a/compliance/test_fuzzingclient.py b/compliance/test_fuzzingclient.py new file mode 100644 index 0000000..4e42075 --- /dev/null +++ b/compliance/test_fuzzingclient.py @@ -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)