integration-testing

Spring integration test does not roll back

こ雲淡風輕ζ 提交于 2019-12-10 14:16:54
问题 I'm using Spring + Hibernate + H2. I do database operations in my integration tests (by calling a service class). I want Spring to rollback the changes after each test method, but I can't get it to work. At first I used MySQL (with MyISAM, which doesn't support transaction), but after changing to H2 the problem remains. I tried several DataSource-definitions (after reading that it must be XA-aware), but nothing seems to help. I use http://code.google.com/p/generic-dao/ for my DAO-classes and

Is there a mechanism for integration testing JAX-RS services without deploying (a la MockMVC)?

本小妞迷上赌 提交于 2019-12-10 13:45:48
问题 I have successfully built no-deployment-needed integration test frameworks for Spring MVC REST services using Mock MVC. I am struggling to do the same with JAX-RS services. REST Assured looks promising, but it seems to require deployment. The test suite can start up a CXF server, but can it wire it up with a servlet container? It seems that the unique value provided by Mock MVC is in its mock servlet container. Does any other technology provide this. The JAX-RS testing page of the CXF

Integration tests with MongoDB?

可紊 提交于 2019-12-10 13:37:04
问题 I need to do several integration tests on a Mongo database using Java, and I was looking for a DbUnit-like solution (DbUnit is for Hibernate) that can populate my database with custom data, and reset the state after each run. Any tips? Thanks 回答1: To start off, I don't know of any direct equivalent to DBUnit for Mongo. Mongo is still a new product, so you'll probably have to "roll your own" for some of this stuff. However, there are several features of Mongo that should make this easy: It

Removing the “integration test scam” - Understanding collaboration and contract tests

早过忘川 提交于 2019-12-10 12:56:53
问题 I've recently watched Integration Tests are a Scam by J. B. Rainsberger and am now looking for more material on the subject. I have to say, I'm shocked by how much we're doing wrong, (i.e. integration testing when we should unit test), intrigued by the concepts described by Rainsberger but also confused about how to apply them. I would like to have more of the described collaboration tests and contract tests but I don't know where to start. The only things that got stuck in my mind are the 4

Mock external server during integration testing with Spring

江枫思渺然 提交于 2019-12-10 12:33:20
问题 I have a Spring web server that on a request makes an external call to some third-party web API (e.g. retreive Facebook oauth token). After getting data from this call it computes a response: @RestController public class HelloController { @RequestMapping("/hello_to_facebook") public String hello_to_facebook() { // Ask facebook about something HttpGet httpget = new HttpGet(buildURI("https", "graph.facebook.com", "/oauth/access_token")); String response = httpClient.execute(httpget).getEntity()

best way to integration test spring mvc

会有一股神秘感。 提交于 2019-12-10 11:56:56
问题 I have a Spring MVC 3.2 project that I would like to unit & integration tests. The problem is all the dependencies I have, makes testing extremely difficult even with Sprint-test. I have a controller like this: @Controller @RequestMapping( "/" ) public class HomeController { @Autowired MenuService menuService; // will return JSON @Autowired OfficeService officeService; @RequestMapping( method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE ) @ResponseBody public

Grails. mocked data from a unit test is available in an integration test

夙愿已清 提交于 2019-12-10 11:48:04
问题 Im having a failed integration test because of test pollution (tests pass or fail depending on which order they are run in). What baffles me a bit however is that it seems that a unit test where i have mocked some data with mockDomain(Media.class,[new Movie(...)]) is still present and available in other tests, even integration tests. Is this the expected behaviour? why doesn't the test framework clean up after itself for each test? EDIT Really strange, the documentation states that:

How to do ASP.NET Web API integration tests with custom authentication and in-memory hosting

爷,独闯天下 提交于 2019-12-10 11:35:15
问题 A similar question has been answered here but the answer doesn't seem to work in my case. I want to test the authentication/authorization process in my Web Api which is using a JWT authentication. My authentication is handled through a custom MessageHandler that I add to my HttpConfiguration . Authorization in handled by a simple [Authorize] Attribute on Controller/Methods I want to restrict access to. I'm setting the principal I've extracted from my token this way during authentication (in

Integration testing private classes and methods

南笙酒味 提交于 2019-12-10 11:26:54
问题 For unit testing you shouldn't test private methods, yes, but for integration tests (using a unit testing framework like MSTest or NUnit) I would very much like to run the internal API calls against a test url, to make sure the current code works when the third party API vendor changes their backend. Given the complexity of the system (stupid API's have hundreds of parameters) I have hidden most of it behind interfaces and IoC, with the API helper class completely internal to our data layer

Error while executing Run Functional Test task in VSTS

孤人 提交于 2019-12-10 11:26:46
问题 In VSTS 2015 we have build and release pipeline setup in a project which is using NUnit test framework. We are trying to configure Integration test case execution using "Run Functional Task" configuration of the task is given in the screenshot below: Visual Test Agent Deployment Task is used to Deploy the NUnit Test Agent in target machine. There is a folder that is created in Target Machine where all test assemblies are getting copied i.e. C:\TestDlls and for NUnit Adapter assemblies C: