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

Add ".headers" declaration that takes a Map for validation #345

Closed
sburkard opened this Issue Mar 14, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@sburkard

sburkard commented Mar 14, 2018

Currently one can validate headers by adding .header(name, value) declarations.

For building nice TestBehavior classes it would be great to have a .headers(Map<String, Object>) declaration.

It would allow something like this in a TestBehavior implementation:

    receive(action -> action.endpoint(jmsEndpoint)
            .payload(messageResource)
            .headers(headerMap)

The problem with the single header declaration is, that I cannot apply a variable number of them to the TestBehavior:

    receive(action -> action.endpoint(jmsEndpoint)
            .payload(messageResource)
            // fixed number of header checks
            .header(header1, value1)
            .header(header2, value2)

@svettwer svettwer added this to the SOMEDAY milestone Mar 14, 2018

@svettwer

This comment has been minimized.

Member

svettwer commented Mar 14, 2018

Hi!

Thank you for your input! Even with a fixed amount of headers, a header map could be useful, if you have to validate a lots of headers that are messing up your test step definition. A map could enhance readability of those test cases.

I'm also curious about your use case for variable amounts of headers.
So you have a test case where you get a variable amount of headers from somewhere in your test and you want to verify that all headers are transported to another system?

BR,
Sven

@sburkard

This comment has been minimized.

sburkard commented Mar 14, 2018

Hi Sven

Glad you like my suggestion.

Actually it is not a single test case but a TestBehavior that can be "configured" and reused in multiple testcases. I have built a processing system and got lots of end-to-end tests from business. They all share the same flow, but contain different input data and therefore have different results.

So I wrote some TestBehaviors - for example to consume and assert a resulting JMS message. Now I can just apply the Behaviors in each test case and "configure" them with different expectations.

Regards
Stephan

@svettwer

This comment has been minimized.

Member

svettwer commented Mar 14, 2018

Hi Stephan!

Ah! Now I see the TestBehavior 😄. Just overlooked it in your initial suggestion. My fault.
Thank you for the insight into your project. Really cool setup! I find it always interesting how people use Citrus. It provides valuable information on how Citrus should be developed to improve the user experience when writing tests.

BR,
Sven

@christophd christophd modified the milestones: SOMEDAY, v2.7.5 Apr 11, 2018

@christophd christophd closed this in 763db97 May 4, 2018

@christophd christophd removed the READY label May 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment