integration-testing

Unit tests vs integration tests with Spring

你说的曾经没有我的故事 提交于 2019-11-27 09:46:00
问题 I'm working on a Spring MVC project, and I have unit tests for all of the various components in the source tree. For example, if I have a controller HomeController , which needs to have a LoginService injected into it, then in my unit test HomeControllerTest I simply instantiate the object as normal (outside of Spring) and inject the property: protected void setUp() throws Exception { super.setUp(); //... controller = new HomeController(); controller.setLoginService( new SimpleLoginService()

What are unit testing and integration testing, and what other types of testing should I know about?

别来无恙 提交于 2019-11-27 09:20:01
问题 I've seen other people mention several types of testing on Stack Overflow. The ones I can recall are unit testing and integration testing. Especially unit testing is mentioned a lot. What exactly is unit testing? What is integration testing? What other important testing techniques should I be aware of? Programming is not my profession, but I would like it to be some day;stuff about production etc is welcomed too. 回答1: Off the top of my head: Unit testing in the sense of "testing the smallest

Database data needed in integration tests; created by API calls or using imported data?

送分小仙女□ 提交于 2019-11-27 09:13:51
问题 This question is more or less programming language agnostic. However as I'm mostly into Java these days that's where I'll draw my examples from. I'm also thinking about the OOP case, so if you want to test a method you need an instance of that methods class. A core rule for unit tests is that they should be autonomous, and that can be achieved by isolating a class from its dependencies. There are several ways to do it and it depends on if you inject your dependencies using IoC (in the Java

Creating test data in a database [closed]

随声附和 提交于 2019-11-27 07:50:52
I'm aware of some of the test data generators out there, but most seem to just fill name and address style databases [feel free to correct me]. We have a large integrated and normalised application - e.g. invoices have part numbers linked to stocking tables, customer numbers linked to customer tables, change logs linked to audit information, etc which are obviously difficult to fill randomly. Currently we obfuscate real life data to get test data (but not very well). What tools\methods do you use to create large volumes of data to test with? Pascal Paradis Where I work we use RedGate Data

Capybara with subdomains - default_host

送分小仙女□ 提交于 2019-11-27 06:57:29
I have an app that uses subdomains to switch databases (multi-tenancy). I'm trying to use Capybara for integration testing, and it really relies a lot on subdomains. My understanding was that setting Capybara.default_host= to something would make all my requests come from this host. This doesn't seem to be the case. In this post , the author recommends just visiting the explicit url with a host, but this becomes a bit annoying if I'm navigating all over the place. I'd like to just set the host, then be able to use my rails paths as expected. Not sure what I'm doing wrong, but here's what I've

How to see the Android Orchestrator log?

久未见 提交于 2019-11-27 06:40:45
问题 I have a failing test in my suite and now I am using the Android Orchestrator, but all I get is this message: Test instrumentation process crashed. Check com.something.something_detail.SomeActivityTest#testAddSucceeds_activityIsFinished.txt for details I don't know how to access that file. Any help? 回答1: You'll find them on the device under /data/data/android.support.test.orchestrator/files/ . To get them off the device via ADB (requires debugging enabled and either a rooted device or an

Jacoco Unit and Integration Tests coverage - individual and overall [closed]

耗尽温柔 提交于 2019-11-27 06:14:30
问题 I have a project (ProjectA) which contains some unit tests and integration tests. Following is the structure. ProjectA - src/java (java source code) - test/java (Junit unit tests) - test/resources (resources required for Junit Unit tests) - src/java-test (Integration tests) - conf (contains .xml files required for building/testing/compiling purposes) I run the following commands -- All of them works but I have a doubt on how the configurations that I have in build.gradle / GRADLE_HOME/init.d/

How can I skip tests in maven install goal, while running them in maven test goal?

…衆ロ難τιáo~ 提交于 2019-11-27 06:06:42
I have a multi-module maven project with both integration and unit tests in the same folder (src/test/java). Integration tests are marked with @Category(IntegrationTest.class) . I want to end up with the following setup: If I run mvn install , I want all tests to compile, but I do not want to execute any. If I run mvn test , I want all tests to compile, but execute only unit tests. If I run mvn integration-test , I want to compile and execute all tests. The important point is, I want this configured in the pom.xml without any extra commandline arguments. Currently I came up with the following

How does the In-Memory HttpServer know which WebAPI project to host?

寵の児 提交于 2019-11-27 05:57:08
问题 I want to run tests against WebAPI project using a popular in-memory hosting strategy. My tests reside in a separate project. Here's the start of my test [TestMethod] public void TestMethod1() { HttpConfiguration config = new HttpConfiguration(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new {id = RouteParameter.Optional}); HttpServer server = new HttpServer(config); HttpMessageInvoker client = new HttpMessageInvoker(server) } The client

Prevent unit tests but allow integration tests in Maven

試著忘記壹切 提交于 2019-11-27 05:51:42
I've a Maven build in which I use the SureFire plugin to run some unit tests, and the FailSafe plugin to run some integration tests. I would like a way to run just the FailSafe plugin's tests. It's not a good solution for me to add different profiles or anything in the pom, because it's a multimodule build and I don't want to have to edit every module's pom. There are skip.tests and maven.test.skip and skipTests which stop all tests, and skipITs , which stops only the failsafe plugin. So, is there a command-line flag for Maven like skipITs , but instead with the functionality of "onlyITs"? I