=================================== Day 8: Thursday, January 30th, 2014 =================================== 0. Read the links from :doc:`day7`: http://www.fastcompany.com/28121/they-write-right-stuff and http://www.infoworld.com/print/15243; skim http://calleam.com/WTPF/?page_id=2086 1. `Quiz `__ and discussion. 2. Lecture on code coverage and code paths: `presentation `__ 3. Code review and code coverage of hw3 I'm happy to help with any git problems you have, also. Computing and displaying code coverage stats ============================================ First, activate your virtualenv (see :doc:`virtualenv`). Then install `coverage `__:: pip install -U coverage (You may want to reactivate your virtualenv after installing this; I've had some path problems.) Next, grab some code to run it on -- let's use the 'hw2-solutions' branch from https://github.com/ctb/cse491-serverz. :: mkdir ~/cse491 cd ~/cse491 git clone https://github.com/ctb/cse491-serverz.git -b hw2-solutions day8 Run the tests with code coverage enabled:: cd day8 nosetests --with-coverage Generate HTML output of your code coverage:: coverage html which will put it in the directory 'htmlcov', and then post it to your arctic Web site:: mkdir ~/web/ cp -r htmlcov ~/web/day8-htmlcov chmod -R a+rx ~/web/ Now go to http://www.cse.msu.edu/~$username/day8-htmlcov/ to look at the code coverage report -- mine is here: http://www.cse.msu.edu/~ctb/day8-htmlcov/ If you look at 'server.py', you'll see some covered stuff (green) and some uncovered stuff (red): http://www.cse.msu.edu/~ctb/day8-htmlcov/server.html Why? Can you think of any way to "cover" the red stuff in the tests? Things to try ------------- Run code coverage on your own hw3. What did you fail to test in server.py? Deactivate some of your tests by putting a 'return' right after the start of the function. Does the code coverage change in the expected way? Do a review of someone else's hw3, and either make comments on their pull request or on their code directly (by checking it out locally). Note, you can grab someone's code by doing something like this, in an existing repo:: git fetch https://github.com/ctb/cse491-serverz hw3 ctb-hw3 git checkout ctb-hw3 If you make changes, comments, etc. then you can share them by first committing them, and then doing:: git push origin ctb-hw3:ctb-hw3 and setting up a pull request between YOUR copy of their branch (here, ctb-hw3 in your github repo) and THEIR hw3 branch. If you use coverage analysis during your review, you might be able to find untested logic -- and there might be bugs in there, too. Try writing a test that breaks their code (or at least covers it). Code review checklist ~~~~~~~~~~~~~~~~~~~~~ Basic rules: 0. Does it run. 1. Do tests pass. 2. Spaces rather than tabs. 3. Spaces after #. 4. Properly spelled variable names . 5. Try writing tests to break something. For example, do you believe their POST logic? 6. 80 character line lengths. 7. Test with multiple browsers. 8. Use code coverage to find things that their tests don't test, and see if you can break their code. List of repositories ==================== massiek: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ eunbong: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ matheusldaraujo: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ ConnorAvery: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ jprickles: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ jkteuber: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ beckhamer: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ john3209: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ mill1256: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ YourBestFriend: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ hoffm386: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ joshshadik: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ msweet18: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ juru13: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ mcdonaldca: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ filajust: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ leflerja: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ FireSBurnsmuP: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ koppmana: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ Karmeow: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ curljosh: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ yispencer: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ glisto18: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ mannin92: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ westjour: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ jbull477: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ fakestuff: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ msu-web-dev: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ MaxwellGBrown: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ xavierdhjr: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ ettemaet: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ lieblic2: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ bjurgess1: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ suhkang: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ jonest31: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ tsloncz: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ zhopping: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ MattyAyOh: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ o2themar: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ phammin1: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ Badsauce: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ DuncanCYoung: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ cameronkeif: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ majeedus: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ polavar3: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ brtaylor92: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ labrenzm: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ QSSS: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ sarteleb: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ JRucinski: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__ fenderic: `github site `__ - `pulls `__ - `branches `__ - `repo URL for cloning `__