简体   繁体   中英

How do I pass Thread safe Arguments/Objects to my Fitnesse Fixture?

Similar to how do i pass program arguments in java for my Fitnesse Fixture?

.. I wish to kick off my Fitnesse tests in parallel using fitnesseMain.FitNesseMain.launchFitNesse(Arguments arguments)... and pass thread-safe objects to each test to be accessed later by test code run by Fitnesse.

The test code itself is plain old Java, invoked from Fitnesse using givwenzen. The Java test code goes on to dynamically kick off Selenium tests.

I need to pass these thread-safe objects through Fitnesse all the way to the Java test scripts so that they start a Selenium RemoteWebDriver with the correct org.openqa.selenium.remote.DesiredCapabilities.

I have tried using the good old java.lang.ThreadLocal, but it appears that Fitnesse is spawning threads of its own to run the tests which effectively eliminates this option.

Considering Givwenzen is written using Slim, I don't think what you want to do is possible. If possible, it certainly isn't easy, as Slim works by running the tests in a separate process.

So when you run FitNesse, it creates the web server and the wiki. That runs as one java task. When you click on the Test or Suite buttons (or use the URLs) it creates a new Java process that is the SlimServer. Then the FitNesse server sends instructions to the SlimServer as strings and then the SlimServer processes those into instructions to run tests. So the coupling between the code that is launched via FitNesseMain to the slim tests is actually sort of loose. This is done on purpose, as it lets the SlimServer implementation be language independent.

Within the SlimServer, there is the ability to work with actual object references, and that might be OK, but I have doubts that the chain of custody will be threadsafe at each step.

Sorry. Maybe someone else will have an idea for how to work around the issues I've described.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM