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.

ruby - Mapping multiple test classes to the same file for autotest -


i'm using standalone autotest in projects along minitest. in 1 of projects, have single file (validation.rb) validates document different internal format levels. (a level 2 document has more features level 1 document.)

testing validation particular level requires repeatedly loading in known-valid document, subtly mutating in broken way, , ensuring broken. in short:

class testvalidation < minitest::unit::testcase   def setup     @l1 = document.load( l1doc )   end   def test_valid     assert @l1.valid_level_1?   end   def test_unbalanced_data     @l1.instance_eval{ @tracks[0].data.pop }     refute @l1.valid_level_1?, "validation must ensure tracks have same amount of data"   end   # many more tests level 1 here end 

the problem autotest (as far can tell) knows tests run based on name of test classes. testvalidation have tests automatically run when validation.rb changed.

without autotest, have named above class testl1validation, , created new class testl2validation loaded different document. doing breaks autotest, however, unless break out validation l1validation.rb , l2validation.rb.

how can name files or tests, or set tests, autotest run multiple test classes when single source file changes?

you can add custom mappings autotest. here's 1 way of doing it: create autotest directory @ same level lib , test directories.

add autotest/discover.rb:

$load_path.unshift file.expand_path('../', file.dirname(__file__)) autotest.add_discovery { "my_rules" } 

add autotest/my_rules.rb:

require 'autotest'  class autotest::my_rules < autotest   def initialize     super      add_mapping(%r%^lib/valid.rb$%, true) { |filename, _|       files_matching %r%^test/test_.*\.rb$%     }   end end 

this add custom mapping: whenever lib/valid.rb files has changed, re-run test_*.rb files in test directory.


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 -