Skip to content

Skip Non‑Existing Test Paths Support for Robot Command #5690

Open

Description

@Symeon94

Hello,

This is essentially a feature request (or feature greenlight). It appears that the robot command fails completely if any of the provided test paths do not exist. As a result, if you accidentally include a missing file or directory, the entire execution stops, even tough it could have executed it for the other files.

While we can avoid running empty suites or non‑suites using --runemptysuite, there is currently no option to simply skip non‑existing files.

A solution to handle this could be to wrap the command in a script that checks file existence beforehand, but this still leaves a potential TOCTOU issue (the file might be deleted between the check and the actual execution).

Would it be possible to introduce a flag that instructs Robot Framework to skip missing files—for example, something like --skipnonexisting?

I’m willing to look into implementing this myself if the idea is considered acceptable (I haven't checked yet the code itself).

Thanks,
Syméon

Activity

  1. Symeon94 commented on Jun 26, 2026

    @Symeon94
    Author

    Some more information from my first investigations:
    A simpler solution could be "--skiponfailure". I see that the test files are passed on run.py and that suites are extracted at line 479 with

    suite = builder.build(*datasources)

    builder is a TestSuiteBuilder from robot.running.builder
    Then the following is called:

    structure = SuiteStructureBuilder(extensions, self.included_files).build(*paths)

    These are then passed to SuiteStructureParser (in robot/running/builderbuilders.py) in function _build_suite_file at line 289:

        def _build_suite_file(self, structure: SuiteFile):
            source = cast(Path, structure.source)
            defaults = self.parent_defaults or TestDefaults()
            parser = self.parsers[structure.extension]
            try:
                suite = parser.parse_suite_file(source, defaults)
                if not suite.tests:
                    LOGGER.info(f"Data source '{source}' has no tests or tasks.")
            except DataError as err:
                raise DataError(f"Parsing '{source}' failed: {err.message}") from err
            return suite

    We could simply discard the suite (or replace it with an empty suite) when this error occurs if an option is set.

  2. pekkaklarck commented on Jul 5, 2026

    @pekkaklarck
    Member

    I'm not sure how useful this would be in practice. If you run tests from the command line yourself and some files/directories don't exist, I would expect it to be easier to just fix the situation than to add a new command line option to the invalid run. Or do you always plan to run tests with robot --the-new-option ... instead of just robot ...? If this happens on automatic execution, validating that files/directories actually exists isn't hard as you also commented. There's the potential issue that files/directories are removed before the execution actually starts, but is this something that has really happened to you? I would consider such situation a problem to be fixed in itself.

  3. Symeon94 commented on Jul 6, 2026

    @Symeon94
    Author

    In some cases I do plan to run with --the-new-option. As you clearly identified, it is a case for automatic execution.

    The problem is to be put in perspective with its impact. It is indeed unlikely that a file will be deleted in between running the command and executing. And fixing it isn't hard when running manually. But should it happen, it's the whole run which will fail. Skipping failing tests allows one to cope with such situations.

    Overall failing the whole test for one missing file seems a bit of a radical solution (although, for some cases, I can imagine it making sense). That's why I don't propose to change the default behavior but only to add an option for these special cases. Adding more possibilities to the command.

    This is not something that really happened to me, but it is something that would be annoying should it happen. That’s why I’m trying to see if there is a way for it to be avoided.

    In my case, I’m checking syntax with --dryrun with a background task. But you can imagine similar scenarios for CI/CD pipeline overnight where one test file disappears with nobody that would be able to relaunch at that time. Yes, we can add a file check, but only a change to the command could avoid this TOCTOU situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions