Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Web applications - Server vs Client Side Testing

 
Ranch Hand
Posts: 54
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a web application that I want to test(I know, I put TDD junkies to shame, I'm working on it). It has an AngularJS front end with a Struts2 backend. The AngularJs code communicates with the Struts2 code via REST calls. After mulling it over, I realized that whaterver happens in the backend doesn't matter as long as I recieve the proper data back from the REST calls on the frontend. Therefore, I realized that I could just use "Black Box" testing and only write the JS tests. What is your opinion of this decision?
 
Sheriff
Posts: 16946
286
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The expression "Putting somebody or something to shame" means to be so much better at something that it makes the other party ashamed of how poorly they do that same thing compared to you. It doesn't seem like that's what you meant though.

Test running on the front end should test only the front end. If you're checking that the front end actually makes proper REST calls then run JS tests. If the check is for proper display of returned data, run JS tests. If you're testing whether a REST call is properly parsed and processed, test on the backend.

In my opinion, JS testing should be far less than backend testing. If you do mostly JS testing even for things you shouldn't test with JS, then proper backend testing will put you to shame.
 
William Ng
Ranch Hand
Posts: 54
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now that I think about it and after reading your response, I believe back end testing is the way to go, with some basic JS testing. My theory was that testing JS would also test the back end and it probably would. But why not just test the backend directly. And like you seem to suggest, backend is probably more effective.

Regarding the use of "putting to shame". I did indeed use it incorrectly. Thanks for the correction. Should have tested my question?

Thanks for the response.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Read as much as you can on the uses, advantages, and downsides of both methods and make the right choice.
And I agree with your method,stick to black-box testing and test only public methods.Whenever a public behavior is checked, the private implementation is also implicitly tested and your tests will break only if there is a certain problem.
 
Good heavens! What have you done! Here, try to fix it with this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic