integration-testing

Springboot: How can I perform an integration test with real dependencies?

会有一股神秘感。 提交于 2019-12-12 13:02:09
问题 I'm starting to learn both Java and Spring boot now, and I'm having some problems with dependency injection in integration tests. I have a class under src/main/java/com/rfd/domain/services called TransactionService, which is marked as @Service and which has another dependencies, one of them a repository created by Spring boot. When I launch the application, it is launched correctly so I assume the dependencies are being resolved correctly. This is the summarized class: package com.rfd.domain

Mocking and resolving Autofac dependency in integration test in AspNetCore with TestServer

谁说胖子不能爱 提交于 2019-12-12 12:19:17
问题 I'm using AspNetCore 2.2 Following (moreless) the docs here: https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-2.2 I am using Autofac, my Startup class has the following methods: public void ConfigureServices(IServiceCollection services) public void ConfigureContainer(ContainerBuilder containerBuilder) //this is where things can be registered directly with autofac and runs after ConfigureServices public void Configure(...) //the method called by runtime The

How do I integration test a ASP 5/Core Web API with [Authorize] Attributes

点点圈 提交于 2019-12-12 11:28:59
问题 I currently have an ASP 5/ASP Core Web API that I need to integration test with the OWIN Test Server. The problem is that I use IdentityServer as the authorization server in production and I do not want to include the authorization as part of my integration testing. This is the Startup.cs of the API: public Startup(IHostingEnvironment env) { // Set up configuration sources. IConfigurationBuilder builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddJsonFile($"appsettings.

How do I write useful unit tests for a mostly service-oriented app?

只谈情不闲聊 提交于 2019-12-12 11:17:02
问题 I've used unit tests successfully for a while, but I'm beginning to think they're only useful for classes/methods that actually perform a fair amount of logic - parsers, doing math, complex business logic - all good candidates for testing, no question. I'm really struggling to figure out how to use testing for another class of objects: those which operate mostly via delegation. Case in point: my current project coordinates a lot of databases and services. Most classes are just collections of

Maven folder layout: Should I place tests in the EAR or its sub-modules?

泪湿孤枕 提交于 2019-12-12 10:28:30
问题 We have an EAR project with several sub-modules (multiple EJBs, Web Projects, Application Clients, etc). The natural scope for unitary tests are their respective sub-modules (since they are supposed to be testing isolated units). In a short amount of time we have introduced non obvious testing dependencies. Projects were mocking functionality from other projects, etc. Soon our architecture evolved to several stand-alone jar files with mocks (web project 1 mocks, ejb 2 mocks, etc); we wire

Simulating JMS - jUnit

一曲冷凌霜 提交于 2019-12-12 09:43:43
问题 I need to simulate JMS behavior while performing automated tests via maven/hudson. I was thinking about using some mock framework i.e. Mockito to achieve that goal but maybe there is some easier tool which can accomplish this task? I have read a little bit about ActiveMQ but from what I have found out it requires to install broker prior using it. In my case it is important to have everything run by maven only because I don't have any privileges to install anything on the build server. 回答1:

Android Studio Integration test cannot resolve symbol AndroidJUnit4

流过昼夜 提交于 2019-12-12 09:42:47
问题 I've seen partial answers to similiar issues but never one that actually solved the problem. I've boiled this down to a minimal app to demonstrate the issue. I'm using the most current version of Android Studio (V2.2.1) I have the following SDK's installed: Android SDK Tools v25.1.6 Android SDK Platform-tools v23.1 Android SDK Build-tools v23.0.3 Android Support repository v32 Create new Android app using wizard Updated build.gradle (app) per: https://developer.android.com/training/testing

Testing specific Azure Web Site Instance

时间秒杀一切 提交于 2019-12-12 09:18:03
问题 I have an Azure Web Site configured to use multiple (2) instances: I have a service bus that should pass messages (ie Cache Evict) between the instances. I need to test this mechanism. In a conventional (on premise) system I would point a browser to instance 1 (ie http://myserver1.example.com), perform an action, then point my browser to the other instance (http://myserver2.example.com) to test. However, in Azure I can't see a way to hit a specific instance. Is it possible? Or is there an

Integration testing with maven: run jar before tests and terminate after

↘锁芯ラ 提交于 2019-12-12 08:48:46
问题 I have a runnable jar that I want to run in a new process before my integration test start (on pre-integration-test ) and get it terminated after my integration tests finish (on post-integration-test ). One of the things I could use is maven-antrun-plugin or exec-maven-plugin to start new process on pre-integration-test but how do I terminate it? Maybe there is a better solution for what I am trying to achieve? PS: I build my project both on Windows and Linux, so portability matters for me.

Configure Sonar to see Integration Tests (v6.2)

会有一股神秘感。 提交于 2019-12-12 08:29:16
问题 How to visualize Integration Tests in Sonar ? Currently I only see : the global coverage (UT + IT) the number of UT I read somewhere we had to configure a widget in the GUI : I didn't see any option which could do that. Documentation states : If coverage by unit tests is not computed with JaCoCo, overall coverage = integration test coverage. But in my case I see that the coverage is changing when I change my UTs (or ITs). Moreover I see jacoco reports in the targets : jacoco.exec jacoco-it