asyrjasalo / RESTinstance

Robot Framework library for RESTful JSON APIs
https://pypi.org/project/RESTinstance
GNU Lesser General Public License v3.0
205 stars 84 forks source link

Have several active connections and switch between active connections. #91

Closed vmaillol-altair closed 2 years ago

vmaillol-altair commented 4 years ago

I would like have several active connections handled by an alias like the built-in robot library Telnet or Process

We can do this using robot.utils.ConnectionCache.

I you want, I can create a pull request to add Switch REST Client keyword

    | ${id}=              |`Start REST Client` | foobar.com     |
    | `Start REST Client` | localhost:5014     | alias=site1    |

    You can use Switch REST Client
    | `Switch REST Client | ${id}              |                |
    | `GET`               | /route_1           |                |
    | `GET`               | /route_2           |                |
    | `Switch REST Client | site1              |                |
    | `GET`               | /route_1           |                |

    Or provide id or alias for each call
    | `GET`               | /route_1           | alias=${id}    |
    | `GET`               | /route_2           | alias=${id}    |
    | `GET`               | /route_3           | alias=site1    |
Atihinen commented 3 years ago

Would the robot own WITH NAME work in this case? http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#setting-custom-name-to-test-library

asimell commented 2 years ago

You can also import REST without specifying the URL. In this case you just have to specify the full URL in the request. So essentially it means something like this

| GET | ${url_1}/route_1 |
| GET | ${url_1}/route_2 |
| GET | ${url_2}/route_1 |

And you can call multiple websites without having to worry about switching between instances.

Atihinen commented 2 years ago

We will close this issue as duplicate for #19 if this feature is needed please add your input to #19