Code Monkey home page Code Monkey logo

hw-acceptance-unit-test-cycle's Introduction

Please refer to README.md in the git repo root directory.

hw-acceptance-unit-test-cycle's People

Contributors

kingdish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hw-acceptance-unit-test-cycle's Issues

orphaned migration

From Rose

I noticed when working on HW4 that there was an orphaned migration showing up
when I did a rake db:migrate:status.
Originally forked it to my repo, then cloned it to my c9
Went through the process again, and again this strange orphaned migration still showed up
(wanted to verify that it wasn't from something I did, although at that point I really hadn't done anything anyway!)

Correct me if I'm wrong, but I'm not sure that it's such a good idea to give this to students without fixing it. -- Or at least giving them a hint that they should perform a validation before beginning their work :~)

replace link to pastebin with inline features?

I think github formatting is preferable here ...

Feature: search for movies by director

  As a movie buff
  So that I can find movies with my favorite director
  I want to include and serach on director information in movies I enter

Background: movies in database

  Given the following movies exist:
  | title        | rating | director     | release_date |
  | Star Wars    | PG     | George Lucas |   1977-05-25 |
  | Blade Runner | PG     | Ridley Scott |   1982-06-25 |
  | Alien        | R      |              |   1979-05-25 |
  | THX-1138     | R      | George Lucas |   1971-03-11 |

Scenario: add director to existing movie
  When I go to the edit page for "Alien"
  And  I fill in "Director" with "Ridley Scott"
  And  I press "Update Movie Info"
  Then the director of "Alien" should be "Ridley Scott"

Scenario: find movie with same director
  Given I am on the details page for "Star Wars"
  When  I follow "Find Movies With Same Director"
  Then  I should be on the Similar Movies page for "Star Wars"
  And   I should see "THX-1138"
  But   I should not see "Blade Runner"

Scenario: can't find similar movies if we don't know director (sad path)
  Given I am on the details page for "Alien"
  Then  I should not see "Ridley Scott"
  When  I follow "Find Movies With Same Director"
  Then  I should be on the home page
  And   I should see "'Alien' has no director info"

zip files that cause grader exceptions

if the auto-grader is giving errors for your HW5 submission please drag and drop your zip file into a comment below

HusainJaffer, gpincheiraa, weiherj, nbartowski, siderio2 files result in this error:

Running student tests found in features/ spec/:

/home/ubuntu/.rvm/rubies/ruby-2.2.2/bin/ruby -S bundle exec cucumber  --profile default

/home/ubuntu/.rvm/rubies/ruby-2.2.2/bin/ruby -I/home/ubuntu/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib:/home/ubuntu/.rvm/gems/ruby-2.2.2/gems/rspec-support-3.3.0/lib /home/ubuntu/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed

nbartowski and zarak seem to have hit the perennial factory girl issue

nbartowski's file gives

  1) Movie finding movie list with same director as Star Wars should return list of movies with same director
     Failure/Error: @movie = FactoryGirl.create(:movie, :title => 'Star Wars',
     ActiveRecord::RecordNotUnique:
       SQLite3::ConstraintException: UNIQUE constraint failed: movies.id: INSERT INTO "movies" ("title", "rating", "release_date", "director", "id", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?)

  2) Movie finding movie list with same director as Star Wars should not return movies with a different director
     Failure/Error: @movie = FactoryGirl.create(:movie, :title => 'Star Wars',
     ActiveRecord::RecordNotUnique:
       SQLite3::ConstraintException: UNIQUE constraint failed: movies.id: INSERT INTO "movies" ("title", "rating", "release_date", "director", "id", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?)

zarak's file gives

FactoryGirl::DuplicateDefinitionError: Factory already registered: movie

i have not investigated any of these yet

Review how coverage is achieved

We should review the full process of achieving coverage in this assignment. #27 highlighted a potential shortcoming in the instructions.

I've been concerned for a long time that students are being asked to wrap a lot of code (that they didn't write) in tests. That's great as a legacy activity, but it's not labelled as such, and is potentially confusing in an assignment that's supposed to be about the acceptance unit test cycle - I'd be more comfortable if the tests for all existing functionality were in place and the students were focused on ensuring coverage for the code they were writing themselves?

Grader TEST database seems NOT to be empty!

Hi @tansaku, @bill-auger

In my development environment I checked the number of Movie records in both Development and Test databases as you can see here:

edagarfc:~/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes (master) $ RAILS_ENV=test rails c
Loading test environment (Rails 4.2.6)
2.3.0 :001 > Movie.count
   (0.3ms)  SELECT COUNT(*) FROM "movies"
 => 0 
2.3.0 :002 > exit
edagarfc:~/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes (master) $ RAILS_ENV=development rails c                        
Loading development environment (Rails 4.2.6)
2.3.0 :001 > Movie.count
   (0.1ms)  SELECT COUNT(*) FROM "movies"
 => 0 
2.3.0 :002 > exit

edagarfc:~/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes (master) $  

The I tried cucumber and rspec:

edagarfc:~/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes (master) $ cucumber
Using the default profile...
Feature: search for movies by director
  As a movie buff
  So that I can find movies with my favorite director
  I want to include and serach on director information in movies I enter

  Background: movies in database      # features/search_for_movies_by_director.feature:7
    Given the following movies exist: # features/step_definitions/movie_steps.rb:1
      | title        | rating | director     | release_date |
      | Star Wars    | PG     | George Lucas | 1977-05-25   |
      | Blade Runner | PG     | Ridley Scott | 1982-06-25   |
      | Alien        | R      |              | 1979-05-25   |
      | THX-1138     | R      | George Lucas | 1971-03-11   |

  Scenario: add director to existing movie                # features/search_for_movies_by_director.feature:16
    When I go to the edit page for "Alien"                # features/step_definitions/web_steps.rb:48
    And I fill in "Director" with "Ridley Scott"          # features/step_definitions/web_steps.rb:60
    And I press "Update Movie Info"                       # features/step_definitions/web_steps.rb:52
    Then the director of "Alien" should be "Ridley Scott" # features/step_definitions/movie_steps.rb:9

  Scenario: find movie with same director                       # features/search_for_movies_by_director.feature:22
    Given I am on the details page for "Star Wars"              # features/step_definitions/web_steps.rb:44
    When I follow "Find Movies With Same Director"              # features/step_definitions/web_steps.rb:56
    Then I should be on the Similar Movies page for "Star Wars" # features/step_definitions/web_steps.rb:230
    And I should see "THX-1138"                                 # features/step_definitions/web_steps.rb:105
    But I should not see "Blade Runner"                         # features/step_definitions/web_steps.rb:123

  Scenario: can't find similar movies if we don't know director (sad path) # features/search_for_movies_by_director.feature:29
    Given I am on the details page for "Alien"                             # features/step_definitions/web_steps.rb:44
    Then I should not see "Ridley Scott"                                   # features/step_definitions/web_steps.rb:123
    When I follow "Find Movies With Same Director"                         # features/step_definitions/web_steps.rb:56
    Then I should be on the home page                                      # features/step_definitions/web_steps.rb:230
    And I should see "'Alien' has no director info"                        # features/step_definitions/web_steps.rb:105

3 scenarios (3 passed)
17 steps (17 passed)
0m0.775s
Coverage report generated for Cucumber Features to /home/ubuntu/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes/coverage. 41 / 54 LOC (75.93%) covered.
edagarfc:~/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes (master) $ 
edagarfc:~/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes (master) $ rspec
.............

Finished in 0.21096 seconds (files took 2.74 seconds to load)
13 examples, 0 failures

Coverage report generated for Cucumber Features, RSpec to /home/ubuntu/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes/coverage. 54 / 54 LOC (100.0%) covered.
edagarfc:~/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes (master) $ 

Then when I submited the zip file for grading I got this:

----BEGIN RSPEC----
--------------------------------------------------------------------------------
/usr/share/rvm/rubies/ruby-2.2.2/bin/ruby -I/home/ubuntu/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.6.0/lib:/home/ubuntu/.rvm/gems/ruby-2.2.2/gems/rspec-support-3.6.0/lib /home/ubuntu/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.6.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
F......F.....

Failures:

  1) MoviesController#index renders index template
     Failure/Error: expect(assigns(:movies).count).to eq 3

       expected: 3
            got: 13

       (compared using ==)
     # ./spec/controllers/movies_controller_spec.rb:14:in `block (3 levels) in '

  2) MoviesController#search_directors when the current movie has a director renders search directors view
     Failure/Error: expect(Movie.count).to eq 3

       expected: 3
            got: 13

       (compared using ==)
     # ./spec/controllers/movies_controller_spec.rb:118:in `block (4 levels) in '

Finished in 0.10881 seconds (files took 2.02 seconds to load)
13 examples, 2 failures

Failed examples:

rspec ./spec/controllers/movies_controller_spec.rb:8 # MoviesController#index renders index template
rspec ./spec/controllers/movies_controller_spec.rb:115 # MoviesController#search_directors when the current movie has a director renders search directors view

Coverage report generated for Cucumber Features, RSpec to /home/ubuntu/rag/submissions/5522a22342656a7dd8965e34d077a07d/assignment4/2017-10-11-17-18-11/coverage. 54 / 54 LOC (100.0%) covered.

/usr/share/rvm/rubies/ruby-2.2.2/bin/ruby -S bundle exec cucumber  --profile default
/usr/share/rvm/rubies/ruby-2.2.2/bin/ruby -I/home/ubuntu/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.6.0/lib:/home/ubuntu/.rvm/gems/ruby-2.2.2/gems/rspec-support-3.6.0/lib /home/ubuntu/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.6.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed

---------------------------------------- 

rake db:migrate gives deprecation warning

bundle exec rake db:migrate RAILS_ENV=test
== 20111119180638 CreateMovies: migrating =====================================
-- create_table(:movies)
DEPRECATION WARNING: `#timestamps` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in up at /media/bill/9577fb3c-bcf8-4db2-af8c-35c54e354879/sync/code/moocs/saas/HW-ACCEPTANCE-UNIT-TEST-CYCLE/git/hw-acceptance-unit-test-cycle/rottenpotatoes/db/migrate/20111119180638_create_movies.rb:10)

grader buggy behavior for director (sad path)

i am confused about one of the grader specs for " Scenario: can't find similar movies if we don't know director (sad path)"

Then I should either be on the home page or the RottenPotatoes home page
  expected "/movies/director" to satisfy block (RSpec::Expectations::ExpectationNotMetError)
  ./features/step_definitions/saas_web_steps.rb:3:in `/^(?:|I )should either be on (.+) or (.+)$/'
  ./required_features/director.feature:33:in `Then I should either be on the home page or the RottenPotatoes home page'

nothing of this is mentioned on the homework spec - it literally says you can handle the sad path anyway you like but then the grader constrains implementation to the '/' route

  • there is a default route present in the skeleton that routes root to /movies (which has no effect because public/index.html is also present
  • this requires an extra redundant path in features/support/paths.rb to "the RottenPotatoes home page"
  • this also requires a switch for the 'by-director' path in features/support/paths.rb that returns a different URL when no director or else the 'by-director' page must be accessible at '/'
  • using '/' as an error page (or 'find-by-director' page) is not at all sensible and is encouraging poor design practice

now here the strange part ... after implementing those kludges above to compensate for this "RottenPotatoes home page" requirement - the grader spec then changes:

Then I should be on the Similar Movies page for "Alien"
And I should see "'Alien' has no director info"
expected to find text "'Alien' has no director info" in
    ".... Welcome aboard .... Set up a default route and remove public/index.html ....

i set the "Similar Movies" path to '/' in order to inject that failure above because the grader for this assignment and the previous one do not display any of the specs unless they fail and i can not find where these specs are defined - so troubleshooting has been tricky

related forum thread:
https://courses.edx.org/courses/course-v1:BerkeleyX+CS169.1x+3T2015SP/discussion/forum/i4x-edx-templates-course-Empty/threads/57806dfdd5dc30052a0001a8

Students can get 100/100 without any rspec tests

Updating this issue:
On the other hand, I have student doing very thorough testing, and not getting credit for some of their coverage (???).
See https://github.com/rosewcs345/YX-hw-acceptance-unit-test-cycle
and https://github.com/rosewcs345/MR-hw-acceptance-unit-test-cycle
for different sides of the same issue!!

#Instructions say:

Going one Cucumber step at a time, use RSpec to create the appropriate controller and model specs to drive the creation of the new controller and model methods.

However, I have some students who have no rspec tests at all who scored 100.

cucumber rake tasks missing

It seems we have to run rails generate cucumber:install in order to get the usual Rake tasks for Cucumber.

When asked to overwrite features/support/env.rb, choose no.

issues with coverage

@nbartowski said:

I lost 20 pts because my controller coverage was too low (88.89%; I think you required 90%). When I looked at my coverage, the only lines not included were a few in the index method, which I didn't write (i.e. I downloaded the class version of the homework from github). I was under the impression from the directions that we didn't need to write tests for the index method, and I didn't as this assignment ended up taking significantly more time than the previous four and I couldn't afford anymore time. So my suggestion I guess is either: lower the percentage coverage required for the controller in future offerings or include the index method in the list of additional methods to write unit tests for in the instructions. Also, it looked like you either got all 20 pts or none at all. Maybe there could be a formula for how many pts one gets, as I wrote unit tests for create, update, destroy, and the new method to find movies with the same director. I'm not worried about my score, so no need to do anything now, this is just feedback

split part 2 up by cucumber scenario

The first cucumber scenario does not involve any unit testing, and may leave the impression that all the acceptance tests can be completed with changes to just app code.

Perhaps we can split them out and highlight the different flow in each?

migration failing that was not in submission `uninitialized constant`

student report:

It seems the autograder tries (and fails) to migrate from a migration file that we didn't provide.
Though our cucumber tests are green and RSpec covers around 90%, we never receive higher than 0% for any submission.

here is an image of the error from EDX. The first line shows a class AddMoreMovies that throws an error. (Note that we did not submit the file "20120130161449_add_more_movies.rb", this was internal.)

/2018-10-22-14-46-17/db/migrate/20111119180638_create_movies.rb:10)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

uninitialized constant AddMoreMovies::Movie/home/ubuntu/rag/submissions/c2b7336d28e9341109bd03b1d041b544/assignment4

old rspec syntax in web_steps gives deprecation warnings

  Scenario: find movie with same director                       # features/movies.feature:22
    Given I am on the details page for "Star Wars"              # features/step_definitions/web_steps.rb:44
    When I follow "Find Movies With Same Director"              # features/step_definitions/web_steps.rb:56

DEPRECATION: Using should from rspec-expectations' old :should syntax without explicitly enabling the syntax is deprecated. Use the new :expect syntax or explicitly enable :should with config.expect_with(:rspec) { |c| c.syntax = :should } instead. Called from /home/ubuntu/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes/features/step_definitions/web_steps.rb:233:in `block in <top (required)>'.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.