Skip to content

Improved test syntax with fluent API#8

Merged
stephpy merged 11 commits intoatoum:masterfrom
jubianchi:custom-asserters
Jan 6, 2013
Merged

Improved test syntax with fluent API#8
stephpy merged 11 commits intoatoum:masterfrom
jubianchi:custom-asserters

Conversation

@jubianchi
Copy link
Member

@stephpy
Copy link
Member

stephpy commented Dec 17, 2012

👍

Uses of a library like guzzle would be great.

@FlorianLB
Copy link
Member

Yeah ! I use something like that in my pro projects but without the fluent interface.

Why Guzzle ? Symfony crawler is quite good for testing API.

@stephpy
Copy link
Member

stephpy commented Dec 17, 2012

@FlorianLB you are right, let's stay on symfony context, i used guzzle and i found this library very useful but crawler will be sufficient.

@jubianchi
Copy link
Member Author

The crawler could also be abstracted to let the end user choose which one he wants to use.

@stephpy
Copy link
Member

stephpy commented Dec 18, 2012

👍 @jubianchi

@ludofleury
Copy link
Contributor

This is really nice. Since it's a Symfony bundle, the hard requirement of the Symfony crawler is okay. Yet we could enhance this later with an Interface Requirement or something like that :)

Good job.

@jubianchi
Copy link
Member Author

I added a gist (https://gist.github.com/4336789) where I'll put updated examples while I'm working on this PR.

@jubianchi
Copy link
Member Author

I updated the gist linked in my previous comment with some cool stuff.

As I did in another PR on atoum (atoum/atoum#151), I had to rely on an end keyword to trigger assertions. I am not a big fan of this but it's really difficult to avoid using something like this and keep the navigation in the DOM tree easy.

At the moment, I don't know how to do things without this keyword. In some cases, the end keyword can be omitted but, again, I don't like this because it breaks an atoum's principle : intuitive.

What do you think of this end thing ?

Another thing that can be omitted : you can avoid typing the exactly assertion if you expect to find only one element.

@stephpy
Copy link
Member

stephpy commented Dec 20, 2012

IMO end keyworld should not be a problem ... It looks like a tree, end is useful for us and for user to easily see which node is related.

Awesome work @jubianchi ;)

@FlorianLB
Copy link
Member

There is a BC ($kernel in Test\Units\WebTestCase) but i guess we can deal with it with a tag.

Nice job, ready to merge ?

@jubianchi
Copy link
Member Author

@FlorianLB I think it's good to merge but it's missing an asserter on the headers.
I'll write it ASAP.

By the way, if you want to merge this as is, ou can but I think it would be better to give it a try by checking ou the branch locally and using it in some tests.

and a review of the code would also be really nice too ;)

@jubianchi
Copy link
Member Author

My previous comment is wrong : after reviewing my commit I saw I already wrote the missing headers asserter.

Sorry, I'm a bit confused as I'm tired and sick :s

@stephpy
Copy link
Member

stephpy commented Jan 5, 2013

Awesome work ! 👍

@FlorianLB
Copy link
Member

I did some review/tests, looks fine. It can be improved to be extend more easily (add new HTTP verbs, use a custom response asserter, etc) but can be done in a second time.

I will try to add some docs tonight.

Go merge ?

@jubianchi
Copy link
Member Author

ok go :)

@stephpy
Copy link
Member

stephpy commented Jan 6, 2013

Let's go \o/

stephpy added a commit that referenced this pull request Jan 6, 2013
Improved test syntax with fluent API
@stephpy stephpy merged commit cfef991 into atoum:master Jan 6, 2013
@stephpy
Copy link
Member

stephpy commented Jan 6, 2013

Thank you @jubianchi ;)

@Swop
Copy link

Swop commented Jan 6, 2013

Nice work ;-)

@gyndav
Copy link

gyndav commented Jan 7, 2013

Nice one @jubianchi

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants