qase-tms / qase-python

Qase TMS Python SDK
https://developers.qase.io
26 stars 26 forks source link

with qase.step - Error at sending results for run #82

Closed Nickolasll closed 1 year ago

Nickolasll commented 1 year ago

qase-pytest == 3.0.1
qaseio == 3.1.0

We have an issue with using qase.step like this:

from qaseio.pytest import qase

with qase.step(1): 
    ...

It worked something like a week ago, but now we are getting this error:

Error at sending results for run 1028: Invalid type for variable '0'. Required value type is TestStepResultCreate and passed type was ResultCreateStepsInner at ['results'][0]['steps'][0]

And test runs don't mark as completed automatically.

Nickolasll commented 1 year ago

Also we are tried to use qase-pytest == 4.0.0 and test run don't even creating. Qase plugin do not initializing

    @staticmethod
    @contextdecorator
    def step(title):
        ...
        try:
            plugin = QasePytestPluginSingleton.get_instance()
            plugin.start_step(uuid=id)
            yield
            plugin.finish_step(uuid=id, title=title)
        except PluginNotInitializedException:
            yield  <- we are here, so no results in qase.io
n3r commented 1 year ago

@Nickolasll May I ask you to provide the following information: contents of 'pytest.ini' (without token and project code, of course).

Also, do you have xdist installed?

Nickolasll commented 1 year ago

xdisxt is not installed (we had troubles with it and removed for now).

For 3.0.1 we use this:

[pytest]
# qase
qs_enabled = True
qs_api_token = api_token
qs_project_code = project_code
qs_complete_run = True
qs_new_run = True
qs_debug = False

for 4.0.0 we tryed to use this:

[pytest]
qs_mode = 'testops'
qs_to_api_token = token
qs_to_project_code = project_code
qs_to_complete_run = True
qs_to_mode = 'sync'   # and async too
n3r commented 1 year ago

Should have been fixed in https://github.com/qase-tms/qase-python/releases/tag/qase-pytest-4.1.0.

@Nickolasll can you check, please?

Nickolasll commented 1 year ago

It works, but something was really unexpected:

  1. with qase.step() works, but with string input only. We used int in 3.0.1 and it worked fine.

  2. 4.1.0 has an error with pytest.ini, so nothing happens with it:

../../../../../usr/local/lib/python3.8/dist-packages/_pytest/config/__init__.py:1238
  /usr/local/lib/python3.8/dist-packages/_pytest/config/__init__.py:1238: PytestConfigWarning: Unknown config option: qs_to_project_code

    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
  1. But 4.1.0 works with command line pytest --qase-mode=testops --qase-to-api-token=<token> --qase-to-project=<project> run.py.

  2. Let's look in example:

For example we have test case in https://app.qase.io/case/ created by our manager. It has description, title and steps with data and expected results.

@qase.id(1)
@qase.description("Try to login in Qase TestOps using login and password")
def test_example_1():
    with qase.step("first step"):
        print(1)

After execution test case in https://app.qase.io/case/ was fully overrided - it has name test_example_1, description "Try to login in Qase TestOps using login and password", just one step without data and expected results. 3.0.1 worked not like that.

I used command pytest --qase-mode=testops --qase-to-api-token=<token> --qase-to-project=<project> run.py for tests - may be I didn't catch something from documentation and forgot some arguments?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.