{"action":"created","issue":{"url":"https://api.github.com/repos/datacamp/testwhat/issues/25","repository_url":"https://api.github.com/repos/datacamp/testwhat","labels_url":"https://api.github.com/repos/datacamp/testwhat/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/datacamp/testwhat/issues/25/comments","events_url":"https://api.github.com/repos/datacamp/testwhat/issues/25/events","html_url":"https://github.com/datacamp/testwhat/issues/25","id":155610422,"number":25,"title":"How to test code that intentionally throws errors?","user":{"login":"ncarchedi","id":4229089,"avatar_url":"https://avatars.githubusercontent.com/u/4229089?v=3","gravatar_id":"","url":"https://api.github.com/users/ncarchedi","html_url":"https://github.com/ncarchedi","followers_url":"https://api.github.com/users/ncarchedi/followers","following_url":"https://api.github.com/users/ncarchedi/following{/other_user}","gists_url":"https://api.github.com/users/ncarchedi/gists{/gist_id}","starred_url":"https://api.github.com/users/ncarchedi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncarchedi/subscriptions","organizations_url":"https://api.github.com/users/ncarchedi/orgs","repos_url":"https://api.github.com/users/ncarchedi/repos","events_url":"https://api.github.com/users/ncarchedi/events{/privacy}","received_events_url":"https://api.github.com/users/ncarchedi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/datacamp/testwhat/labels/feature","name":"feature","color":"0e8a16"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-18T21:53:43Z","updated_at":"2016-06-16T14:44:24Z","closed_at":null,"body":"I don't know how often this will be the case in the future, but certain parts of the R Functions course that Hadley and Charlotte are working on require the student to write functions that fail on certain conditions, then call their functions to check that they fail as intended. In other words, the purpose of the exercise is to cause an error.\r\n\r\nThis obviously doesn't play well with our current testing system since the solution code causes an error, so we've been commenting out the parts of these solution scripts that actually call the failing function and instead just ask the student to uncomment the code in the sample script. I think this is fine for now, but it may be a bit unnatural/confusing to students and I'm wondering if there's a better way.\r\n\r\nHere are some examples:\r\nhttps://campus.datacamp.com/courses/1008/2228?ex=2\r\nhttps://campus.datacamp.com/courses/1008/2228?ex=3\r\nhttps://campus.datacamp.com/courses/1008/2228?ex=9"},"comment":{"url":"https://api.github.com/repos/datacamp/testwhat/issues/comments/226506876","html_url":"https://github.com/datacamp/testwhat/issues/25#issuecomment-226506876","issue_url":"https://api.github.com/repos/datacamp/testwhat/issues/25","id":226506876,"user":{"login":"filipsch","id":5768479,"avatar_url":"https://avatars.githubusercontent.com/u/5768479?v=3","gravatar_id":"","url":"https://api.github.com/users/filipsch","html_url":"https://github.com/filipsch","followers_url":"https://api.github.com/users/filipsch/followers","following_url":"https://api.github.com/users/filipsch/following{/other_user}","gists_url":"https://api.github.com/users/filipsch/gists{/gist_id}","starred_url":"https://api.github.com/users/filipsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/filipsch/subscriptions","organizations_url":"https://api.github.com/users/filipsch/orgs","repos_url":"https://api.github.com/users/filipsch/repos","events_url":"https://api.github.com/users/filipsch/events{/privacy}","received_events_url":"https://api.github.com/users/filipsch/received_events","type":"User","site_admin":false},"created_at":"2016-06-16T14:44:23Z","updated_at":"2016-06-16T14:44:23Z","body":"There's two parts to this problem:\r\n\r\n- There should be a way to test if a function throws an error. Like `test_expression_output()` and `test_expression_result()`, you also want `test_expression_error()`, right?\r\n- There should be a way to tell the system that you want the solution code to run an error on purpose. I'm not a fan of allowing this for all exercises on the platform for the sake of a couple of exercises, because you want to tell course authors when their solution doesn't run. What we could do, however, is adding a function to the RBackend so that you can specify in your SCT:\r\n\r\n    *** =pec\r\n    ```{r}\r\n    code_throws_error()\r\n    ```\r\n\r\nSo that RBackend knows about this and will not complain if the solution generates an error. \r\n\r\nThe first bullet requires a change in `testwhat`, the second on in `RBackend`.\r\n\r\nWhat do you think?"}}
{"actor":{"display_login":"filipsch"}}