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

Functional tests #20

Open
alechenninger opened this issue Aug 2, 2014 · 4 comments
Open

Functional tests #20

alechenninger opened this issue Aug 2, 2014 · 4 comments
Assignees

Comments

@alechenninger
Copy link
Member

I'm not incredibly happy with the unit tests.

Besides that many had to just be eliminated due to refactorings and have not yet been replaced, I think we need functional tests too. This can present edge cases more naturally and actually catch real bugs before they are found by real users.

Need...

  • Decide on a WebDriver implementation to test against. Many of them? Firefox? PhantomJS? HTMLUnit?
  • Configuration to run real browsers - Travis can integrate with SauceLabs.
  • Test pages
  • Code abstractions for accessing these test resources, starting and closing browsers
  • The tests
@alechenninger
Copy link
Member Author

It would be a lot easier to practice TDD / BDD this way too. Think of a scenario that needs help? Write some example html and js, write the test, make it pass.

@alechenninger
Copy link
Member Author

Could actually write tests in darcy-web and then whatever implemented darcy-web could run those tests against itself!

@alechenninger alechenninger self-assigned this Aug 3, 2014
@spyrkob
Copy link

spyrkob commented Nov 20, 2014

Hey, I came up with this spykob@dea581ec0ca51afe920674d571a8692d530db525 to start up embedded Jetty and run a test against it.

It should be easy to abstract the browser creation so that the tests can be shared - but I wonder where should the test cases live.
If they are in darcy-web test directory, they won't be bundled in the project jar and implementing modules won't have access to them.
On the other hand putting them in src/main doesn't feel right.
Maybe a new module for the abstract tests?

@alechenninger
Copy link
Member Author

@spyrkob I extracted out the @Rule bits to their own library since I couldn't find anything like this for serving static content: https://github.com/alechenninger/httpserverrule

WireMock is kinda like this, maybe it would be better to extend that to allow it to serve a directory, but I didn't have much luck going down that route. Especially since as you can see doing it like this is really simple.

One of the things I did was allow for a server to be reused across tests and not shutdown until JVM exit. I think I might refactor how this is done a bit but, it works.

As far as darcy specific test support, I agree we need another module like, darcy-web-test or something of the sort. However I think for most things using the @Rule will be fine. I've been thinking I'm less into functional tests for the darcy-webdriver library, because we start duplicating a lot of the WebDriver tests. We're relying on WebDriver to "just work." So I don't want to be testing too much of that. However, stuff like JQueryDataTable abstraction in darcy-web: that could use an integration test with an actual jQuery DataTable to make sure the abstraction is accurate.

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

No branches or pull requests

2 participants