Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Planning issue: expand test coverage with more thorough testing #304

Closed
SidharthBansal opened this issue Jan 26, 2019 · 8 comments
Closed

Comments

@SidharthBansal
Copy link
Member

SidharthBansal commented Jan 26, 2019

Mapknitter repository requires a lot of unit tests, integration tests, fixtures and functional tests for each MVC pattern present in the repo along with routes explorations.
So @jywarren we can discuss testing in this issue.
Refer #300

@grvsachdeva grvsachdeva changed the title Planning issue: TDD Planning issue: Test Driven Development Jan 26, 2019
@SidharthBansal
Copy link
Member Author

SidharthBansal commented Jan 27, 2019

Pasting from @jywarren 's suggestions

  • compile list of routes/URLs to build functional tests around
  • vastly expand unit tests
  • move lots into models for unit testing
  • get CI running
  • functional test image creation, updates
  • expand fixtures
  • Test coverage

@jywarren
Copy link
Member

Big start to testing here: #313

@jywarren
Copy link
Member

I think for the unit and functional tests, the process could be:

  • look at the source file (in /app/models/ or /app/controllers/)
  • identify a method that does not have a corresponding test in /test/unit/ (for models) or /test/functional/ (for controllers)
  • create a test following the example of existing tests
  • add a basic assertion -- assert_response :success for functional tests, or assert_not_nil Map.last.function for a unit test (where map is the name of the model and function is the name of the function you want to test. Some may require parameters!

How does this sound? This can get us a long way there.

Coverage tracking

We could also add a coverage badge using Coveralls or another service, like CodeClimate.

CodeClimate actually gives MapKnitter a decent score!

https://codeclimate.com/github/publiclab/mapknitter

Code "smells": https://codeclimate.com/github/publiclab/mapknitter/issues?category=complexity&engine_name%5B%5D=structure&engine_name%5B%5D=duplication

@jywarren jywarren changed the title Planning issue: Test Driven Development Planning issue: expand test coverage with more thorough testing Jan 29, 2019
@jywarren
Copy link
Member

jywarren commented Feb 1, 2019

Ok, #313 was good! I'm getting coveralls installed in #306 but a bit stuck there. Once it's merged we'll be able to see test coverage in coveralls.

@jywarren
Copy link
Member

jywarren commented Feb 8, 2019

Just chiming in that this ended up being a really good self contained update which built out node, warpable fixtures and added decent warpable unit tests! It's a good reference for further work of this kind.

https://github.com/publiclab/mapknitter/pull/331/files

@jywarren
Copy link
Member

https://coveralls.io/github/publiclab/mapknitter working!!!! Thanks @kaunair !!!

@jywarren
Copy link
Member

Lots of progress to be made here... many areas are very low coverage, esp. controllers!

@kaustubh-nair
Copy link
Member

Do we intend to change our testing framework to RSpec?
If we want to do it I think now is the best time - before our test suite becomes too large to migrate
Thoughts? @jywarren

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants