I am planning to do an app that:
- has a user system (sign up, sign in, etc)
- the user creates (edit and delete) documents
- in those documents, the user edit data as a graph (and the whole edition process is the main goal of the app, with plenty logic by its own)
I made a wireframe of the edition process
(in this wireframe there are a lot of things that depend on the click, drag, double click and key press events)
And now I want to start coding the app with AngularJS, beginning with Integration testing
But should I test the most important points of the app (edition process) ignoring the user creation, login and creating documents? or should I wait to have all the required functionality in order to move to the core of the app in my TDD process?
@Felipe_Espinoza, the best time to start with TDD is now.
You’re in a great position to do some outside-in development. Start with a simple feature (“user logs in and sees their name”), and write the cucumber, turnip, or rspec test for the feature. Something like
As a user of the site
In order to access the app
I want to be able to log in
Given a signed-up user
When I go to the sign up page
And I enter my email
And I enter my password
And I click "Sign in"
Then I should be at the private home page
And the page should have my email
For most scenarios you won’t want to be as granular about signing in, but it’s nice to do this once for this case.
You’ll fail this test because you haven’t written the steps yet. That’s expected. You’ll write the steps one by one, and get a failing test after you create it. At certain points in this process, you’ll have to start doing some mroe fleshed out logic in models or controllers. Whenever you feel that the component you’re testing is messier (has more paths or conditionals) than the integration test is exposing, that’s a good time to move “inside” and do some unit testing. I find that my instinct takes me to do more unit testing, so I have to force myself to slow down and think about the feature I’m building as a whole and ensure I’m actually testing the feature and not just some interesting little unit piece of the whole.
@cpytel did an interview recently where (for a small part of the time) he discussed the bouncing between integration and unit specs, which is always something I’ve worried I wasn’t doing properly: http://t.co/JtYE0GcAIf
thanks for you answer @geoffharcourt
my question is more directed to focus and things you do during TDD
for example, in the TDD workshop from learn, they did a very rudimentary implementation of the login system in order to focus on the core of the App first instead of the details of the login functionality
I think I should do that, but in my case the core is more compount
User Login -> Create Document -> Edit Document Data (Core)
As for an AngularJS app I will write the e2e - integration tests with Jasmine and I will do unit testing when necessary or when I want to refine certain logic of the app