Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

java - Prefix for testing methods in Unit: "test" vs "should" -


it common practice prefix tests method names in junit "test". in last few years, people changed prefix "should".

if want test customer creation in database, name method "testcustomercreation". however, people name "shouldcreatecustomer".

this lot of personal taste when person in project or when else in project agrees me. when/where not case, divergences or inconsistent mixes starts shows up.

i readed somewhere article of guy named methods "testshouldcreatecustomer", , reason decided drop "test" prefix. in fact wasn't prefixing "test", using "testshould" , changed "should". obviously, did not convinced me.

i inclined stick "test" prefix because methods names starts verbs in infinitive form ("get", "set", "add", "remove", "clear", "send", "receive", "open", "close", "read", "write", "create", "list", "pop", "print", etc, "test"). so, prefixing method name "should" makes sound strange me, looks wrong.

so, real reason use "should" instead of "test"? great advantages , disadvantages?

the 'should' convention aligned behaviour driven development style of testing.

i prefer write tests in style, encourages write tests read specifications, , more aligned behaviour of class or system testing.

where possible, go 1 step further , give test class more context using it's name:

class anewlycreatedaccount {   shouldhaveazerobalance() {}   shouldcalculateitsowninterest() {} } 

by naming classes , thinking them in specification style, can give lot of guidance on which tests write, , in order should write tests , make them green.

yes, 'should' vs 'test' prefix , it's important consistent, question style , mindset of how test code , choose tests write. bdd has ton of value, suggest reading further , give try.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -