Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions SchemathesisLibrary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
from DataDriver.ReaderConfig import TestCaseData # type: ignore
from hypothesis import HealthCheck, Phase, Verbosity, given, settings
from hypothesis import strategies as st
from robot.api import logger
from robot.api.deco import keyword
from robot.result.model import TestCase as ResultTestCase # type: ignore
from robot.result.model import TestSuite as ResultTestSuite # type: ignore
from robot.running.model import TestCase, TestSuite # type: ignore
from robotlibcore import DynamicCore # type: ignore
from schemathesis.core.result import Ok # type: ignore
from schemathesis.core.result import Ok
from schemathesis.core.transport import Response

__version__ = "0.1.0"
Expand Down Expand Up @@ -81,7 +82,20 @@ def _start_test(self, data: TestCase, result: ResultTestCase) -> None:
@keyword
def call_and_validate(self, case: schemathesis.Case) -> Response:
"""Validate a Schemathesis case."""
return case.call_and_validate()
self.info(f"Case: {case.path} | {case.method} | {case.path_parameters}")
self.debug(
f"Case headers {case.headers!r} body {case.body!r} "
f"cookies {case.cookies!r} path parameters {case.path_parameters!r}"
)
response = case.call_and_validate()
self.debug(f"Response: {response.headers} | {response.status_code} | {response.text}")
return response

def info(self, message: str) -> None:
logger.info(message)

def debug(self, message: str) -> None:
logger.debug(message)


def add_examples(strategy: st.SearchStrategy, container: list[TestCaseData], max_examples: int) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def atest(ctx):
"run",
"robot",
"--loglevel",
"DEBUG",
"DEBUG:INFO",
"--pythonpath",
".",
"--outputdir",
Expand Down