Is testing features enough? [closed] - ruby-on-rails

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
The title says it all, if I test using capybara :
visit this page
expect this content
and do this for every single feature(e.g signin, signup, search, clicking all the links and buttons, etc), would that be enough? Why would I need to test controllers and models? If features are working as expected, doesn't that mean everything is working in harmony?

That technique is called black box testing also know as functional testing. If you are testing as if you are a user of the application it is considered black box. If you are testing it from within it is considered glass box testing.
The question of whether or not is it enough is a matter of personal opinion. My opinion is if it is thorough enough then yes it could be enough.
Some of the advantages of black-box testing include:
You have a good chance of writing tests that weren’t imagined by the programmer.
The environment the program is running is also tested
The invested effort can be used multiple times
Some advantages of glass-box testing include:
It forces you to reason carefully about implementation.
Spots the Dead Code or other issues with respect to best programming practices.
Reveals errors in hidden code.

Related

Front end development best practices [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I want to build a web application. I'm wondering how I can find the best practices for front end development.
Although this is a general question.And Full answer to this question should be a big article that i will not be able to add in answer.But i can include some information that is useful.There will be lot of Information available on Web to learn and do best practice for Front end developer.Most of best practice you will learn by following blogs and by your own practice.
Few Tips that i would add are below.
Correct Syntax Makes Beautiful Code
Testing Your Site in Different Resolutions of screen size Desktop and Mobile
Test site using different Environments and browsers
Think about Future usability of the Site
Try to make it more responsive,fast and User friendly
Here are few Helpful Articles
http://www.sitepoint.com/20-docs-guides-front-end-developers/
http://taitems.github.io/Front-End-Development-Guidelines/
http://www.catswhocode.com/blog/top-10-best-practices-for-front-end-web-developers

Making an imageboard with Rails, what controllers to add? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am making my first RoR application and I am a bit confused with planning it out ahead of time.
It will be an anonymous imageboard (like 4chan) where people can make threads across multiple boards and attach images to their posts. They won't need to register and can post anonymously.
Now I am not sure how to implement it, I am guessing there has to be an admin user who will be able to create new boards and delete threads, right? So far I have planned the following controllers:
PostsController
UsersController (can I define the admin user here or should I make a separate controller?)
ThreadsController
BoardsController
Does this seem okay to you?
Thank you for your time.
Planning ahead of time for everything you will need goes against what Ruby on Rails philosophy is to begin with. Ruby on Rails firmly believes in Test Driven Development or TDD.
In that sense, the tests will actually drive your design, starting from unit tests all the way to functional testing. I.e. don't try to anticipate all controller/models from the start. Try to use TDD to let you help design the system, it is a good practice and if you don't know 100% the path you want to follow, it will help you somewhat make your system a bit more robust because of the test harness.
Try to follow this before you start your application. Good luck.
http://guides.rubyonrails.org/testing.html

Do BDD/ATDD stories replace the need for traditional requirements? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
From what I can tell from online forums and posts, one of the main focuses of BDD/ATDD seems to be on discussion and ensuring that the customer, developers, testers and other relevant parties are involved in the understanding what the system must do.
Question 1: Do BDD/ATDD stories replace the need for traditional requirement specifications, such as the those captured using the Volere Template?
Because the traditional requirement specifications are one of the key inputs for developers and testers, traditional requirement specifications tend to be comprehensive.
Question 2: Should BDD/ATDD stories also be comprehensive enough to allow a system to be fully tested?
Question 1: Instead of looking at this question as a black-and-white situation, we should better understand how these two requirements capture methods get along with each other. Writing a story in the BDD/ATDD methodologies, or in Scrum for example, does not imply removing the templates like volere off the table. If we take a look at the volere requirements specification here, we can see that most of the information regards to project-related issues, and the shell used for functional requirements is far from being different to a story. They just have different information, not exclusive one.
Question 2: Here we have the advantage coming from the methodology itself. BDD comes from TDD, we can more or less rely on the test-first oriented process to allow the team to test the system. But, as I mentioned in question 1, making a BDD/ATDD story more comprehensive is not a sin, and wouldn't compromise the general idea of the story. This would also prove useful when interacting with more experienced clients.

Buggy Rails app: test or refactor? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
This app had virtually no tests in place when we came to it and now there are cucumber tests covering the most essential parts. We are not sure if the app is working correctly and have had many disasters happen over the course of development, most of them caused by bugs that were never discovered. The code is quite ugly in places with models generating HTML and PHP-itis in the views. There are many extraneous models and controllers that could be greatly simplified or eliminated. My question is, when is it better to simply refactor code without testing previous functionality? Due to deadline constraints, it's very hard to justify spending time on covering all the existing code with tests when we know it's bad and could be easily eliminated.
I'm gonna guess this is a client project. My approach would be to write Cucumber tests to cover the behavior of the project only, and then write RSpec implementation tests that cover the new code you'll be writing.
Get the client to sign off on the behavior tests, this way, when you start changing the implementation, you can be sure you haven't drastically modified the behavior of the app. Then, write the tests for the code you wish you had, and refactor until the tests are all green.

What is a good way to do a light unit-testing in an Rails web application? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I am on a tight timeline with minimum resources for a project.
I would like to practice test driven development for this project, but realistically, i would not have time to learn any of the more sophisticated frameworks like Cucumber, Rspec, etc. And it would probably be counter-productive at this point anyway
What do you recommend is the minimum I do?
If you are very short on time, your best bet would be to read through the rails guide on testing. It equips you to get started quickly with Test:Unit.
Then you could write unit tests for the (model) methods that you care most about - things most critical to your app.
Optional suggestion - Rails testing is a landscape full of controversies and debates. If you want to save time, get started with (any) one thing (Test:Unit/shoulda/rspec...fixture/factory ..etc) and leave the discussions for leisure.
You might want to give Shoulda a try.
Test Unit is baked into rails and is pretty easy to use if you have any background with unit testing.

Resources