I am using Dropwizard and I want to unit test my DAO classes. I saw a bunch of examples online but they seem to be using DAOTestRule which I cannot find in 0.9.2 which is what we use here at work.
None of the blogs explain what is the replacement or why it was deprecated in the first place. The official documentation doesn't detail anything either. How can I go about testing my DAO and setting up an in-memory database for Dropwizard Testing?
See issue Can't find DAOTestRule.java at dropwizard-testing maven 1.0.5 version jar.
Answer
That's because it's only available in Dropwizard 1.1.x and later.
https://github.com/dropwizard/dropwizard/commits/master/dropwizard-testing/src/main/java/io/dropwizard/testing/junit/DAOTestRule.java
See also this issue. Looks like it was also back-ported to 1.0.6.
What is the alternative?
Update your DW version.
Related
So I can test code that uses a database using PHPUnit, I just installed the DbUnit extension using Composer, and I get the following message:
Package phpunit/dbunit is abandoned, you should avoid using it. No
replacement was suggested.
I've seen the issue on the extension being abandoned, and people talk of rolling your own database testing code, but they don't go into any more details. Is there a recommended way to test database code using PHPUnit, or does anyone know of any examples?
(I did open an issue and asked the author of PHPUnit this, but his reply was quick and to the point - "No, there is not.") :-/
Do we have any unit testing frameworks in Vapor?
I am looking dependencies/framework which will help to do the Unit testing some of my web services and methods in easyway.
I've tried following solutions.
http://seatoncode.com/unit-testing-vapor/
https://medium.com/#tullio.sebastiani/unit-testing-vapor-toolbox-v-1-0-1-projects-c59a056c3b9b#.qf0kl1pfo
Regarding testing frameworks, I'm quite happy with Apple's XCTest, but if you're looking for something different, I recommend Quick.
If you also want to test the front-end, there are several solutions out there, and choosing one, in my opinion, depends on what front-end framework you pick, if any.
Anyway, I see you found articles on how to configure Vapor for testing. In this post I do something similar, but also I made a template to create new apps already set for testing. You can find it here.
There are two main schools of thought for doing A/B (Split) Testing:
Javascript-based solutions such as Optimizely, Google Analytics Content Experiments.
Server-side solutions such as Django-AB, Splango, and django-lean. (Also, writing your own.)
My understanding is that Javascript-based solutions are spectacular for "which color button converts better," but not so great for switching out entire page layouts, and completely unworkable for trying out large functional changes such as the sequence of pages in a funnel.
That leads me towards a server-side solution. I'm not crazy about coding my own, and will do so only if there is no other option. I'm trying to add value by improving the core functionality of my site, not by creating a better split-testing framework.
The Django apps I've found for split testing are various mixtures of unmaintained, undocumented, documented incorrectly, and incompatible with Django 1.5. This surprises me, because the Django and Python communities seem to have a strong focus on good documentation. I'm also very surprised that none of the testing frameworks I've tried has been compatible with Django 1.5 -- is testing not as core a part of the philosophy in the Django/Python world as it is in Rails?
Here's what I've found:
Splango https://github.com/shimon/Splango -- Not compatible with Django 1.5 (although most compatibility bugs I found were trivial to fix). Largely un-touched since October 2010, except for a fix August 2012 which claims to make sure templates get included in the install. Since templates don't get included in the install when Splango is installed via PyPI, either the fix didn't work or didn't get submitted to PyPI. Documentation is largely accurate, but doesn't completely cover how to set up tests and get reports. It tells you how to configure the template to gather the data, but there appears to be additional steps required in the admin interface which are completely undocumented, and I'm not sure I've done them properly.
Django-lean. Original at https://bitbucket.org/akoha/django-lean has not been updated since July 2010. There is an apparently "blessed" fork at https://github.com/anandhenry2002/django-lean which has not been changed since May 2012, when it was copied over from the original. The original's documentation is incorrect in ways that make following the examples impossible. (Though you can probably muddle your way through, as I did.) The new version's documentation has formatting problems that make it difficult to read on github. (This appears to be because it's the unchanged documentation from the old project, and BitBucket syntax doesn't work on Github.) The django-lean Google Group has not had a message since July 2012.
django-mini-lean https://github.com/DanAncona/django-mini-lean -- Updated as recently as February 2013, but undocumented.
Leaner - https://bitbucket.org/brianjinwright/leaner -- Last updated July 2012, and no docs.
Django-AB -- Last updated May 2009. Is not a package, and can't be installed via PIP or PyPI. After placing the checkout in my django app folder (and renaming the folder to ab) and following the installation instructions, I get an error loading the template loader that I have not tracked down further.
So far Splango appears to be the winner, as I've actually been able to get it more-or-less working (by manually installing the templates, and then editing them to fix Django 1.5 incompatibilities).
Can anyone point me to anything I've missed?
You have missed this app : https://github.com/mixcloud/django-experiments + https://github.com/disqus/gargoyle/
And then there's waffle: http://waffle.readthedocs.org/
It's simple, updated, maintained, but not very feature rich, it doesn't have any analytics/reporting stuff integrated. But then again, google analytics or mixpanel type of service is better for this.
I first looked at Django-AB and that is almost what I wanted, but I couldn't get it to work either. After looking at django-experiments and deciding I didn't want to mess around with redis yet, I decided to roll my own. I've tried to package it up nicely and make it easy to use for the beginner. It's super basic.
https://github.com/crobertsbmw/RobertsAB
You can swap out entirely different page layouts with Google Analytics Experiments (their default experiment setup will redirect users to a different URL for each variation you have), although in general its much easier to interpret why something is more successful if you test smaller things against each other.
You are right that testing different funnels and user flows against each other using Google Analytics would require a lot of manual setup; although theoretically you could do it by swapping out different links and tracking your users with UTM campaigns.
For smaller A/B tests within the same page, I ended up using Google Analytics Experiments and writing a custom Django CMS plugin for adding a few variant options to a template, which queries the Google Analytics API and displays the correct variant using Javascript.
Is there any guidance on how to write modular Ember.js apps? I have seen Tom Dale's position on AMD here so I am not going to force fit AMD on to the framework (as some have attempted here). It appears that Ember internally uses bpm/spade. Is that a reasonable approach to modularize Ember apps too? Any samples using this approach?
P.S. The getbpm.org site seems to be down which makes it difficult to learn about it. There is a github page but it refers to the site for install instructions.
BPM in it's current form is no longer supported by the core team, but is community supported. The only build tools they are officially providing support for is rake-pipeline. However, BPM does still work and it works well (I still use it with my projects). For info on how to use it see this: https://github.com/ud3323/bpm/wiki/Using-BPM-with-Ember. You may want to use my fork of bpm too. I've merged in Joe West's support for a proxy middleware.
There is also community build tools for node.js called ember-runner which looks promising as well.
As for using rake-pipeline. Look at the AssetFile on the emberjs projects to see how must be configured using rake-pipeline and rake-pipeline-web-filters. Also, take a look at the answers to this question on StackOverflow (especially Yehuda's). You may also find this gist helpful as well.
Try Ember App Kit - maybe it would help you.
I have played a bit with Rails, so for me, creating a rails 3.2 app was the easiest way to achieve this. So if you don't mind using rails as a back-end, I this might suit you.
Perhaps ember-tools could help:
https://github.com/rpflorence/ember-tools
I am novice still I found yeoman and ember-generator useful. In future you might need to add tests , mock rest calls you can easily npm install sinonjs and npm install ic-ajax
So i've just had a pretty disappointing morning/weekend. It came in the form of setting up PHPUnit, Integrating Eclipse etc
Now i've just discovered that there's no straightforward way to test CodeIgniter 2.0 applications directly from PHPUnit.
I've spent a lot of time researching libraries (FooStack and CIUnit) but the development of these has ceased and aren't compatible with CI 2.0
Before I jump in the inlcuded 2.0 Unit Testing class I need to ask, have I missed out on any major developments around CI 2.0 and PHPUnit.
Any guidance greatly appreciated.
Thanks,
Conor
A quick note to anybody interested in this. Ellis Labs are currently baking support for PHPUnit in CodeIgniter Reactor. The next release should have it.. Ref: ellislab.com/forums/viewthread/187601
I found a few resources you may find useful.
A class written to integrate PHPunit and Codeigniter. Not a very interesting forum post, but it lead me to the next link.
http://codeigniter.com/forums/viewthread/70934/P60
However, the repository found in the link above doesn't look very active. This fork of it seems to be a little more active:
https://bitbucket.org/kenjis/my-ciunit