Hello, I'd like to be able to write unit tests so that I could
call a couple pages and check for 200 response codes and fail if I
get anything else (like 400 or 5xx response codes). Not sure how I
could do this with a unit test framework or what url I would even
call.
This would be super useful so that I can catch errors and stop
deployments.
Unit test support for page views
Discussions are closed to public comments.
If you need help with AppHarbor please
start a new discussion.
Keyboard shortcuts
Generic
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
Comment Form
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac
#1 Posted by friism Support staff on 09 May, 2011 03:17 PM
Hi Andrew
The tests you describe sound more like integration- or regression tests and should not be executed during unit testing. I'd recommend refactoring your unit tests to test functionality at a lower level than hitting urls and running your regression tests once you have deployed.
friism closed this discussion on 09 May, 2011 03:17 PM.
andrew re-opened this discussion on 09 May, 2011 06:25 PM
#2 Posted by andrew on 09 May, 2011 06:25 PM
Hi Michael, thanks for your response. I wanted to be able to catch errors in my views that were not integration level tests, for example I forgot a closing ) in an if statement in my razor view.
I did see Haacked's post today which helps me with that though: http://haacked.com/archive/2011/05/09/compiling-mvc-views-in-a-buil...
#3 Posted by friism Support staff on 09 May, 2011 06:30 PM
Cool -- we actually had view-precompilation enabled for all apps at some point, but hit some snag (I forget which).
Let us know if you other questions.
friism closed this discussion on 09 May, 2011 06:30 PM.