integration-testing

Create users in Factory Girl with OmniAuth?

自作多情 提交于 2020-01-14 10:14:30
问题 I am currently creating an application that uses OmniAuth to create and authenticate users. I am encountering problems during testing due to Factory Girl being unable to generate users without OmniAuth. I have several different ways to get factory girl to create users with omniauth but none have been successful. I have added the following 2 lines to my spec_helper file OmniAuth.config.test_mode = true \\ allows me to fake signins OmniAuth.config.add_mock(:twitter, { :uid => '12345', :info =>

Create users in Factory Girl with OmniAuth?

时间秒杀一切 提交于 2020-01-14 10:14:11
问题 I am currently creating an application that uses OmniAuth to create and authenticate users. I am encountering problems during testing due to Factory Girl being unable to generate users without OmniAuth. I have several different ways to get factory girl to create users with omniauth but none have been successful. I have added the following 2 lines to my spec_helper file OmniAuth.config.test_mode = true \\ allows me to fake signins OmniAuth.config.add_mock(:twitter, { :uid => '12345', :info =>

Reliable libraries out there for Spring boot redis integration tests

做~自己de王妃 提交于 2020-01-14 03:12:07
问题 This is more of a question for a tool - googling around I haven't really had much luck. So basically I have a standard spring boot app - and I have a unit test redis cache configuration. What I am looking to do is run the app context autowire some spring configs and test against a embedded redis cache if possible. Closest I have come is this https://github.com/kstyrc/embedded-redis. Problem with that is the lack of robust logging is making it difficult to run - its working locally, but when I

Force protractor to wait for seed data to load

﹥>﹥吖頭↗ 提交于 2020-01-13 19:53:12
问题 I have to load some seed data for my tests. I'm having a really hard time making sure the seed data has loaded completely before the tests begin running. In the beforeAll block I'm calling an adapter I wrote for my API that clears out any data, loads a specified file of seed data and then runs a callback passed in from the protractor test file. I can't include the test cases in a callback (this seems like it would be a similar blocking issue to refactoring to promises) or protractor doesn't

Karate vs Spock

不问归期 提交于 2020-01-13 18:58:50
问题 I've recently found Karate framework for testing Web Services. But there is also Spock framework providing similar ( to my mind ) functionality. What are the differences between the frameworks? I would like to suggest our testers to take a look at it. 回答1: Developer of Karate here. I have only read about Spock but here's my PoV. Karate is laser-focused on testing HTTP web-services, and therefore is designed to manipulate and perform assertions on JSON and XML. As a result - you do not need

Using Maven to build separate JAR files for unit testing a custom class loader

≡放荡痞女 提交于 2020-01-13 13:09:27
问题 As part of my current project I've created a custom class loader. Part of the unit tests for the custom loader involves using some JAR files to demonstrate the proper behavior of the loader. I'd like to build the test JAR files from Java sources ahead of running the actual unit tests. Further, the test JAR files cannot be on the class path when the unit tests are run, since I want to dynamically load them during the test execution. Is there a standard pattern for accomplishing this sort of

Integration Test Web Api With [Authorize]

。_饼干妹妹 提交于 2020-01-12 05:45:08
问题 So I've found bits and pieces that have enlightened me some on the [Authorize] tag, but nothing that solves my problem. My scenario is that I have Web Api methods that I want to hit with integration tests using RestSharp. However RestSharp is getting my login page, instead of the results of the call. [Authorize] public Item GetItem([FromBody] int id) { return service.GetItem(id); } The product uses a custom login system, and what I would REALLY like would be a way to disable the [Authorize]

Difference between Android Instrumentation test and Unit test in Android Studio?

放肆的年华 提交于 2020-01-11 14:47:50
问题 As of Android Studio 1.1rc there's Unit testing support and I'm wondering what's the difference between Android Instrumentation Tests and Unit tests. As I understand it: Unit tests are useful for testing code which doesn't call the Android API, and the Android instrumentation tests are rather integration tests to test Android API specific elements or GUI components. However if you use a framework like Robolectric or Mockito in your unit tests, you can test Android code (without the need of a

How to make NUnit stop executing tests on first failure

≯℡__Kan透↙ 提交于 2020-01-10 02:30:21
问题 We use NUnit to execute integration tests. These tests are very time consuming. Often the only way to detect a failure is on a timeout. I would like the tests to stop executing as soon as a single failure is detected. Is there a way to do this? 回答1: This is probably not the ideal solution, but it does what you require i.e. Ignore remaining tests if a test has failed. [TestFixture] public class MyTests { [Test] public void Test1() { Ascertain(() => Assert.AreEqual(0, 1)); } [Test] public void

How to mock response of Rest call in spring when you can't controll when the RestTemplate is constructed

爷,独闯天下 提交于 2020-01-07 04:20:24
问题 I want to write an integration level test for a rest method using MockRestServiceServer. My rest method is a proxy, it ends up creating a restTemplate via a static helper method and proxys the request to a third party. I want to mock out that third party. Actually two different rest calls are made to different parties with different configurations to service the request. I want to use MockRestServiceServer, but it expects me to pass in the restTemplate, which is constructed within my