integration-testing

Reset Spring-Boot During Integration Tests

て烟熏妆下的殇ゞ 提交于 2019-12-06 11:15:48
I guess am trying to get a corner case to work here. In my current project there are about 20 integration tests. One new integration test requires @EnableAsync to make the test work: @RunWith(SpringRunner.class) @EnableAsync @SpringBootTest(webEnvironment = WebEnvironment.NONE) public class MyITest { : } When run alone, this test works fine. Considering Maven and Eclipse' execution of tests in one project and knowing that the environment is only created once and reused (or soft-reset) for all integration tests, it's somewhat a requirement that this integration test runs first. However, that's

database restore to particular state for testing

一曲冷凌霜 提交于 2019-12-06 11:07:29
We use an Oracle(or postgres) database and an application server to execute integration tests. To isolate each test from another one , the database schema is dropped and re-created before each test. As you see this is a time taking process. The application uses 100+ tables. We are thinking of writing custom sql to delete unwanted data from each tables. Is there a better way to save and restore database state? ( It appears DBUnit could do this, I have not tried it yet. ) A single test involves: create database schema. Start app server. Start multiple client applications. Execute and verify. We

How to make a docker image with a populated database for automated tests?

六眼飞鱼酱① 提交于 2019-12-06 08:25:28
I want to create containers w/ a MySQL db and a dump loaded for integration tests. Each test should connect to a fresh container, with the DB in the same state. It should be able to read and write, but all changes should be lost when the test ends and the container is destroyed. I'm using the " mysql " image from the official docker repo. 1) The image's docs suggests taking advantage of the "entrypoint" script that will import any .sql files you provide on a specific folder. As I understand, this will import the dump again every time a new container is created, so not a good option. Is that

Integration testing private classes and methods

夙愿已清 提交于 2019-12-06 07:29:34
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 library. I don't want to change this because it used to be public and we found the odd developer new to

Error while executing Run Functional Test task in VSTS

白昼怎懂夜的黑 提交于 2019-12-06 07:16:27
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:\PIMPackages The Agent deployment task is getting executed successfully but it get aborted in "Run

Cobertura and Jetty

醉酒当歌 提交于 2019-12-06 06:17:38
问题 I'm trying to get coverage report when running my webapp on Jetty, using cobertura. We already have cobertura running for unit-tests by using the surefire plugin. We also have the failsafe plugin configured for running our integration-tests. I've already (manually) instrumented my war and deployed it. When running mvn verify with integration-tests only profile, it seems cobertura is working because I get all kind of new warnings in eclipse console (i'm running jetty from there) probably

populating in memory hsqldb database from script

跟風遠走 提交于 2019-12-06 06:00:55
问题 Is there a way that I can specify a script in the connection string pointing to my in memory hsqldb instance? I was looking at this article and it looks like it is possible, but I'm not sure how to formulate the string correctly or where to put the script file. Looking at the hsqldb documentation here it doesn't appear to be the case. What would my options here be for using this from java tests? This is related to a previous hsqldb question here starting and stopping hsqldb from unit tests

OpenEJB Local Client Injection Fails

我与影子孤独终老i 提交于 2019-12-06 05:59:11
问题 Note that I'm mirroring the example given here very closely. In fact, my situation is somewhat simpler as I'm not even testing with a persistence unit at this point. My test project provides a simple MDB and a session bean; both the MDB and the session bean are getting loaded as normal, and can be successfully tested (in a constrained fashion) without injection. The suggested injection with the @LocalClient annotation on my unit tests is failing with the known error: javax.naming

Force protractor to wait for seed data to load

自作多情 提交于 2019-12-06 05:01:36
I have to load some seed data for my tests. I'm having a really hard time making sure the seed data has loaded completely before the tests begin running. In the beforeAll block I'm calling an adapter I wrote for my API that clears out any data, loads a specified file of seed data and then runs a callback passed in from the protractor test file. I can't include the test cases in a callback (this seems like it would be a similar blocking issue to refactoring to promises) or protractor doesn't recognize them. Can anyone suggest a way I can make sure my API has been successfully seeded before the

How to do ASP.NET Web API integration tests with authorize attribute

独自空忆成欢 提交于 2019-12-06 04:03:39
问题 I do have authorize attribute applied on my Web API. I am calling Web API from MVC4 application in which I am using standard cookie based authentication. I need to call Web API method on controllers from integration tests but because authorize attribute is applied I will always receive unauthorized exception . What is the best way to solve this problem ? PS. I don't want (need) to use other methods of authentication such as APIKey,Token in Auth Header and similar... 回答1: First of all, one key