Realworld: Guidelines for tests as a Spec?

Created on 29 Apr 2017  ·  10Comments  ·  Source: gothinkster/realworld

I think that we should push for Tests in all implementations.
However a question arises, how and what do we exactly test?
I don't know if there are tools for writing framework/language agnostic tests but something like:

  assert.equal(ProfileName, 'Alon Bukai', 'Author name is correct');
discussion suggestion

All 10 comments

This is a great idea! Frankly, I'm wondering why we didn't do this sooner. Haha

The only concern is that we have to go back and add tests for the existing implementations after we come up with a spec.

@brwr I already explained why we didn't initially cover this in the spec

Couple things:

1) I think tests should be yes or no. We should make sure all codebases implement the same spec and that includes testing. Having some implementations with tests and some without will cause more problems than it's worth.

2) There is a difference between TDD and writing tests. TDD means writing tests before code. Whether the author does TDD is less important than writing tests.

  1. I actually disagree with this. I don't see how having tests/no tests across repo's will cause more problems for learners, as the core value prop of RealWorld is primarily the implementation details for each framework's app. Tests could be considered part of "implementation details", but again, I refer back the section in the spec that explains what that's not always a true statement.

Also, because of https://github.com/gothinkster/realworld/issues/65 + this issue + other similar requests, I'm writing up a philosophy document that I'm shooting to have done by EOD that should also help shed light on this.

  1. Is "TDD" actually not interchangeable with the word "tests"? (i.e. should I change the verbage in our docs/etc?) I thought I've seen others phrase it that way before, but I could be wrong

I don't think forcing TDD is necessary.
It is possible to have this spec be "extra credit" as you put it. But still have a spec which makes it easier to write tests. The hard part for me is really knowing how to test.
Ember does a lot of work for us by building test skeletons for us but what's inside? Not so sure.

@EricSimons TDD is test driven development.
Writing tests before writing any other code and then iterating towards passing tests.

Yeah, @anishkny's idea of having "extra credit" specs seems to be maturing like a fine wine as we hit more & more cases like this :) I'm going to noodle on how we could do this.

Re: TDD — is the way it's used in the spec right now makes sense, no?

Edit: yup, I needed to change some verbage in the spec :)

Just my 2 cents but I think the way it's worded here is perfect for realworld (other than using the term TDD when it's probably just referring to testing like mentioned above). If every repo sort of serves as a representative of that community I think that most people will be implementing some unit testing and if it's not there initially it would be a great contribution opportunity for the next developer. I don't think it needs to be required though.

FYI I just removed the improper TDD mentions in the spec 👍 Thanks for pointing that out folks!

We've agreed on a minimum testing spec with issue #90 so we can close this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EricSimons picture EricSimons  ·  6Comments

vladfaust picture vladfaust  ·  5Comments

LiesbethW picture LiesbethW  ·  3Comments

Julian-B90 picture Julian-B90  ·  5Comments

JackyChiu picture JackyChiu  ·  4Comments