Testing Explained

At Rails Girls we like to talk about tests. In fact, pretty much all Rails developers like to talk about tests! Why is this? Well, we understand how important they are to making your code as robust and error-free as possible. But we also understand how confusing they can be..there seems to be so many different types of tests. We believe most things in Ruby on Rails are only confusing because they haven’t been explained properly. In this post we are going to very simply explain tests. Once you understand what they are, the syntax isn’t really that hard..trust us!

Unit Tests

These tests are generally very quick and precise. They test at the method level and they generally test one single thing. An example might be testing that a specific data attribute has a valid value. A good rule of thumb is that whenever you add any new feature you write a unit test for it.

Integration Tests

These start one layer up from our unit tests and they test the underlying services. They are fantastic at telling you when something is broken, however they are not as precise as unit tests in telling us exactly what is broken. A perfect example of an Integration Test would be the testing of a valid and invalid login or perhaps connectivity to your database. The idea here is to flag when something is wrong rather than the low level of detail that unit tests can give us.

User Interface Tests

These tests are our end to end tests. They test the whole system and how it connects together with the UI. And in that sense they are fab. It can be tempting to think all testing should be UI tests but this is not the case. UI tests are very slow and therefore considered expensive. They can also be flaky which means that if something changes on the UI, even if it is just a new field, it could ‘break’ your tests. Don’t get us wrong, they are necessary and they have many benefits but use them sparingly.

Now we know we have covered a lot in one post but we will chip away at each type of test over time. So if you take just one thing from this post let it be this: when it comes to testing your app try to cover as much as possible with unit tests 🙂

Sorcha & Rachelle

43 thoughts on “Testing Explained

  1. Dannyedulp says:

    BTC may be the latest or last chance to get rich in this era. It will reach $200000 next year or the next year.

    Think about only $2 a few years ago. Come to the world’s largest and safest virtual currency exchange to reduce the handling fee. Don’t miss the most important opportunity in life

    https://hi.switchy.io/5dyf

  2. Thomas Wood says:

    It’s perfect time to make a few plans for the longer term and it is time to be happy.

    I have learn this put up and if I may I want to recommend
    you few attention-grabbing things or advice. Perhaps you can write next articles relating to this article.
    I desire to read even more things about it!

  3. Linda Morris says:

    I’ve been browsing online more than 2 hours today, yet I never found any interesting article like yours.

    It is pretty worth enough for me. Personally, if all site owners
    and bloggers made good content as you did, the web will be
    much more useful than ever before.

  4. Olga Dietle says:

    I’ll right away seize your rss feed as I can’t to find your e-mail subscription link or newsletter service.
    Do you’ve any? Kindly let me realize in order that I could
    subscribe. Thanks.

  5. 카지노사이트 says:

    Some genuinely quality posts on this web site , saved to my bookmarks.
    Usually I don’t read article on blogs, however I would like to say that this write-up very pressured me to take a look at and do so! Your writing style has been amazed me. Thank you, quite great post.please click my name above and try to visit guys~

  6. https://brx.pp.ua says:

    Woah! I’m really loving the template/theme of this website.
    It’s simple, yet effective. A lot of times it’s very difficult to get
    that “perfect balance” between user friendliness and visual appearance.
    I must say that you’ve done a awesome job with this.

    Additionally, the blog loads very quick for me on Internet explorer.
    Exceptional Blog!

  7. http://24hd.pp.ua says:

    Oh my goodness! Awesome article dude! Thank you, However I am going through
    issues with your RSS. I don’t understand the reason why I cannot subscribe to it.

    Is there anyone else having the same RSS issues?
    Anyone who knows the answer will you kindly respond? Thanks!!

  8. Michelle Carter says:

    Terrific article! This is the kind of information that should be shared
    around the internet. Shame on Google for no longer
    positioning this submit higher! Come on over and discuss
    with my site . Thank you =)

  9. https://sutkilux.blogspot.com says:

    Fɑntastic items from you, man. I have take іnto accout your stuff prior to and you
    are simply extremely magnificent. I actually
    like what you’ve received right here, гeally ⅼike wһаt you are stating and tһe way by which yoս say it.
    Ⲩou’re making it entertaining and you still take ϲare of to keеp it smart.
    I can not wait to rеad far more from you. This is actually a wonderful site.

    Feel free to surf to my page :: https://sutkilux.blogspot.com

  10. sutkilux.blogspot.com says:

    Riցht here is thе perfect website for everyone who would like tο find out about
    this topic. You realize a whоle lot its almost tough
    to argue with you (not that I really wilⅼ need
    to…HaHa). You certainly put a brand new spin on a topіc that has been discussed
    for years. Excellent stuff, just exсellent!

    my website – sutkilux.blogspot.com

  11. Joya Mcdowell says:

    I’ll immediately clutch your rss as I can not find your
    email subscription link or newsletter service. Do you have any?
    Kindly let me recognize so that I could subscribe. Thanks.

  12. Elvin Ratzlaff says:

    I have been browsing online more than 3 hours today, yet I never found any interesting article like yours.

    It is pretty worth enough for me. Personally, if all site owners and bloggers made good content as you did,
    the net will be a lot more useful than ever before.

  13. George Paul says:

    Pretty great post. I simply stumbled upon your blog and wanted to mention that I have truly loved browsing your blog posts. In any case I’ll be subscribing on your rss feed and I’m hoping you write again soon!

Leave a Reply to Linda Morris Cancel reply

Your email address will not be published. Required fields are marked *