Rfswarm-agent does not recognize that external file was updated during the test

From the documentation, files can be transferred to the agent in the same relative path to your robot file when the file is referenced in the Settings section of the robot file using Metadata | File. This has worked for me for reference files that remain static for the duration of the test.

However, during the test, I take screenshots of the webpage and save it to the location that is also referenced using Metadata | File. This png is then compared to one of the other referenced files. So the png is expected to change multiple times during the test.

This is fine when I run it directly from robot, but the test fails when I run it using the rfswarm manager. The agent uses the file that was present before the test began and does not “update” the file when the screenshot is taken.

Is there a way around this?

RFSwarm Manager/Agent 1.4.0
Robot framework 7.1

Thank you

I am sure @damies13 will have the best answer about this, but my view is that what you are expecting is not the usual flow for these automation tools. They usually may have a cached of the initial files, and not care for their updates.
Note that I am thinking that RFSwarm is behaving like most automation systems like Jenkins or Azure, where they make a copy of the files and work on them.

1 Like

Thank you @HelioGuilherme66. Would you have any suggestions for a workaround to achieve what I am trying to do with rfswarm?

could you share minimal code that can reproduce the issue , still don’t get it well … why you reference to the location in the metadata and not variables sections… it 's been a while since i have played a bit with RFSwarm but i will try to answer based on what i understood.

1- How do you write the location path ? could you share it ?
try to use ${OUTPUTDIR} or ${EXECDIR} instead of full absolute path ( if you are already doing it)

2- write some python code to update the cache

3- idk if it offers settings to adjust file caching behavior or to specify directories that are synchronized during test execution but check it , if there is no settings , you can raise an issue, it can be a feature.

2 Likes

Hi @Gad,

Gad Hassine (@hassineabd) is correct, you should use relative paths or path variables, it seems from you message you are partially?

In the documentation under Robot File handling I cover how the agents cache the files from the manager.

The usual location for the files on the agent is inside the rfswarmagent directory under your temp directory, but every system can have a different location for temp. You can change this location in the agent ini file or when running the agent with a command line option if you need to.

When the agent runs the robot it uses the path to the robot file in rfswarmagent directory not from the location you normally would find the file.

From reading your original question I think what is happening might be:

  • the robot file could be updating the png in the rfswarmagent directory and you are looking at the file in the original directory?
  • The agent is updating the file back to the original from the manager after the test
    • before the test starts the agent pulls the files from the manager, if a file changes on the manager the file’s hash changes and the agent will see this change and update the local file
    • during a test (when the agent is in running state) the agent doesn’t pull file updates from the manager (this is by design)
    • after the test finishes and the agent returns to ready state it will continue checking for new/updated files from the manager, if the file has changed on the agent it’s hash will have changed, but the hash on the manager hasn’t, so I’d expect the agent would pull the original file from the manager and over write the local (modified) one with the one from the manager

Another thing to be careful with is if you are running more than 1 robot of the same test case on the same agent machine there is a potential for this file to get corrupted if 2 robots attempt to update the png file at the same time. I would suggest configuring the test to copy the original file to another location that’s unique for the currently running robot, the robot framework builtin variable ${OUTPUT DIR} is useful for this, it’s where the output.xml and html files get saved and the agent ensures it’s unique to each robot, also anything in this folder will get copied back to the manager at the end of the test

Hopefully this helps you find a solution,

Dave.

2 Likes

Thank you @hassineabd and @damies13 for taking the time to respond. Setting the location where the screenshot png is written to ${OUTPUTDIR} solved the issue. Each robot on the agent machine now creates and updates the file in TEMP and the test runs as expected.
Thank you

2 Likes

Hi @Gad ,

Great news, Have fun with RFSwarm, and remember help is just a forum question away :+1:

FYI I’m on the east coast of Australia, so I may take a few hours to reply sometimes because of timezone differences, but I try to check this forum daily.

Dave.

1 Like