Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use a runtime variable as part of request path #41

Open
Allblues opened this issue Mar 25, 2013 · 5 comments
Open

Can't use a runtime variable as part of request path #41

Allblues opened this issue Mar 25, 2013 · 5 comments

Comments

@Allblues
Copy link

I love how easy it is to use restfuse, but with the annotation-based approach, I don't see a way to use a variable I set at runtime as a segment in a rest request. For example, I want to perform this workflow:

  1. Make a query call that returns a set of entity ids.
  2. Save one of the ids from that call in an instance variable.
  3. Make a "get entity by id" call that uses my variable as part of the URL. For example:
    @httptest( method = Method.GET, path = "/entity/Candidate/{id}" )

The {id} segment would resolve to the variable I set at runtime, but it can't since the annotation gets read at compile time.

This is easy to do in SoapUI, but I'm looking at lighter weight tools like restfuse.

@drejc
Copy link

drejc commented Mar 25, 2013

Yes, with the annotation approach you can not make calls that are
dynamically resolved while running tests.
Annotations are resolved on compile time and are static when running / this
is a Java limitation.

regards
Drejc

On Mon, Mar 25, 2013 at 12:45 PM, Allblues [email protected] wrote:

I love how easy it is to use restfuse, but with the annotation-based
approach, I don't see a way to use a variable I set at runtime as a segment
in a rest request. For example, I want to perform this workflow:

  1. Make a query call that returns a set of entity ids.
  2. Save one of the ids from that call in an instance variable.
  3. Make a "get entity by id" call that uses my variable as part of the
    URL. For example:
    @httptest( method = Method.GET, path = "/entity/Candidate/{id}" )

The {id} segment would resolve to the variable I set at runtime, but it
can't since the annotation gets read at compile time.

This is easy to do in SoapUI, but I'm looking at lighter weight tools like
restfuse.


Reply to this email directly or view it on GitHubhttps://github.com//issues/41
.

@gionn
Copy link

gionn commented Apr 19, 2013

+1

Without some sort of runtime generation paths, it's actually impossible to test creation and deletion of the same resource (that is common when doing integration tests).

@vrspider
Copy link

+1
So no other work around about this issue?
@gionn I wondered how did you manage to test the creation and deletion of the same resource later on ?

@Allblues
Copy link
Author

You should try Rest Assured. Been using if for quite some time now and love it.

@gionn
Copy link

gionn commented Feb 28, 2014

@vrspider 11 months after we are using a simple REST client built on top of Apache HTTPClient (https://github.com/ClouDesire/tisana4j) for our integration tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants