integration-testing

Override Autofac registration - Integration tests with DI

夙愿已清 提交于 2019-12-30 09:33:28
问题 I write integration tests for my application, and use my container for this. I want to be able to register all the components as I do in real running, and then override some of the components and switch them to use stubs implementations. I wouldn't want to seperate the DI and have a container for tests only because I want to test the real thing. Doing this also seems ugly: public class MyRegistrations { public static RegisterAll(bool isInTest= false) { if (isTest) { // Register test fakes }

NUnit integration tests and dependency injection

风格不统一 提交于 2019-12-30 09:00:08
问题 I'm currently making use of Castle Windsor version 2.1 as my container and would like to perform integration tests using the services registered with it. Currently, I do this my using the Common Service Locator to retrieve my service instance and perform my integration tests against it as such: var myService = ServiceLocator.Current.GetInstance<IMyService>(); // do stuff with myService What I'd ideally like to do is have my service dependencies injected into my NUnit test fixture

NUnit integration tests and dependency injection

*爱你&永不变心* 提交于 2019-12-30 09:00:03
问题 I'm currently making use of Castle Windsor version 2.1 as my container and would like to perform integration tests using the services registered with it. Currently, I do this my using the Common Service Locator to retrieve my service instance and perform my integration tests against it as such: var myService = ServiceLocator.Current.GetInstance<IMyService>(); // do stuff with myService What I'd ideally like to do is have my service dependencies injected into my NUnit test fixture

Maven deploy multiple wars to embedded server for integration tests

笑着哭i 提交于 2019-12-30 06:12:25
问题 I have had no issue running a maven war project on an embedded server for its own integration tests, but now I need to run multiple wars and test from a different project. I would like to setup the following scenario... I have two Maven war projects in my local workspace called War1 and War2. I would like to have a 3rd Maven project, WarIntegration, that contains only integration tests and does the following: Packages War1 Packages War2 Starts an embedded server Deploys both wars to same

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

百般思念 提交于 2019-12-30 06:00:12
问题 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

CasperJS and 'Unsafe JavaScript attempt to access frame with URL' error

你离开我真会死。 提交于 2019-12-30 05:45:11
问题 I have simple page with javascript which validates email written in input: email.html: <!DOCTYPE html> <html> <head> <title>Email validation</title> <script src="email.js"></script> </head> <body> <span style="padding: 5px;"> <input type="text" id="email-input" placeholder="Email..."></input> </span> </body> </html> email.js: var checkEmail = function() { var regexp = /BIG_REGEX/; var email = document.getElementById('email-input').value; if (email === '') removeFrame(); else if (regexp.test

Do I only have to mock out external dependencies in a unit test? What's about internal dependencies?

社会主义新天地 提交于 2019-12-30 05:31:08
问题 Do I only have to mock out external dependencies in a unit test? What if my method that I want to test, has a dependency on another class within the same assembly? Do I have to mock out the dependency for going sure to test only one thing and there for to make a unit test instead of an integration test? Is an integration test a test that tests dependencies in general or do I have to difference between internal and external dependencies? An example would be a method that has 2000 lines of code

“Could not find a valid mapping for #<User …>” only on second and successive tests

…衆ロ難τιáo~ 提交于 2019-12-30 00:53:09
问题 I'm trying to write a request test that asserts that the proper links appear on the application layout depending in whether a user is logged in or out. FWIW, I'm using Devise for the authentication piece. Here's my spec: require 'spec_helper' require 'devise/test_helpers' describe "Layout Links" do context "the home page" do context "session controls" do context "for an authenticated user" do before do # I know these should all operate in isolation, but I # want to make sure the user is

Integration Testing best practices

不打扰是莪最后的温柔 提交于 2019-12-29 16:28:50
问题 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

Integration Testing best practices

萝らか妹 提交于 2019-12-29 16:28:04
问题 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