Posts

Showing posts from April, 2015

What should we Unit Test

Unit tests should be done wisely(Note: I suggest reading my previous post about Mocks before this one)
It is easy to fall into the unit test biggest pitfall - dumb unit tests.
What is the recipe for a popular unit-test pitfall ? Assume unit tests are very importantTest everythingverify every method callGet 100% coverage Yes, the above is bad.
The most obvious problem you will find yourself struggling with will be failing tests regularily, and changing the tests to pass those failure points.
That is the direct opposite target we want to achieve from unit tests. Upgrading of a unit test happens, but it shouldn't happen too much unless you specifically changed code in order to change the business logic.
When a test fails, it should point to a problem with the code not with the test.



Why do we fall to this pitfall ? Because we: Create unfocused unit tests We test all the easy things instead of testing the important thingsWe test implementation instead of testing the business logic Let m…

Mocking in a mock-shell (oops... nut-shell)

Mocking is a term used to describe a wide array of types, which is inaccurate.
Well, now that everyone uses it as a general term, I assume it is ok to have one word to rule them all, but still, just for the sake of accuracy I will post here a short explanation.
When doing mocking today, we usually use a mocking framework eg: Mockito etc...
This framework allows the developer to mock an object for testing (or any other) purposes.

Why mock ? Why will we want to mock an object instead of using the original one ? Maybe the original one is very complex Maybe the original one demands resources we don't want to mess with Maybe using the original one can have a restriction on our code Other things...

So we want to use mocks.
What can we do with them ? Sometimes we want to construct an object which needs an other object in it's constructor's argument list, we will just mock that argument and send it to the constructor - quick and easy.
Sometimes we want to mock an object and make …

Mailing List Managers

Requirements Subscription form in my site which will collect emails and enable me to manage my mailing list with the following features: Will have a nice form which I can tweak and insert into my HTML code to collect emails in my siteHave multiple groups of emailsBlast emails to any specific group(Nice to Have) Will read RSS and send emails upon update of RSSWill be able to drip emails for each subscriber according to the time on my listUser management (add / delete/ import / export etc)(Nice to Have) eMail templates(Nice to have) Nice backend GUI

Main Obstacle Email provider might block me as a spammer
This obstacle can be worked around by having a good scheduling dripper etc (but this is only a partial solution).
Best solution is to have a provider (costs money) which will white list and drip the emails using the best intervals.

Paid solutionsaWeber - quite expensive, might be good for very large lists MailChimp - Free for first 2000 subscribers (but some features are disabled) MadMim…