integration-testing

How do I get my Spring-JUnit test to think its running in a GenericApplicationContext?

萝らか妹 提交于 2019-12-19 05:47:20
问题 I’m using Spring 3.2.6.RELEASE , JUnit 4.11 , and DWR 3.0.0-rc2 . My question is, when running a Spring-JUnit integration test, how can I simulate things being run in a org.springframework.context.support.GenericApplicationContext ? I tried this: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration({ "classpath:test-context.xml", "classpath:dwr-context.xml" }) @WebAppConfiguration public class MyServiceIT {} in which my “dwr-context.xml” file is set to be <?xml version="1.0" encoding

Angular Jasmine Integration Test with service using real HTTP

蹲街弑〆低调 提交于 2019-12-19 04:55:34
问题 [Angular version: 2.4.5] I'm attempting to write an Angular integration component unit test that contains a service that leverages the built-in Angular HTTP library. I cannot get my Service class to instantiate though: either the Service is undefined or I get "Error: Cannot resolve all parameters for 'RequestOptions'(?)". I understand that typically you'd mock the backend (have successfully done that in other unit tests) or use Protractor. Other SO questions reference Angular 1 or have

Where should I put interface class for Junit @Category?

China☆狼群 提交于 2019-12-18 23:47:18
问题 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

ActivityTestRule - how to call code before Application's onCreate

北慕城南 提交于 2019-12-18 14:53:16
问题 I am using Espresso 2.1 with ActivityTestRule, and I am looking for a way to set some static flags before onCreate() in my application will be called. I have some init code that I don't want called during instrumentation tests. 回答1: Application onCreate() is called after Instrumentation onCreate() . For this case you need to implement a custom test runner which will subclass AndroidJUnitRunner and will override the callApplicationOnCreate() with your custom setup. public class

ActivityTestRule - how to call code before Application's onCreate

ぃ、小莉子 提交于 2019-12-18 14:53:10
问题 I am using Espresso 2.1 with ActivityTestRule, and I am looking for a way to set some static flags before onCreate() in my application will be called. I have some init code that I don't want called during instrumentation tests. 回答1: Application onCreate() is called after Instrumentation onCreate() . For this case you need to implement a custom test runner which will subclass AndroidJUnitRunner and will override the callApplicationOnCreate() with your custom setup. public class

Database integration tests in Visual Studio Online

余生长醉 提交于 2019-12-18 12:56:10
问题 I'm enjoying the new Build tool in Visual Studio Online. Allows me to do almost everything that I do my local build server. But one thing that I'm missing is integration database tests: for every build run I re-create test database from scripts and run DB-tests against it. In Visual Studio Online I can't seem to find any database instance available for my needs. I have tried creating Azure SQL database (via PowerShell) for every build run and then delete it after the build is complete. But it

Code coverage for Protractor tests in AngularJS

◇◆丶佛笑我妖孽 提交于 2019-12-18 11:55:55
问题 I am running some e2e tests in my angularJS app with protractor (as recommended in the angularJS documentation). I've googled around and cannot find any information on how to measure coverage for my protractor tests. I think I'm missing something here... is there any way to get a code coverage report for protractor e2e tests? Or is it simply a feature for unit tests? 回答1: This is achievable using Istanbul. Here is the process, with some example configurations that I've extracted from our

Rollback database after integration (Selenium) tests

血红的双手。 提交于 2019-12-18 10:57:07
问题 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

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

こ雲淡風輕ζ 提交于 2019-12-18 10:26: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

Selenium: retrieve data that loads while scrolling down

泄露秘密 提交于 2019-12-18 04:22:22
问题 I'm trying to retrieve elements in a page that has an ajax-load scroll-down functionality alla Twitter. For some reason this isn't working properly. I added some print statements to debug it and I always get the same amount of items and then the function returns. What am I doing wrong here? wd = webdriver.Firefox() wd.implicitly_wait(3) def get_items(items): print len(items) wd.execute_script("window.scrollTo(0, document.body.scrollHeight);") # len(items) and len(wd.find_elements-by...())