English 中文(简体)
当数据来源被配置成应用服务器特性时,单位测试CRUD业务
原标题:Unit testing CRUD operations when data source is configured in application server properties

请告诉我:

当普通应用工作的许多财产在供应用服务器使用的汇辑档案中被节省时,我怎么能写单位测试(例如与Junnit)的操作“列入某些表格”?

感谢!

最佳回答

你们也可以:

  • Change your class to require its configuration settings (like the data source) in its constructor. Make callers read the configuration settings and dictate them to your class. When you do this, your unit tests can specify the settings when they instantiate test instances.

  • Use a mock object instead of the normal mechanism to obtain configuration settings.

第二种选择是,如果你使用一个共用的单一吨位代码<>组合分布图>(或类似)获取您的组合数据,则有可能获得。 如果情况如此,则采用第一种方法,这种方法通常会更好。 (正如你提出的问题表明,不同的打电话者使用不同的配置技术。)

问题回答

暂无回答




相关问题
Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

JSON with classes?

Is there a standardized way to store classes in JSON, and then converting them back into classes again from a string? For example, I might have an array of objects of type Questions. I d like to ...

Object-Oriented Perl constructor syntax and named parameters

I m a little confused about what is going on in Perl constructors. I found these two examples perldoc perlbot. package Foo; #In Perl, the constructor is just a subroutine called new. sub new { #I ...

Passing another class amongst instances

I was wondering what is the best practice re. passing (another class) amongst two instances of the same class (lets call this Primary ). So, essentially in the constructor for the first, i can ...

Where can I find object-oriented Perl tutorials? [closed]

A Google search yields a number of results - but which ones are the best? The Perl site appears to contain two - perlboot and perltoot. I m reading these now, but what else is out there? Note: I ve ...

热门标签