MarketSquare / MarketSquare/robotframework-sherlock

Tasks and Test Cases cannot be included to the same run

Open
#75 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
14
Forks
1
PR merge metrics
No merged PRs in 30d

Description

If we have example two files:

├── rpa_test.robot
└── test_robot.robot

rpa_test.robot:

*** Tasks ***
Test Tasks
  No Operation

test_robot.robot:

*** Test Cases ***
Test Case Example
    No Operation

We got error:

$ sherlock
Sherlock analysis of Robot Framework code:

Using <home_path>/sources/sherlock_test as source repository
Traceback (most recent call last):
  File "<home_path>/.pyenv/versions/3.8.15/envs/sherlock/lib/python3.8/site-packages/robot/running/builder/builders.py", line 177, in _build_suite
    self._validate_execution_mode(suite)
  File "<home_path>/.pyenv/versions/3.8.15/envs/sherlock/lib/python3.8/site-packages/robot/running/builder/builders.py", line 191, in _validate_execution_mode
    raise DataError(f"Conflicting execution modes. File has {this} "
robot.errors.DataError: Conflicting execution modes. File has tests but files parsed earlier have tasks. Fix headers or use '--rpa' or '--norpa' options to set the execution mode explicitly.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<home_path>/.pyenv/versions/sherlock/bin/sherlock", line 8, in <module>
    sys.exit(run_cli())
  File "<home_path>/.pyenv/versions/3.8.15/envs/sherlock/lib/python3.8/site-packages/sherlock/__init__.py", line 19, in run_cli
    raise err
  File "<home_path>/.pyenv/versions/3.8.15/envs/sherlock/lib/python3.8/site-packages/sherlock/__init__.py", line 9, in run_cli
    runner.run()
  File "<home_path>/.pyenv/versions/3.8.15/envs/sherlock/lib/python3.8/site-packages/sherlock/core.py", line 29, in run
    suite = TestSuiteBuilder().build(self.config.path)
  File "<home_path>/.pyenv/versions/3.8.15/envs/sherlock/lib/python3.8/site-packages/robot/running/builder/builders.py", line 91, in build
    suite = parser.parse(structure)
  File "<home_path>/.pyenv/versions/3.8.15/envs/sherlock/lib/python3.8/site-packages/robot/running/builder/builders.py", line 138, in parse
    structure.visit(self)
  File "<home_path>/.pyenv/versions/3.8.15/envs/sherlock/lib/python3.8/site-packages/robot/parsing/suitestructure.py", line 46, in visit
    visitor.visit_directory(self)
  File "<home_path>/.pyenv/versions/3.8.15/envs/sherlock/lib/python3.8/site-packages/robot/parsing/suitestructure.py", line 166, in visit_directory
    child.visit(self)
  File "<home_path>/.pyenv/versions/3.8.15/envs/sherlock/lib/python3.8/site-packages/robot/parsing/suitestructure.py", line 44, in visit
    visitor.visit_file(self)
  File "<home_path>/.pyenv/versions/3.8.15/envs/sherlock/lib/python3.8/site-packages/robot/running/builder/builders.py", line 144, in visit_file
    suite, _ = self._build_suite(structure)
  File "<home_path>/.pyenv/versions/3.8.15/envs/sherlock/lib/python3.8/site-packages/robot/running/builder/builders.py", line 179, in _build_suite
    raise DataError(f"Parsing '{source}' failed: {err.message}")
robot.errors.DataError: Parsing '<home_path>/sources/sherlock_test/test_robot.robot' failed: Conflicting execution modes. File has tests but files parsed earlier have tasks. Fix headers or use '--rpa' or '--norpa' options to set the execution mode explicitly.
Fatal exception occurred. You can create an issue at https://github.com/bhirsz/robotframework-sherlock/issues . Thanks!
$ pip list
Package                 Version
----------------------- -------
commonmark              0.9.1
Jinja2                  3.1.2
MarkupSafe              2.1.2
pathspec                0.9.0
pip                     22.0.4
Pygments                2.14.0
rich                    13.1.0
robotframework          6.0.2
robotframework-sherlock 0.2.0
setuptools              56.0.0
tabulate                0.8.9
toml                    0.10.2
typing_extensions       4.4.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at sherlock/core.py, where TestSuiteBuilder().build is called, and reproduce the issue with the supplied rpa_test.robot and test_robot.robot files. Read how the Robot Framework suite builder handles mixed task and test execution modes, then verify that Sherlock no longer fails unexpectedly when both files are present.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.