plone / plone.testing

Provides tools for writing unit and integration tests in a Zope and Plone environment. It is not tied to Plone, and it does not depend on Zope 2 (although it has some optional Zope 2-only features)
https://pypi.org/project/plone.testing/
3 stars 9 forks source link

How to use robot-server and pybot with not fiddling with env variables? #60

Open ale-rt opened 5 years ago

ale-rt commented 5 years ago

After #51 the robot server starts on a random port and that port is stored on the fixture.

Related issue:

While this is very good for normal testing this breaks the workflow of people that were using the robot-server script to run the server and the pybot script to run the tests.

The reason is that the two scripts are run separately and there is no simple way for the pybot script to know which port the robot server is using.

We can solve this issue in many way:

Force everybody to set the relevant environment variables

For example we can change the documentation to suggest this way of running the server:

ZSERVER_PORT=55001 ./bin/robot-server plone.app.robotframework.testing.PLONE_ROBOT_TESTING 

and this way to run pybot:

ZSERVER_HOST=localhost ZSERVER_PORT=55001 ./bin/pybot -t '*' src/plone/app/robotframework/tests/test_autologin_library.robot

Pro:

Con:

Restore the previous defaults unless some variable is set to force the random ports.

We could yet another environment variable and change the default for the port from 55001 to 0 only if ZSERVER_USE_RANDOM_PORT is truish. Or we can just ZSERVER_PORT=0.

Pro:

Con:

I personally prefer this second approach because it seems more natural to me.

ale-rt commented 5 years ago

@Rotonen do you have some insights? Can't we just support random ports with this env variable ZSERVER_PORT=0?