integration-testing

SpecFlow Integration Testing with Database Patterns

吃可爱长大的小学妹 提交于 2019-11-30 03:13:41
问题 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.

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

一曲冷凌霜 提交于 2019-11-30 03:02:49
问题 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

Integration Testing for a Web App

时光怂恿深爱的人放手 提交于 2019-11-30 00:56:12
I want to do full integration testing for a web application. I want to test many things like AJAX, positioning and presence of certain phrases and HTML elements using several browsers . I'm seeking a tool to do such automated testing. On the other hand; this is my first time using integration testing. Are there any specific recommendations when doing such testing? Any tutorial as well? (As a note: My backend code is done using Perl, Python and Django.) Thanks! If you need to do full testing including exploiting browser features like AJAX then I would recomend Selenium . Selenium launches a

Rollback database after integration (Selenium) tests

落花浮王杯 提交于 2019-11-30 00:49:50
Does anyone have any suggestions for a best practice or preferred way of rolling back database transactions made from an integration test framework such as Selenium? Here is our current situation: We have a .net web project with a number of unit tests which work fine in our unit test environment - each test inherits a parent class which opens a transaction in the [SetUp], and rolls back the transaction in the [TearDown]. After each test, our unit test database is restored back to the original state. However, things change once we get to our integration environment. Our continuous integration

Integration Testing best practices

≯℡__Kan透↙ 提交于 2019-11-29 22:24:57
Our team has hundreds of integration tests that hit a database and verify results. I've got two base classes for all the integration tests, one for retrieve-only tests and one for create/update/delete tests. The retrieve-only base class regenerates the database during the TestFixtureSetup so it only executes once per test class. The CUD base class regenerates the database before each test. Each repository class has its own corresponding test class. As you can imagine, this whole thing takes quite some time (approaching 7-8 minutes to run and growing quickly). Having this run as part of our CI

Running NUnit through Resharper 8 tests fail when crossing between projects due to AppDomain

回眸只為那壹抹淺笑 提交于 2019-11-29 21:15:35
I recently updated to Resharper 8, and when I tried to run a suite of projects. These tests contain two suites of integration tests that both use IISExpress to run a website, make web requests and check the responses. Running them in isolation is successful, and running all the tests would previously succeed. However, after the upate the second set of tests to run would fail. Investigation has revealed the AppDomain.CurrentDomain.BaseDirectory is staying as the first test to run instead of changing. Since the integration tests are composed of two projects, this is causing the second project to

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

不问归期 提交于 2019-11-29 20:59:23
问题 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

How to run individual test in the integration-test target in maven

冷暖自知 提交于 2019-11-29 20:53:22
We have a hundreds of tests defined for our integration-test phase lifecycle in maven, and they take a long time to finish. What I want to do is run just one test in the integration-test . I tried doing : mvn -Dtest=<my-test> integration-test but that does not work. The -Dtest runs only the tests in the unit test goal, not the integration-test phase. I tried the -Dintegration-test=<my-test> instead, and that was ignored. Is there a way to do that ? My configuration is: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <executions> <execution>

Testing Spring's @RequestBody using Spring MockMVC

*爱你&永不变心* 提交于 2019-11-29 20:35:35
I am trying to test a method that posts an object to the database using Spring's MockMVC framework. I've constructed the test as follows: @Test public void testInsertObject() throws Exception { String url = BASE_URL + "/object"; ObjectBean anObject = new ObjectBean(); anObject.setObjectId("33"); anObject.setUserId("4268321"); //... more Gson gson = new Gson(); String json = gson.toJson(anObject); MvcResult result = this.mockMvc.perform( post(url) .contentType(MediaType.APPLICATION_JSON) .content(json)) .andExpect(status().isOk()) .andReturn(); } The method I'm testing uses Spring's

How to do integration testing in .NET with real files?

二次信任 提交于 2019-11-29 20:23:50
I have some classes that implements some logic related to file system and files. For example, I am performing following tasks as part of this logic: checking if certain folder has certain structure (eg. it contains subfolders with specific names etc...) loading some files from those folders and checking their structure (eg. these are some configuration files, located at certain place within certain folder) load additional files for testing/validation from the configuration file (eg. this config file contains information about other files in the same folder, that should have other internal