integration-testing

Testing - Connection string is missing

不羁岁月 提交于 2019-11-30 21:36:08
问题 Visual studio created a unit test project for me based on a method (right-click add test). When I try to access the database, I get an exception. Ran this code to see what my connection was: ConnectionStringSettings connStringSettings = ConfigurationManager. ConnectionStrings["myConnectionString"]; but, connStringSettings is null. Upon inspection, ConnectionStrings collection has a count of only one. It seems to not be reading from my web.config. My DAL is isolated and cannot have its

Spring test with @DataJpaTest can't autowire class with @Repository (but with interface repository works!)

放肆的年华 提交于 2019-11-30 20:32:58
I'm trying to understand why I can't autowire a class repository but I can autowire a interface repository in the same package for the same test . The same repository works as expected when I start the application. First, the error: Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.app.person.repository.PersonRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support

Where should I put interface class for Junit @Category?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 19:38:57
I'd like to define project-wide interfaces, to be used in @Category annotations, and configure Maven to exclude their annotated tests when building the whole project. In the application project there's a test I'd like to categorize: @Category(Integration.class) @Test public void testExternalResource() { ... } The setting: I've set up a multi-module maven project: /container (has a pom with <modules> element) /parent (all other modules inherit from its pom. has no source, only pom) /util (other modules are depending on it) /infra /application (depending on infra and util, inherits from parent)

SpecFlow Integration Testing with Database Patterns

痞子三分冷 提交于 2019-11-30 19:35:35
I'm attempting to set up SpecFlow for integration/acceptance testing. Our product has a backing database (not a huge one though) in Sqlite. This is actually proving to be a slightly sticky point though; how do I model the database for the tests? I would like to know what patterns others out there use for doing integration/acceptance testing with backing databases. I can think of the following approaches: Compile a database into the assembly with the tests, then shadow-copy it for each test. Seems slow though. I could create the database in memory and populate it with pre-determined data. I

How do I define an order to run junit tests in Intellij?

风格不统一 提交于 2019-11-30 19:14:58
I have a flaky junit test that only fails if I run all my tests. I think that one test is causing another test to fail, I want to prove it before I try to fix it. If I run all tests, it runs the "bad setup" then it runs the "test that fails after bad setup". It also runs a lot of irrelevant, slow tests in between. But if I use a pattern to only run these two, it runs "test that fails after bad setup" then "bad setup". As a result, both pass. How do I only run "bad setup" and "test that fails after bad setup", in that order? According to JUnit's wiki : By design, JUnit does not specify the

Java Jar hell Runtime Exception

こ雲淡風輕ζ 提交于 2019-11-30 18:15:20
问题 I am facing the issue with jar hell while running the unit test. java.lang.RuntimeException: found jar hell in test classpath at org.elasticsearch.bootstrap.BootstrapForTesting.<clinit>(BootstrapForTesting.java:95) at org.elasticsearch.test.ESTestCase.<clinit>(ESTestCase.java:99) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:585) Caused by: java.lang.IllegalStateException

Using Capybara for AJAX integration tests

一世执手 提交于 2019-11-30 15:50:34
问题 I am using Capybara for rails integration tests. When it comes to AJAX requests, I am getting the following error: Capybara::TimeoutError: failed to resynchronize, ajax request timed out Any idea what's wrong and how this can be fixed? 回答1: I had this same issue once I upgraded my selenium/capybara gems. There is some AJAX synchronization logic that is causing this, so I just disabled it within my test hook. Before do page.driver.options[:resynchronize] = false end 回答2: If you are on rail 3

Using Capybara for AJAX integration tests

落花浮王杯 提交于 2019-11-30 14:56:37
I am using Capybara for rails integration tests. When it comes to AJAX requests, I am getting the following error: Capybara::TimeoutError: failed to resynchronize, ajax request timed out Any idea what's wrong and how this can be fixed? I had this same issue once I upgraded my selenium/capybara gems. There is some AJAX synchronization logic that is causing this, so I just disabled it within my test hook. Before do page.driver.options[:resynchronize] = false end If you are on rail 3 change this in your gem file. gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git', :branch =>'async

TestNG & Selenium: Separate tests into “groups”, run ordered inside each group

╄→尐↘猪︶ㄣ 提交于 2019-11-30 14:28:43
We use TestNG and Selenium WebDriver to test our web application. Now our problem is that we often have several tests that need to run in a certain order, e.g.: login to application enter some data edit the data check that it's displayed correctly Now obviously these tests need to run in that precise order. At the same time, we have many other tests which are totally independent from the list of tests above. So we'd like to be able to somehow put tests into "groups" (not necessarily groups in the TestNG sense), and then run them such that: tests inside one "group" always run together and in

Integration tests with Gradle Kotlin DSL

南楼画角 提交于 2019-11-30 13:47:42
I'm using this blog post to configure integration tests for a Spring Boot project, but I'm pretty stuck on declaring the source sets. I also found this post on StackOverflow , but I think I'm a bit further already. My project structure is project |_ src |_ main | |_ kotlin | |_ resources |_ testIntegration | |_ kotlin | |_ resources |_ test | |_ kotlin | |_ resources |_ build.gradle.kts |_ ... other files And build.gradle.kts import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { idea kotlin("jvm") id("org.springframework.boot") version "2.0.5.RELEASE" id("org.jetbrains.kotlin.plugin