integration-testing

How to run tests after deployment using Maven?

对着背影说爱祢 提交于 2019-12-04 12:08:50
问题 I'm trying to decide how to create a set of Acceptance Tests for a Java-EE web application. Here's the setup: Maven is used to generate a WAR file and deploy it into Glassfish. On deployment, the MySQL database schema is automatically updated from model classes using Hibernate ("hbm2ddl=auto" option). The Acceptance Tests need to test the deployed code by invoking various methods and checking the results are as expected(*). We wrote an additional set of packages to hook into an existing

populating in memory hsqldb database from script

假如想象 提交于 2019-12-04 11:32:44
Is there a way that I can specify a script in the connection string pointing to my in memory hsqldb instance? I was looking at this article and it looks like it is possible, but I'm not sure how to formulate the string correctly or where to put the script file. Looking at the hsqldb documentation here it doesn't appear to be the case. What would my options here be for using this from java tests? This is related to a previous hsqldb question here starting and stopping hsqldb from unit tests Use a file: database instead of mem:, but include "files_readonly=true" in the properties file. Changes

OpenEJB Local Client Injection Fails

有些话、适合烂在心里 提交于 2019-12-04 10:58:21
Note that I'm mirroring the example given here very closely. In fact, my situation is somewhat simpler as I'm not even testing with a persistence unit at this point. My test project provides a simple MDB and a session bean; both the MDB and the session bean are getting loaded as normal, and can be successfully tested (in a constrained fashion) without injection. The suggested injection with the @LocalClient annotation on my unit tests is failing with the known error: javax.naming.NamingException: Unable to find injection meta-data for [your-class]. Ensure that class was annotated with @org

How to do ASP.NET Web API integration tests with authorize attribute

痞子三分冷 提交于 2019-12-04 10:50:26
I do have authorize attribute applied on my Web API. I am calling Web API from MVC4 application in which I am using standard cookie based authentication. I need to call Web API method on controllers from integration tests but because authorize attribute is applied I will always receive unauthorized exception . What is the best way to solve this problem ? PS. I don't want (need) to use other methods of authentication such as APIKey,Token in Auth Header and similar... First of all, one key element in order to answer this question is to know what kind of authentication mechanism you use. For

Failing integration test for Apache Spark Streaming

醉酒当歌 提交于 2019-12-04 10:31:27
问题 I've been trying to track down an issue with some unit/integration tests I've been writing for an Apache Spark project. When using Spark 1.1.1 my test passed. When I tried to upgrade to 1.4.0 (also tried 1.4.1) the test starts failing. I've managed to reduce the code needed to reproduce the issue down to the small integration test below. Interestingly, if I comment out the @RunWith annotation on the test then the test passes correctly. Obviously I don't need the @RunWith annotation for this

SBT integration test setup

喜夏-厌秋 提交于 2019-12-04 10:26:10
问题 I would like to add an Integration Test phase to my SBT + Spray app. Ideally it would be just like Maven, with the following phases: compile : The app is built test : The unit tests are run pre-integration-test : The app is launched in a separate process integration-test : The integration tests are run; they issue requests to the app running in the background and verify that the correct results are returned post-integration-test : The instance of the app previously launched is shut down I'm

assert vs. verify in Selenium

允我心安 提交于 2019-12-04 10:12:39
问题 The checks selenium performs usually come in two flavours: assertFoo and verifyFoo. I understand that assertFoo fails the whole testcase whereas verifyFoo just notes the failure of that check and lets the testcase carry on. So with verifyFoo I can get test results for multiple conditions even if one of them fails. On the other hand, one failing check for me is enough to know, that my edits broke the code and I have to correct them anyway. So my question is: In which concrete situations do you

MVC Integration tests with Unity IoC

对着背影说爱祢 提交于 2019-12-04 09:39:52
Am trying Unity IoC, after using constructor based DI. Problem is trying to get integration tests working. http://patrick.lioi.net/2013/06/20/streamlined-integration-tests/ "Running your integration tests should exercise as much of the real system as is reasonably possible" Patrick above describes setting up an IoC inside the MVC Unit test project.. but I'm stuck as to how to implement public class HomeController : Controller { readonly IWinterDb db; // Unity knows that if IWinterDb interface is asked for, it will inject in a new WinterDb() public HomeController(IWinterDb db) { this.db = db; }

Test Environment.Exit() in C#

南笙酒味 提交于 2019-12-04 07:35:25
Is there in C# some kind of equivalent of ExpectedSystemExit in Java? I have an exit in my code and would really like to be able to test it. The only thing I found in C# is a not really nice workaround . Example Code public void CheckRights() { if(!service.UserHasRights()) { Environment.Exit(1); } } Test Code [TestMethod] public void TestCheckRightsWithoutRights() { MyService service = ... service.UserHasRights().Returns(false); ??? } I am using the VS framework for testing (+ NSubstitute for mocking) but it is not a problem to switch to nunit or whatever for this test. You should use

Capybara visit method is not working

爷,独闯天下 提交于 2019-12-04 07:31:33
I'm not sure what's going on, but I can't get simple tests to work because Capybara's visit method is not working for me. I've been trying to finish this railscast on testing . Once I get to the point where Capybara needs to visit the login page the test fails because it's only able to visit my root_url. Here's what the failure looks like. Note that it's failing because it can't even visit the login page. It's getting stuck on the homepage: Running: spec/requests/password_resets_spec.rb Running tests with args ["--color", "--failure-exit-code", "2", "--format", "progress", "--format", "Guard: