integration-testing

Mock/Test Mongodb Database Node.js

纵饮孤独 提交于 2019-12-03 10:45:25
问题 I am learning nodejs and I have a mongodb database with which i have to interact with. I am currently thinking of using mocha for a unit test framework and zombie.js for a acceptance test framework. I was wondering how could I do full scale acceptance tests which hit the mongodb database. Is there a framework/module that helps with replacing the database with a test database or does either mocha or zombie.js have functionality that can easily be used to replace the database. Also is there a

Performance testing best practices when doing TDD?

感情迁移 提交于 2019-12-03 09:39:06
问题 I'm working on a project which is in serious need of some performance tuning. How do I write a test that fails if my optimizations do not in improve the speed of the program? To elaborate a bit: The problem is not discovering which parts to optimize. I can use various profiling and benchmarking tools for that. The problem is using automated tests to document that a specific optimization did indeed have the intended effect. It would also be highly desirable if I could use the test suite to

How to use the Embedded PostgreSQL Server Java component as a separate service?

二次信任 提交于 2019-12-03 08:52:00
I am trying to create a comprehensive integration test suite for a RESTful (Services) Java-based application that runs in Tomcat(7.x) and depends on an Postgresql (9.x) instance. Further, I would like to be able to run this suite as a self-contained process, exclusively from maven 3.x, if possible, by using the maven failsafe plugin. That way, the tests can be run across the 3 major platforms (Mac OSX, Linux & Windows). From what I have learned, I believe that the key to making this happen is doing something like these steps (in this order): Start an "embedded" version of the postgresql DB

Do you need to do unit and integration testing if you already do functional testing? [closed]

霸气de小男生 提交于 2019-12-03 08:34:27
People at my company see unit testing as a lot of extra work, that offers fewer benefits than existing functional tests. Are unit and integration tests worth it? Note a large existing codebase that wasn't designed with testing in mind. (I'm assuming that you're using "functional test" to mean a test involving the whole system or application being up and running.) I would unit test new functionality as I wrote it, for three reasons: It helps me get to working code quicker. The turnaround time for "unit test failed, fix code, unit test passed" is generally a lot shorter than "functional test

How to perform integration testing in PHP?

有些话、适合烂在心里 提交于 2019-12-03 08:30:14
问题 I am currently performing unit tests on my code (using PHPUnit and Jenkins) but I have read a lot about integration testing. Are there any tools to perform this in php (preferably automated)? How would I go about implementing it? Are there any good tutorials anywhere? 回答1: Basically the way to go is to implement besides unit tests also mock tests which are not solely testing a single unit more like a group of units bunched together and you see them as a logical unit which should behave in a

Integration Test Web Api With [Authorize]

雨燕双飞 提交于 2019-12-03 08:14:05
So I've found bits and pieces that have enlightened me some on the [Authorize] tag, but nothing that solves my problem. My scenario is that I have Web Api methods that I want to hit with integration tests using RestSharp. However RestSharp is getting my login page, instead of the results of the call. [Authorize] public Item GetItem([FromBody] int id) { return service.GetItem(id); } The product uses a custom login system, and what I would REALLY like would be a way to disable the [Authorize] badge only for integration tests. However I read that you can allow anonymous users and it would

Integration testing an ASP.NET MVC application

こ雲淡風輕ζ 提交于 2019-12-03 07:53:46
I need some advice about efficient way of writing integration tests for our current ASP.NET MVC application. Our architecture consists of: A Service Layer below Controllers Service Layer uses Repositories and Message Queue (sometimes) to send messages to external applications. What I think should be done is to: Write behavioral unit tests for all pieces in isolation. So, for example, we should unit test the Service Layer while mocking Repositories and Message Queues. Same goes for Controllers. So we mock the Service Layer and unit test the Controller. Finally, we write separate integration

Right path to applicationContext.xml using ClassPathXmlApplicationContext

ε祈祈猫儿з 提交于 2019-12-03 07:46:06
问题 I have working web-application with applicationContext.xml in WEB-INF/config/applicationContext.xml. Now i need to implement some testing tool as standalone application, that can use the same applicationContext.xml, but have problem with path to config for ClassPathXmlApplicationContext class. I know that when i copy applicationContext.xml to default package (where .java resides) i can use ClassPathXmlApplicationContext("applicationContext.xml"), but is this necessary ? import org.apache

How to automate integration testing?

天大地大妈咪最大 提交于 2019-12-03 07:45:55
问题 I'd like to know something, I know that to make your test easier you should use mock during unit testing to only test the component you want, without external dependencies. But at some point, you have to bite the bullet and test classes which interact with your database, files, network, etc. My main question is: what do you do to test these classes? I don't feel that installing a database on my CI server is a good practice, but do you have other options? Should I create another server with

How can I assert that no route matches in a Rails integration test?

余生长醉 提交于 2019-12-03 07:44:19
I have a Rails 3 integration test which tests my routes. It contains tests such as: assert_routing( "/#{@category.url.path}/#{@foo.url.path}", { :controller => 'foo', :action => 'show', :category => @category.to_param, :foo => @foo.to_param } ) I would also like to test a case where no routes should match. Obviously, testing generation has no meaning in this case, so I just need the inverse of assert_recognizes. I'd like to be able to do something like this: assert_not_recognized('/adfhkljkdhasjklhjkldfahsjkhdf') Any ideas, short of wrapping assert_recognizes in an assert_raises block (which