title,body,link,tags,view_count,is_answered,score,answer_count
integration testing rabbitmq consumer,"<p>I have a simple consumer written in python using pika and rabbitmq.</p>

<p>The consumer connects to rabbitmq and listens on a queue. When a message arrives it transforms the message and publishes it on another queue.</p>

<p>Presented here: <a href=""https://bitbucket.org/snippets/fbanke/8e7zbX"" rel=""noreferrer"">https://bitbucket.org/snippets/fbanke/8e7zbX</a></p>

<p>I would like to make test cases to test the interaction between the consumer and the queue. For example, I would like to make sure that when a message is consumed the ""basic_ack"" function is called to let rabbitmq know that the message was processed. </p>

<p>Another test case is if the consumer reconnects to rabbitmq if the connection gets dropped.</p>

<p>And so on. I want to test the interaction between the consumer and the queue not the actual business logic in the consumer.</p>

<p>If I mock the pika objects it requires me to understand 100% how the API behaves and any misunderstanding of the API will result in faulty code. Code that passes the tests, but actually doesn't work.</p>

<p>I would rather test the consumer using a live queue, and manipulate it from the test to see if the consumer behaves as expected. </p>

<p>For example
1. setup the queue
2. start the consumer
3. publish a valid message to the queue
4. assert that the message was consumed by the worker</p>

<p>or </p>

<ol>
<li>setup the queue</li>
<li>start the consumer</li>
<li>kill the queue</li>
<li>assert that the worker terminated as expected</li>
</ol>

<p>Does there exist any best-practice on how to do this? I can find many examples of similar tests on databases, but not for queues. It seems that I need to start the consumer in a separate thread and work with it, but it seems that there is no infrastructure to support this.</p>
",https://stackoverflow.com/questions/48406143/integration-testing-rabbitmq-consumer,"['python', 'unit-testing', 'rabbitmq']",910,FALSE,6,0
Integration testing indexing operations,"<p>I am writing an integration test where <code>.saveObject()</code> is called and then I check that the object was indexed properly. </p>

<p>What is the correct method of integration testing Algolia? What is the correct method of waiting for the indexing operation to succeed?</p>
",https://stackoverflow.com/questions/52524880/integration-testing-indexing-operations,['algolia'],28,TRUE,0,1
SpringBoot Redis integration testing,"<p>I have an application with <code>MySQL</code> and <a href=""https://projects.spring.io/spring-boot/"" rel=""nofollow noreferrer"">SpringBoot</a>.</p>

<p>Redis is being used for caching with spring cache annotations. </p>

<p>Now, starting up Redis etc is not an issue as I am using Docker compose to dynamically allocate containers for testing. </p>

<p>But, what is the proper way of verifying that the data is actually being written and read from Redis cache not from <code>Mysql</code>? </p>
",https://stackoverflow.com/questions/49996632/springboot-redis-integration-testing,"['mysql', 'spring-boot', 'redis']",596,TRUE,0,2
HBase and Integration Testing,"<p>I have a Spark project which uses HBase as it's key/value store.  We've started as a whole implementing better CI/CD practices, and I am writing a python client to run integration tests against a self contains AWS environment.
<BR>
While I am able to easily submit our spark jobs and run them as EMR steps.  I haven't found a good way to interact with HBase from python.  My <strong>goal</strong> is to be able to run our code against sample HDFS data and then verify in HBase that I am getting the results I expected.  Can anyone suggest a good way to do this?
<BR>
<BR>
Additionally, my test sets are <em>very</em> small.  I'd also be happy if I could simply read the entire HBase table into memory and check it that way.  Would appreciate the communities input.</p>
",https://stackoverflow.com/questions/50594823/hbase-and-integration-testing,"['python', 'hbase', 'integration-testing']",187,FALSE,0,1
Integration testing spring boot,"<p>I'm trying to test my spring boot application.I'm doing integration testing but my test keeps on failing as the response returned by url cannot be jsonfied.please Help. 
Here is the test function:</p>

<pre><code>@Test
    public void testRetrieveStudentCourse() throws JSONException {

    HttpEntity&lt;String&gt; entity = new HttpEntity&lt;String&gt;(null, headers);

    ResponseEntity&lt;String&gt; response = restTemplate.exchange(
            createURLWithPort(""/student/getdetails/id""),
            HttpMethod.GET, entity, String.class);

    String expected = ""{\""id\"":1,\""rollno\"":\""2\"",\""Address\"":\""Chicago\""}"";

        JSONObject json = new JSONObject(response.getBody());

        JSONAssert.assertEquals(expected, json, false);

}
</code></pre>

<p>Error:</p>

<pre><code>org.json.JSONException: Value &lt;!DOCTYPE of type java.lang.String cannot be converted to JSONObject
    at org.json.JSON.typeMismatch(JSON.java:111)
    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:159)
    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:172)
    at testRetrieveStudentCourse(StudentControllerIT.java:41)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
</code></pre>
",https://stackoverflow.com/questions/50385233/integration-testing-spring-boot,"['spring-boot', 'junit', 'integration-testing']",661,TRUE,-1,2
Borders of integration testing,"<p>I want to be specific. So imagine Spring REST backend, which stores data in DB and also communicates to various other services via REST, WS etc.</p>

<p>What actually should be considered integration test?</p>

<p><strong>MVC</strong></p>

<p>Using Spring-test, MockMVC we can somehow skip deploy to speed up the testing. It enables to call http request and to test the whole flow. If I will skip it and deploy to application server it should be similar.</p>

<p><strong>What about remote REST services?</strong> </p>

<p>I guess I can mock beans in test context or I can start some Fake Rest service. Is one off the approaches disqualified from integration testing?</p>

<p><strong>What about DB?</strong></p>

<p>It is not easy to mock DB. So often you just start testing(H2) or some real DB directly. Maybe you can mock repositories, but is it integration?</p>

<p>I'm especially interest in connection with Maven's integration-test phase. Also how about the need for deployment of the app(as MockMVC and spring-test are kind of deploy without server), fake servers vs mocking the beans directly.</p>

<p><strong>Shortly where are the borders of integration testing.</strong> Is it really that opinionated as it seems at first glance?</p>
",https://stackoverflow.com/questions/52717259/borders-of-integration-testing,"['java', 'spring', 'integration-testing']",66,FALSE,0,0
Azure Functions HTTP integration testing,"<p>What is the best way to test AzureFunctions [C#, HTTP trigger] in local environment, using VisualStudio and XUnit?</p>

<p>Lets assume that I have following two Azure Functions:</p>

<ol>
<li>AF1: Parse JSON input and store to database</li>
<li>AF2: Generate XML file from data uploaded to database</li>
</ol>

<p>I would like to test them in following manner:</p>

<ol>
<li>Prepare a JSON and sent to first Azure Function by HTTP request</li>
<li>Azure function returns documentId in HTTP response </li>
<li>Send documentId to second AzureFunction by HTTP request</li>
<li>Test the output XML</li>
</ol>

<p>Is it possible to run those two AzureFunction simultaneously from XUnit environment ?
How to achieve that? I don't want to test the .dll with Azure Function itself, I would like to test it using HTTP requests.</p>
",https://stackoverflow.com/questions/53579818/azure-functions-http-integration-testing,"['c#', 'azure', 'visual-studio-2017', 'azure-functions', 'xunit']",1999,FALSE,5,1
Simple integration testing using Flutter,"<p>I am testing a flutter application. I am to run an integration testing, just like Espresso and Selenium allow UI testing, based on my reading, I got to understand that testing Flutter UI will require setting up the integration model. In Selenium <code>findById</code> and Espresso, we can use , <code>R.id.unique_element_id</code>.</p>

<p>I have tried undertsanding the unique id to reference widgets in Flutter but do not understand. Any simple test for a form like this</p>

<pre><code>mainAxisAlignment: MainAxisAlignment.center,
          children: &lt;Widget&gt;[
            new Text(
              'You have pushed the button this many times:',
            ),
            new TextFormField(
              decoration: new InputDecoration(
                  labelText: 'Enter your username'
              ),
            ),
            new TextFormField(
              decoration: new InputDecoration(
                  labelText: 'Enter your phone number'
              ),
              keyboardType: TextInputType.number,
            ),

            new Text(
              '$_counter',
              style: Theme.of(context).textTheme.display1,
            ),
          ],
</code></pre>

<p>Setup the test file like this</p>

<pre><code>    import 'package:flutter_driver/flutter_driver.dart';
    import 'package:test/test.dart';

    void main() {
      FlutterDriver driver;

      setUpAll(() async {
        driver = await FlutterDriver.connect();
      });

      tearDownAll(() async {
        if(driver != null){
          driver.close();
        }
      });


test('tap on the button, verify result', () async {
    final SerializableFinder username = find.byValueKey('usernametextfield');
    expect(username, isNotNull);
    //insert value into username

    final SerializableFinder phonenumber = find.byValueKey('phone');
    expect(phonenumber, isNotNull);
    //insert value into phonenumber
});
</code></pre>

<p>How do I create such a tetscase and run. the comments <code>//insert value into username</code> and <code>//insert value into phonenumber</code> are actual testcases I want to complete.</p>
",https://stackoverflow.com/questions/50472826/simple-integration-testing-using-flutter,"['widget', 'integration-testing', 'testcase', 'flutter-test']",2472,TRUE,3,3
Rails + RSpec - Integration Testing (Recommendations),"<p>I have a Vue app with a rails backend and I want to do some front-end/integration testing. I'm currently using <code>vue-router</code> and <code>turbolinks</code> on the front-end and <code>RSpec</code> for unit testing. </p>

<p>I tried using <code>Capybara</code> but <code>puma</code> always give me a routing error when a link is clicked and trying to get a route instead of having the vue router handle rendering the component. With the help of others, we suspect it's either that vue router is not loaded properly or turbolinks is interfering in some way. Does anyone have any suggestions on how to configure Capybara for this situation?</p>

<p>Or does anyone have recommendations on other tools/libraries that I can use for testing?</p>
",https://stackoverflow.com/questions/50437557/rails-rspec-integration-testing-recommendations,"['ruby-on-rails', 'vue.js', 'rspec', 'capybara', 'vue-router']",210,FALSE,2,0
AWS Lambda: Java Integration testing,"<p>Is there way to build proper integration test for few AWS Lambdas interacting each other via AWS SNS topic?</p>

<p>I deployed two lambdas using Java. </p>

<ul>
<li>The first one is subscribed to AWS SNS_topic#1. It filters and transforms SNS message and pushes modified data onto SNS_topic#2.</li>
<li>The second one lambda is subscribed to SNS_topic#2. It modifies SNS message and do http request onto external endpoint.</li>
</ul>

<p>I need to build end-to-end Integration test to check whole interaction.</p>
",https://stackoverflow.com/questions/51727850/aws-lambda-java-integration-testing,"['java', 'amazon-web-services', 'aws-lambda', 'integration-testing']",1637,TRUE,1,2
Spring Batch Step Integration Testing,"<p>I'm looking for some general opinions and advice on testing a Spring batch step and step execution.</p>

<p>My basic step reads in from an api, processes into an entity object and then writes to a DB. I have tested the happy path, that the step completes successfully. What I now want to do is test the exception handling when data is missing at the processor stage. I could test the processor class in isolation, but I'd rather test the step as a whole to ensure the process failure is reflected correctly at step/job level.</p>

<p>I've read the spring batch testing guidelines and if I'm honest, I'm slightly lost within it. Is it possible to use <strong>StepScopeTestUtils.doInStepScope</strong> or updating the <strong>StepExecution</strong> to test this scenario? Ideally I'd force the reader to return faulty data before the processor kicks in.</p>

<p>Any advice would be greatly appreciated. </p>
",https://stackoverflow.com/questions/49883513/spring-batch-step-integration-testing,"['spring', 'spring-boot', 'spring-batch']",530,TRUE,0,1
AWS-CDK Unit-Testing and Integration Testing,"<p>What is the proper way to unit-test and integration-test my newly built constructs? </p>

<p>What should be actually tested?
How should it be tested?</p>

<p>Thanks!</p>
",https://stackoverflow.com/questions/53566862/aws-cdk-unit-testing-and-integration-testing,['aws-cdk'],11385,TRUE,15,1
"integration testing, comparing JPA entities","<p>Consider you are doing some integration testing, you are storing some bigger entity into db, and then read it back and would like to compare it. Obviously it has some associations as well, but that's just a cherry on top of very unpleasant cake. How do you compare those entities? I saw lot of incorrect ideas and feel, that this has to be written manually. How you guys do that?</p>

<p>Issues:</p>

<ul>
<li>you cannot use equals/hashcode: these are for natural Id.</li>
<li>you cannot use subclass with fixed equals, as that would test different class and can give wrong results when persisting data as data are handled differently in persistence context.</li>
<li>lot of fields: you don't want to type all comparisons by hand. You want reflection.</li>
<li>@Temporal annotations: you cannot use trivial ""reflection equals"" approaches, because @Temporal(TIMESTAMP) java.util.Date &lt;> java.sql.Date</li>
<li>associations: typical entity you would like to have properly tested will have several associations, thus tool/approach ideally should support deep comparison. Also cycles in object graph can ruin the fun.</li>
</ul>

<p>Best solution what I found:</p>

<ul>
<li>don't use transmogrifying data types (like Date) in JPA entities.</li>
<li>all associations should be initialized in entity, because null &lt;> empty list.</li>
<li>calculate externaly toString via say ReflectionToStringBuilder, and compare those. Reason for that is to allow entity to have its toString, tests should not depend that someone does not change something. Theoretically, toString can be deep, but commons recursive toStringStyle includes object identifier, which ruins it.</li>
<li>I though, that I could use json format to string, but commons support that only for shallow toString, Jackson (without further instructions on entity) fails on cycles over associations</li>
</ul>

<p>Alternative solution would be actually declaring subclasses with generated id (say lombok) and use some automatic mapping tool (say remondis mapper), with option to overcome differences in Dates/collections.</p>

<p>But I'm listening. Does anyone posses better solution?</p>
",https://stackoverflow.com/questions/53557584/integration-testing-comparing-jpa-entities,"['jpa', 'reflection', 'integration-testing']",117,FALSE,0,0
Spring Integration Testing Service Layer,"<p>I have build a small application using Spring Integration. In which i have service activator, services and repository interface which are extending CrudRepository.
While writing jUnit Test cases for service i am problem. I wrote one test case as below but i try to run that. I am getting exception.</p>

<p>Test Cases</p>

<pre><code>@RunWith(SpringRunner.class)
@SpringBootTest
@ContextConfiguration(locations={""classpath:/medicineIntegration.xml"", ""classpath:/doseIntegration.xml""})
public class DoseServiceTest {

@Autowired
private DoseService doseService;

@MockBean
private DoseRepository doseRepository;

@Test
public void testSaveDose() {
    Dose dose = createDose();
    Mockito.when(doseRepository.save(dose)).thenReturn(dose);
    assertThat(doseService.saveDose(dose)).isEqualTo(dose);
}

private Dose createDose() {
    Dose dose = new Dose();
    dose.setDoseValue(""120"");
    return dose;
}
</code></pre>

<p>Below is the error i am getting while running the test case.</p>

<pre><code>Field medicineRepo in com.cerner.api.service.MedicineService required a bean 
of type 'com.cerner.api.dao.MedicineRepository' that could not be found.

The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'com.cerner.api.dao.MedicineRepository' in 
your configuration.

2018-12-10 22:57:14.261 ERROR 21524 --- [           main] 
o.s.test.context.TestContextManager      : Caught exception while allowing 
TestExecutionListener 
[org.springframework.test.context.web.ServletTestExecutionListener@32115b28] 
to prepare test instance [com.cerner.api.service.DoseServiceTest@2f0bfe17]

java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125) ~[spring-test-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108) ~[spring-test-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190) ~[spring-test-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132) ~[spring-test-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246) ~[spring-test-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227) ~[spring-test-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) ~[spring-test-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) ~[junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) ~[spring-test-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246) ~[spring-test-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) ~[spring-test-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) ~[junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) ~[junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) ~[junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) ~[junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) ~[junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) ~[spring-test-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) ~[spring-test-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.junit.runners.ParentRunner.run(ParentRunner.java:363) ~[junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) ~[spring-test-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89) ~[.cp/:na]
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41) ~[.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541) ~[.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763) ~[.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463) ~[.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209) ~[.cp/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 
'org.springframework.integration.config.ServiceActivatorFactoryBean#0': 
Cannot resolve reference to bean 'medicineServiceActivator' while setting 
bean property 'targetObject'; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'medicineServiceActivator': Unsatisfied dependency 
expressed through field 'medicineService'; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'medicineService': Unsatisfied dependency expressed 
through field 'medicineRepo'; nested exception is 
org.springframework.beans.factory.NoSuchBeanDefinitionException: No 
qualifying bean of type 'com.cerner.api.dao.MedicineRepository' available: 
expected at least 1 bean which qualifies as autowire candidate. Dependency 
annotations: 
{@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:378) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:110) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1648) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1400) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:827) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127) ~[spring-boot-test-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) ~[spring-test-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117) ~[spring-test-5.1.2.RELEASE.jar:5.1.2.RELEASE]
... 25 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'medicineServiceActivator': Unsatisfied 
dependency expressed through field 'medicineService'; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'medicineService': Unsatisfied dependency expressed 
through field 'medicineRepo'; nested exception is 
org.springframework.beans.factory.NoSuchBeanDefinitionException: No 
qualifying bean of type 'com.cerner.api.dao.MedicineRepository' available: 
expected at least 1 bean which qualifies as autowire candidate. Dependency 
annotations: 
{@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:367) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
... 43 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'medicineService': Unsatisfied dependency e 
expressed through field 'medicineRepo'; nested exception is 
org.springframework.beans.factory.NoSuchBeanDefinitionException: No 
qualifying bean of type 'com.cerner.api.dao.MedicineRepository' available: 
expected at least 1 bean which qualifies as autowire candidate. Dependency 
annotations: 
{@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1239) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
... 53 common frames omitted
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: 
No qualifying bean of type 'com.cerner.api.dao.MedicineRepository' 
available: expected at least 1 bean which qualifies as autowire candidate. 
Dependency annotations: 
{@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1646) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1205) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
... 66 common frames omitted
</code></pre>

<p>I am not sure why the bean in not getting instantiated for the Repositories(Interfaces) 
Thanks In advance for the help.</p>

<p><strong>Updated</strong></p>

<p>Below the service class.</p>

<pre><code>@Service
@Qualifier
public class MedicineService {

@Autowired
private MedicineRepository medicineRepo;

private Logger log = LoggerFactory.getLogger(this.getClass().getName());

public List&lt;Medicine&gt; getAllMedicines() {
    List&lt;Medicine&gt; medicine = new ArrayList&lt;Medicine&gt;();
    medicineRepo.findAll().forEach(medicine::add);
    log.info(""Returning from service with medicine data"");
    return medicine;
}

public Medicine saveMedicine(Medicine medicine) {
    return medicineRepo.save(medicine);
}

public Medicine updateMedicine(Medicine medicine) {
    return medicineRepo.save(medicine);
}

public void deleteMedicine(int id) {
    medicineRepo.deleteById(id);
}
}
</code></pre>

<p>Repository Interface</p>

<pre><code>@Repository
public interface MedicineRepository extends CrudRepository&lt;Medicine,Integer&gt; 
{

}
</code></pre>
",https://stackoverflow.com/questions/53710968/spring-integration-testing-service-layer,"['spring', 'spring-boot', 'junit', 'spring-integration', 'beancreationexception']",1893,FALSE,0,0
Integration testing C# WebAPI asp.NET Framework 4.6.1,"<p>I am trying to write integration tests in C# for my C# asp.NET Framework 4.6.1 WebAPI which contains simple CRUD functionalities.</p>

<p>I have found little to no documentation on making automated integration tests for .NET Framework 4.6.1 using Microsoft.AspNet.WebApi 5.2.4. 
I've only found relatively old articles and video's on making integration tests for .NET Core using Xunit and Nunit, but ran into a lot of compatibility issues while trying to somehow make them work on .NET Framework 4.6.1 and WebApi 5.2.4.</p>

<p>I know this question could be considered primarily opinion based, but I would really appreciate any help on the matter.</p>

<p><strong>How to write automated tests for an .NET Framework 4.6.1 Microsoft.AspNet.WebApi 5.2.4 application?</strong></p>

<ul>
<li>Which packages could I use?</li>
<li>How do I configure these packages properly?</li>
<li>How should I use these packages?</li>
</ul>

<p>I currently do not use Owin for hosting my application, but invoke my configurations in Global.asax, but I could create a solution configuration which builds the project using Owin if needed.</p>
",https://stackoverflow.com/questions/51505680/integration-testing-c-webapi-asp-net-framework-4-6-1,"['c#', 'asp.net', 'asp.net-web-api']",7020,TRUE,12,1
c# nunit integration testing with exceptions,"<p>I have a test I created which looks like this:</p>

<pre><code>[Test]
public async Task MemberCannotCreateConfirmedUser()
{
    var services = UserContext.GivenServices();
    await services.LoginAsync(new Claim(""User"", ""Member""));
    Assert.That(await services.WhenCreateUserAsync(""AAAB"", ""AAAB"", ""AAAB"", ""FIN"", emailConfirmed: true), Throws.TypeOf&lt;ArgumentException&gt;());
}
</code></pre>

<p>And the code that actually throws the error looks like this:</p>

<pre><code>var principal = _httpContext.User as ClaimsPrincipal;
var isAdmin = principal?.FindFirst(""Administrator"") != null;
if (!isAdmin)
{
    if (model.EmailConfirmed) throw new ArgumentException(""Only an administrator can confirm a new user"");
}
</code></pre>

<p>When I run the test, it fails and states: </p>

<blockquote>
  <p>System.ArgumentException : Only an administrator can confirm a new user</p>
</blockquote>

<p>But surely that is what I am testing for. It should pass because it throws an <code>ArgumentException</code> error?</p>
",https://stackoverflow.com/questions/48690399/c-nunit-integration-testing-with-exceptions,"['c#', 'async-await', 'nunit', 'integration-testing']",432,TRUE,2,1
Using TestRestTemplate for Spring Integration Testing,"<p>I am learning Spring Integration testing and using <code>org.springframework.boot.test.web.client.TestRestTemplate</code>.
My <code>Spring Boot version is 2.0.2</code> and with some default configuration.</p>

<p>My Test class is : </p>

<pre><code>@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT)
public class UserControllerIntegrationTest {

    @Autowired
    TestRestTemplate restTemplate;      

    String userBaseUrl = ""/api/user/"";

    UserDto userDto;

    @Before
    public void setUp() {

        EnhancedRandom er = EnhancedRandomBuilder.aNewEnhancedRandomBuilder().collectionSizeRange(1, 1).build();

        userDto = er.nextObject(UserDto.class);     

    }

    @Test
    public void registerUser() throws Exception{

        ResponseEntity&lt;ServiceResponse&gt; responseEntity = restTemplate.postForEntity(userBaseUrl+""register_user"", userDto, ServiceResponse.class);
        assertEquals(responseEntity.getStatusCode(), HttpStatus.OK);
    }
    }
</code></pre>

<p>And controller endpoint method is :</p>

<pre><code>@RequestMapping(value=""register_user"",method = RequestMethod.POST)  
    public ResponseEntity&lt;ServiceResponse&gt; registerUser(@RequestHeader HttpHeaders headers, @RequestBody UserDto userDto) {

        log.info(""Register user"");

        try {           
            ServiceResponse serviceResponse = new ServiceResponse(""Users listed successfully""); 

            serviceResponse.setData(userService.registerUser(userDto));

            return new ResponseEntity&lt;ServiceResponse&gt;(serviceResponse,HttpStatus.OK);

        } catch (Exception e) {
            GeneralUtil.logError(log, ""Error Occurred listing users"", e);
            HttpHeaders httpHeaders = ServiceResponse.generateRuntimeErrors(e);
            return new ResponseEntity&lt;&gt;(httpHeaders, HttpStatus.EXPECTATION_FAILED);
        }
    }
</code></pre>

<p>And ServiceResponse is :</p>

<pre><code>public class ServiceResponse {

    private Boolean success;
    private String message;
    private Map&lt;String, Object&gt; params;
    private List&lt;?&gt; list;
    private Object data;
//getters,setters.
    }
</code></pre>

<p>This API endpoint works well when we test manually but doesn't work while running tests.It gives this error :</p>

<pre><code>org.springframework.web.client.RestClientException: Error while extracting response for type [class com.eeposit.lattice.util.ServiceResponse] and content type [application/json;charset=UTF-8]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot construct instance of `com.eeposit.lattice.util.ServiceResponse` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `com.eeposit.lattice.util.ServiceResponse` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)
 at [Source: (PushbackInputStream); line: 1, column: 2]
    at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:115)
    at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:991)
    at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:974)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:725)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:680)
    at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:466)
    at org.springframework.boot.test.web.client.TestRestTemplate.postForEntity(TestRestTemplate.java:502)
    at com.eeposit.lattice.controller.UserControllerIntegrationTest.registerUser(UserControllerIntegrationTest.java:61)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:73)
    at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:83)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:539)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:761)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:461)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:207)
Caused by: org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot construct instance of `com.eeposit.lattice.util.ServiceResponse` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `com.eeposit.lattice.util.ServiceResponse` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)
 at [Source: (PushbackInputStream); line: 1, column: 2]
    at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:241)
    at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.read(AbstractJackson2HttpMessageConverter.java:223)
    at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:100)
    ... 39 more
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `com.eeposit.lattice.util.ServiceResponse` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)
 at [Source: (PushbackInputStream); line: 1, column: 2]
    at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
    at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1342)
    at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1031)
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1290)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:326)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4001)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3072)
    at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:235)
    ... 41 more
</code></pre>

<p>I tried to solve this issue googling but cannot fix the issue.</p>
",https://stackoverflow.com/questions/50719416/using-testresttemplate-for-spring-integration-testing,"['java', 'spring', 'spring-boot', 'jackson', 'integration-testing']",4342,TRUE,2,2
Integration testing ASP.NET MVC when async,"<p>I am looking for guidance on setting up the synchronization context for a complex integration test where the SUT includes async ASP.NET actions.</p>

<p>I have a mock HttpContext and can exercise synchronous action methods.  But async actions often fail with HttpContext.Current null.  From reading around, I think I need to call SynchronizationContext.SetSynchronizationContext in order to get the HttpContext.Current to be ""moved"" from one thread to another as the async operations proceed.</p>

<p>I've tried:</p>

<ul>
<li>A simple TestSynchronizationContext similar to <a href=""https://searchcode.com/codesearch/view/2570920/"" rel=""nofollow noreferrer"">this</a> - still fails with null HttpContext.Current</li>
<li>Instantiate an AspNetSynchronizationContext using reflection - not managed yet as class and dependencies are internal which makes this really difficult</li>
</ul>

<p>Any suggestions?</p>
",https://stackoverflow.com/questions/48991763/integration-testing-asp-net-mvc-when-async,"['c#', 'asp.net-mvc', 'unit-testing', 'async-await']",223,TRUE,2,1
Laravel integration testing for SSO NotFoundHttpException,"<p>I need a help with my integration testing. I do have a project on localhost and SSO on localhost:8081 port. When I change base_url for SSO and send a request it throws Exception since the routing of login page not in the local project but inside SSO. How can I test external SSO and local project together?</p>

<pre><code> public function testLogin() 
 {
   config(['app.url' =&gt; 'http://192.168.33.11:8081']);

   $this-&gt;visit('/login?service_id=2')
       -&gt;type('name', 'name')
       -&gt;type('password', 'password');
       -&gt;press('Log in')
       -&gt;see('dashboard')
       -&gt;onPage('dashboard.index');
  }
</code></pre>

<p>And the Exception</p>

<pre><code>  There was 1 failure:
  1) ExampleTest::testLogin
  A request to [http://192.168.33.11:8081/login?service_id=2] failed. 
  Received status code [404].
  Caused by
  Symfony\Component\HttpKernel\Exception\NotFoundHttpException in 
  C:\...vendor\laravel\framework\src\Illuminate\Routing\RouteCollection.php:161
</code></pre>
",https://stackoverflow.com/questions/49604816/laravel-integration-testing-for-sso-notfoundhttpexception,"['laravel', 'single-sign-on', 'integration-testing']",109,FALSE,1,0
How to do integration testing when using Mybatis and different DB for Integration testing and development,"<p>I am using MyBatis for developing my application . Now i have stumbled upon a situation where the sql query should return last inserted id to me , </p>

<p>I am using MySql for development and H2 DB for Integration Testing . </p>

<p>In MySql we use last_insert_id() function to get this id but in H2 DB we use currval() functiton . Even if i use sequence in MySql still this syntax would be different . </p>

<p>The question now is how am i suppose to write integration testing code . Since same query what i have written for the development is used for integration testing . what i should do in this kind of situation </p>
",https://stackoverflow.com/questions/51018566/how-to-do-integration-testing-when-using-mybatis-and-different-db-for-integratio,"['java', 'mysql', 'integration-testing', 'h2', 'mybatis']",786,TRUE,0,2
EventStore integration testing with in-memory node,"<p>I'd like to write some integration tests using www.eventstore.org to test that I am able to serialize some domain events and append them to a stream, and retrieve them and deserialize them, etc.</p>

<p>I've been trying to find how people generally do that and I read some Greg Young's answer (a bit outdated) about different approaches:</p>

<ol>
<li>I could generate different streams each time I execute my integration tests, but I prefer not to do so and not to pollute an event store with test data</li>
<li>I could use an in-memory event store.</li>
</ol>

<p>The second option seems ideal because I could simply run a clean event store, run my tests and stop the server at the end so that all the data is gone.</p>

<p>I've seen that it's possible to run the event store server with a parameter <code>--mem-db</code> not to persist anything in disk.</p>

<p>The question is: how to use an in-memory event store when running integration tests if, most likely, the OS where the tests are running has no event store binaries installed and therefore there's no real event store server to run in memory? I don't want my tests to fail just because there's no event store installed and up and running on the machine executing the tests.</p>

<p>I know some databases in the market have some nuGet package that contains the same DB engine used in production but as an in-memory DB so that no ""real"" server is needed on the machine to run the tests. All binaries are in a DLL available for the project.</p>

<p>I tried to find some answers on whether something like this is available for event store. I read some comments of people talking about some Embedded client API but the documentation I found is not very clear. Other comments mention something called MiniNode but, again, the threads assume too much and haven't yet found a clear description of what's that about or how could I use for my tests.</p>

<p>In summary, could anybody provide an example of an integration test (xUnit if possible) where the <code>IEventStoreConnection</code> is using an in-memory event store where there's no event store installed at all?</p>

<p><strong>UPDATE 1</strong>: I tried to add the nuGet dependency <a href=""https://www.nuget.org/packages/EventStore.Client.Embedded"" rel=""nofollow noreferrer"">EventStore.Client.Embedded</a> to play with it just in case it was what I needed. But it does not have support for DotNetCore (standard 2.0) so I cannot tell. Then I read this <a href=""https://github.com/EventStore/ClientAPI.NetCore/issues/18"" rel=""nofollow noreferrer"">ClientAPI.NetCore issue</a> where somebody suggests to go with a different approach for testing, which is using Chocolatey to grab <code>EventStore</code> and then execute from the code the <code>EventStore.ClusterNode</code> (I would do that with the <code>--mem-db</code> flag). I'm not sure I like that, at least no more than using Docker for the same purpose. I am still wondering whether there's an alternative?</p>

<p><strong>UPDATE 2</strong> Since I am using gitlab, I run my integration tests with Event Store by spinning up an event store service (container) that will terminate as soon as the Continuous Integration step ends.</p>

<pre><code>integration-tests:
  image: my-images-repo/my-gitlab-runner-dotnet-core:latest
  stage: integration-tests  
  services:
    # add event store service
    - eventstore/eventstore:release-4.1.1-hotfix1    
  variables:
    # event store service params testing with standard ports
    EVENTSTORE_INT_TCP_PORT: ""1113""
    EVENTSTORE_EXT_TCP_PORT: ""1113""
    EVENTSTORE_INT_HTTP_PORT: ""2113""
    EVENTSTORE_EXT_HTTP_PORT: ""2113""
    EVENTSTORE_EXT_HTTP_PREFIXES: ""http://*:2113/""   
  script:
    - dotnet restore --no-cache --force
    - dotnet build --configuration Release
    - dotnet vstest *IntegrationTests/bin/Release/**/*IntegrationTests.dll
</code></pre>

<p>This does yet answer my question but it's a solution for my needs.</p>

<p><strong>UPDATE 3:</strong> (21 June 2019) There is still not support for the embedded client in netstandard 2.0 so I cannot use it to launch an in-memory node for testing purposes. There's however another option using docker described <a href=""https://github.com/linedata/reactive-domain/blob/c2aa6b8ee6527406a8458f4093af4e61dd268749/src/ReactiveDomain.Testing/EmbeddedEventStoreFixture.cs"" rel=""nofollow noreferrer"">here</a></p>

<p>Also the EventStore C# API are now in the nuGet <a href=""https://www.nuget.org/packages/EventStore.Client/"" rel=""nofollow noreferrer"">EventStore.Client</a> (currently 5.0.1)</p>
",https://stackoverflow.com/questions/53688783/eventstore-integration-testing-with-in-memory-node,"['c#', 'asp.net-core', 'integration-testing', 'in-memory', 'eventstoredb']",1030,FALSE,8,0
Integration testing with Nuxt and Jest,"<p>I wish to render a page using Nuxt's <code>renderAndGetWindow</code> in order to test the values returned by my API.</p>

<p>Here's how I do it:</p>

<pre><code>// Nuxt instance
let nuxt = null;
// Our page to test
let homePage = null;

beforeAll(async (done) =&gt; {
    // Configuration
    const rootDir = resolve(__dirname, '../..');
    let config = {};
    config = require(resolve(rootDir, 'nuxt.config.js'));
    config.rootDir = rootDir; // project folder
    config.env.isDev = false; // dev build
    config.mode = 'universal'; // Isomorphic application

    nuxt = new Nuxt(config);
    await new Builder(nuxt).build();
    nuxt.listen(3001, 'localhost');
    homePage = await nuxt.renderAndGetWindow('http://localhost:3001/');
  });
</code></pre>

<p>Which gives me 2 distinct errors:</p>

<blockquote>
  <p>console.error node_modules/jest-jasmine2/build/jasmine/Env.js:157
      Unhandled error</p>
  
  <p>console.error node_modules/jest-jasmine2/build/jasmine/Env.js:158
      TypeError: setInterval(...).unref is not a function</p>
</blockquote>

<p>And</p>

<blockquote>
  <p>Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.</p>

<pre><code> at mapper (node_modules/jest-jasmine2/build/queue_runner.js:41:52)
</code></pre>
</blockquote>

<p>I get this ever since I switched from Ava to Jest.</p>

<p>Am I handling my rendering wrong?</p>
",https://stackoverflow.com/questions/52493255/integration-testing-with-nuxt-and-jest,"['jasmine', 'jestjs', 'nuxt.js']",2288,TRUE,1,1
Spring integration testing flow with exception,"<p>I'm trying to test the flow, specifically when an exception is thrown, but for some reason I'm not getting anything in the <code>errorsFromSend</code> channel.</p>

<p>Here is the gateway:</p>

<pre><code>@MessagingGateway
public interface Send
{
  @Gateway(requestChannel = ""sending"", 
           headers = @GatewayHeader(name = ""errorChannel"", expression = ""@errorsFromSend""))
  void send(final String s);
}
</code></pre>

<p>the transformer that throws exception for <code>input = ""xyz""</code>:</p>

<pre><code>public class Transformer {
  public String transform(final String s) {
    if(s.equals(""xyz"")) {
      throw new RuntimeException(""xyz"");
    }
    log.debug(s);

    return s;
  }

  private final Logger log = LoggerFactory.getLogger(this.getClass().getName());
}
</code></pre>

<p>and here is the test with context:</p>

<pre><code>@RunWith(SpringRunner.class)
@EnableIntegration
@ComponentScan(basePackageClasses= {sample.Send.class})
@ContextConfiguration(classes = {SendWithFlowTestConfiguration.class})
public class SendWithFlowTest {
  @Test
  public void testReceiving() throws Exception {
    // arrange
    final String payload1 = ""123"";
    final String payload2 = ""ABC"";
    final String payload3 = ""xyz"";
    // act and assert
    send.send(payload3);
    send.send(payload1);
    send.send(payload2);

    Message&lt;?&gt; fromErrorsFromSend = errorsFromSend.receive(100); // returns null!
    Assertions.assertThat(fromErrorsFromSend.getPayload()).isEqualTo(payload3);
    fromErrorsFromSend = errorsFromSend.receive(0);
    Assertions.assertThat(fromErrorsFromSend).isEqualTo(null);
    // verify
  }

  @Autowired
  private QueueChannel errorsFromSend;

  @Autowired
  private Send send;
}

@Configuration
@EnableIntegration
@IntegrationComponentScan
class SendWithFlowTestConfiguration {
  @Bean(name = PollerMetadata.DEFAULT_POLLER)
  public PollerMetadata poller() {
    return Pollers.fixedRate(1)
                  .maxMessagesPerPoll(1)
                  .get();
  }

  @Bean
  public DirectChannel receiving() {
    return new DirectChannel();
  }

  @Bean
  public QueueChannel sending() {
    return new QueueChannel();
  }

  @Bean
  public QueueChannel errorsFromSend() {
    return new QueueChannel();
  }

  @Bean
  public Transformer transformer() {
    return new Transformer();
  }

  @Bean
  @Value(""2"")
  public TaskExecutor executor(final int poolSize) {
    return new TaskExecutorAdapter(Executors.newFixedThreadPool(poolSize));
  }

  @Bean
  public IntegrationFlow flow(@Qualifier(""executor"") final TaskExecutor executor) {
    return IntegrationFlows.from(sending())
                           .channel(MessageChannels.executor(""receiving"", executor).get())
                           .transform(transformer())
                           .handle(m -&gt; System.out.println(""&gt;&gt; "" + m.getPayload()))
                           .get();
  }
}
</code></pre>

<p>Can someone let me know why <code>errorsFromSend</code> channel does not get the exception? Here is the trimmed log, as per Gary's suggestion: </p>

<pre><code>[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
[main      ] DEBUG Identified candidate component class: file [C:\stash\sample\bin\main\sample\SampleApplication.class]
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.condition.BeanTypeRegistry'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.AutoConfigurationPackages'
[main      ] DEBUG @EnableAutoConfiguration was declared on a class in the package 'sample'. Automatic @Repository and @Entity scanning is enabled.
[main      ] DEBUG Identified candidate component class: file [C:\stash\sample\bin\main\sample\Send.class]
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.test.context.ImportsContextCustomizer$ImportsCleanupPostProcessor'
[main      ] DEBUG Creating shared instance of singleton bean 'IntegrationConfigurationBeanFactoryPostProcessor'
[main      ] DEBUG Creating shared instance of singleton bean 'propertySourcesPlaceholderConfigurer'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.test.mock.mockito.MockitoPostProcessor'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.context.event.internalEventListenerProcessor'
[main      ] DEBUG Creating shared instance of singleton bean 'DefaultConfiguringBeanFactoryPostProcessor'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.context.event.internalEventListenerFactory'
[main      ] INFO  No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
[main      ] INFO  No bean named 'taskScheduler' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.
[main      ] DEBUG SpEL function '#xpath' isn't registered: there is no spring-integration-xml.jar on the classpath.
[main      ] INFO  No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.test.mock.mockito.MockitoPostProcessor$SpyPostProcessor'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.aop.config.internalAutoProxyCreator'
[main      ] DEBUG Creating shared instance of singleton bean 'persistenceExceptionTranslationPostProcessor'
[main      ] DEBUG Autowiring by type from bean name 'persistenceExceptionTranslationPostProcessor' via factory method to bean named 'environment'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.integration.internalMessagingAnnotationPostProcessor'
[main      ] DEBUG Creating shared instance of singleton bean 'integrationDisposableAutoCreatedBeans'
[main      ] INFO  Bean 'integrationDisposableAutoCreatedBeans' of type [org.springframework.integration.config.annotation.Disposables] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[main      ] DEBUG Creating shared instance of singleton bean 'integrationManagementConfigurer'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.integration.config.IntegrationManagementConfiguration'
[main      ] INFO  Bean 'org.springframework.integration.config.IntegrationManagementConfiguration' of type [org.springframework.integration.config.IntegrationManagementConfiguration$$EnhancerBySpringCGLIB$$7474d083] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.integration.dsl.context.IntegrationFlowBeanPostProcessor'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.integration.dsl.IntegrationFlowDefinition$ReplyProducerCleaner'
[main      ] DEBUG Creating shared instance of singleton bean 'globalChannelInterceptorProcessor'
[main      ] DEBUG Creating shared instance of singleton bean 'sendWithFlowTestConfiguration'
[main      ] DEBUG Creating shared instance of singleton bean 'sampleApplication'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.integration.context.defaultPollerMetadata'
[main      ] DEBUG Creating shared instance of singleton bean 'receiving'
[main      ] DEBUG Creating shared instance of singleton bean 'integrationGlobalProperties'
[main      ] DEBUG Creating shared instance of singleton bean 'messageBuilderFactory'
[main      ] DEBUG Creating shared instance of singleton bean 'mergedIntegrationGlobalProperties'
[main      ] DEBUG Creating shared instance of singleton bean 'datatypeChannelMessageConverter'
[main      ] DEBUG Creating shared instance of singleton bean 'sending'
[main      ] DEBUG Creating shared instance of singleton bean 'errorsFromSend'
[main      ] DEBUG Creating shared instance of singleton bean 'transformer'
[main      ] DEBUG Creating shared instance of singleton bean 'executor'
[main      ] DEBUG Creating shared instance of singleton bean 'flow'
[main      ] DEBUG Autowiring by type from bean name 'flow' via factory method to bean named 'executor'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.integration.dsl.context.IntegrationFlowContext'
[main      ] DEBUG Creating shared instance of singleton bean 'flow.bridge#0'
[main      ] DEBUG Creating shared instance of singleton bean 'flow.org.springframework.integration.config.ConsumerEndpointFactoryBean#0'
[main      ] DEBUG Creating shared instance of singleton bean 'flow.org.springframework.integration.transformer.MethodInvokingTransformer#0'
[main      ] DEBUG Creating shared instance of singleton bean 'flow.transformer#0'
[main      ] DEBUG Creating shared instance of singleton bean 'flow.org.springframework.integration.config.ConsumerEndpointFactoryBean#1'
[main      ] DEBUG Creating shared instance of singleton bean 'flow.channel#0'
[main      ] DEBUG Creating shared instance of singleton bean 'flow.p2.SendWithFlowTestConfiguration$$Lambda$123/1338368149#0'
[main      ] DEBUG Creating shared instance of singleton bean 'flow.org.springframework.integration.config.ConsumerEndpointFactoryBean#2'
[main      ] DEBUG Creating shared instance of singleton bean 'channelInitializer'
[main      ] DEBUG Creating shared instance of singleton bean '$autoCreateChannelCandidates'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration'
[main      ] DEBUG Creating shared instance of singleton bean 'mbeanExporter'
[main      ] DEBUG Creating shared instance of singleton bean 'objectNamingStrategy'
[main      ] DEBUG Autowiring by type from bean name 'mbeanExporter' via factory method to bean named 'objectNamingStrategy'
[main      ] DEBUG Creating shared instance of singleton bean 'mbeanServer'
[main      ] DEBUG Found MBeanServer: com.sun.jmx.mbeanserver.JmxMBeanServer@5778826f
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.aop.AopAutoConfiguration$CglibAutoProxyConfiguration'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.aop.AopAutoConfiguration'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration'
[main      ] DEBUG Cannot find '.class' file for class [class org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration$$EnhancerBySpringCGLIB$$457d226d] - unable to determine constructor/method parameter names
[main      ] DEBUG Creating shared instance of singleton bean 'spring.info-org.springframework.boot.autoconfigure.info.ProjectInfoProperties'
[main      ] DEBUG Autowiring by type from bean name 'org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration' via constructor to bean named 'spring.info-org.springframework.boot.autoconfigure.info.ProjectInfoProperties'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration$IntegrationComponentScanConfiguration'
[main      ] DEBUG Creating shared instance of singleton bean 'send'
[main      ] DEBUG Creating shared instance of singleton bean 'integrationEvaluationContext'
[main      ] DEBUG Creating shared instance of singleton bean 'jsonPath'
[main      ] DEBUG Creating shared instance of singleton bean 'taskScheduler'
[main      ] INFO  Initializing ExecutorService 'taskScheduler'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration$IntegrationManagementConfiguration$EnableIntegrationManagementConfiguration'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration$IntegrationManagementConfiguration'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration$IntegrationConfiguration'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration'
[main      ] DEBUG Creating shared instance of singleton bean 'spring.integration-org.springframework.boot.autoconfigure.integration.IntegrationProperties'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.reactor.core.ReactorCoreAutoConfiguration'
[main      ] DEBUG Creating shared instance of singleton bean 'spring.reactor-org.springframework.boot.autoconfigure.reactor.core.ReactorCoreProperties'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration'
[main      ] DEBUG Cannot find '.class' file for class [class org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration$$EnhancerBySpringCGLIB$$9522ae2a] - unable to determine constructor/method parameter names
[main      ] DEBUG Creating shared instance of singleton bean 'spring.task.execution-org.springframework.boot.autoconfigure.task.TaskExecutionProperties'
[main      ] DEBUG Autowiring by type from bean name 'org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration' via constructor to bean named 'spring.task.execution-org.springframework.boot.autoconfigure.task.TaskExecutionProperties'
[main      ] DEBUG Creating shared instance of singleton bean 'taskExecutorBuilder'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.task.TaskSchedulingAutoConfiguration'
[main      ] DEBUG Creating shared instance of singleton bean 'taskSchedulerBuilder'
[main      ] DEBUG Creating shared instance of singleton bean 'spring.task.scheduling-org.springframework.boot.autoconfigure.task.TaskSchedulingProperties'
[main      ] DEBUG Autowiring by type from bean name 'taskSchedulerBuilder' via factory method to bean named 'spring.task.scheduling-org.springframework.boot.autoconfigure.task.TaskSchedulingProperties'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration'
[main      ] DEBUG Creating shared instance of singleton bean 'platformTransactionManagerCustomizers'
[main      ] DEBUG Creating shared instance of singleton bean 'spring.transaction-org.springframework.boot.autoconfigure.transaction.TransactionProperties'
[main      ] DEBUG Creating shared instance of singleton bean 'nullChannel'
[main      ] DEBUG Creating shared instance of singleton bean 'errorChannel'
[main      ] DEBUG Creating shared instance of singleton bean '_org.springframework.integration.errorLogger.handler'
[main      ] DEBUG Creating shared instance of singleton bean '_org.springframework.integration.errorLogger'
[main      ] DEBUG Creating shared instance of singleton bean 'integrationSimpleEvaluationContext'
[main      ] DEBUG Creating shared instance of singleton bean 'org.springframework.integration.config.IdGeneratorConfigurer#0'
[main      ] DEBUG Creating shared instance of singleton bean 'integrationLifecycleRoleController'
[main      ] DEBUG Creating shared instance of singleton bean 'integrationHeaderChannelRegistry'
[main      ] DEBUG Creating shared instance of singleton bean 'integrationArgumentResolverMessageConverter'
[main      ] DEBUG Creating shared instance of singleton bean 'integrationArgumentResolvers'
[main      ] DEBUG Creating shared instance of singleton bean 'integrationListArgumentResolvers'
[main      ] DEBUG 
Spring Integration global properties:

spring.integration.endpoints.noAutoStartup=
spring.integration.taskScheduler.poolSize=10
spring.integration.channels.maxUnicastSubscribers=0x7fffffff
spring.integration.channels.autoCreate=true
spring.integration.channels.maxBroadcastSubscribers=0x7fffffff
spring.integration.readOnly.headers=
spring.integration.messagingTemplate.throwExceptionOnLateReply=false

[main      ] DEBUG Registering beans for JMX exposure on startup
[main      ] DEBUG Autodetecting user-defined JMX MBeans
[main      ] DEBUG No global channel interceptors.
[main      ] DEBUG Starting beans in phase -2147483648
[main      ] INFO  Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
[main      ] INFO  Channel 'org.springframework.context.support.GenericApplicationContext@530612ba.errorChannel' has 1 subscriber(s).
[main      ] INFO  started _org.springframework.integration.errorLogger
[main      ] DEBUG Successfully started bean '_org.springframework.integration.errorLogger'
[main      ] INFO  Adding {transformer} as a subscriber to the 'receiving' channel
[main      ] INFO  Channel 'receiving' has 1 subscriber(s).
[main      ] INFO  started flow.org.springframework.integration.config.ConsumerEndpointFactoryBean#1
[main      ] DEBUG Successfully started bean 'flow.org.springframework.integration.config.ConsumerEndpointFactoryBean#1'
[main      ] INFO  Channel 'org.springframework.context.support.GenericApplicationContext@530612ba.flow.channel#0' has 1 subscriber(s).
[main      ] INFO  started flow.org.springframework.integration.config.ConsumerEndpointFactoryBean#2
[main      ] DEBUG Successfully started bean 'flow.org.springframework.integration.config.ConsumerEndpointFactoryBean#2'
[main      ] DEBUG Starting beans in phase 0
[main      ] INFO  started send
[main      ] INFO  started send
[main      ] DEBUG Successfully started bean 'send'
[main      ] DEBUG Starting beans in phase 1073741823
[main      ] INFO  started flow.org.springframework.integration.config.ConsumerEndpointFactoryBean#0
[main      ] DEBUG Successfully started bean 'flow.org.springframework.integration.config.ConsumerEndpointFactoryBean#0'
[main      ] DEBUG preSend on channel 'sending', message: GenericMessage [payload=xyz, headers={errorChannel=errorsFromSend, id=b4856e59-ef18-f9dc-bd24-fcbc4f733d2d, timestamp=1544719739311}]
[main      ] DEBUG postSend (sent=true) on channel 'sending', message: GenericMessage [payload=xyz, headers={errorChannel=errorsFromSend, id=b4856e59-ef18-f9dc-bd24-fcbc4f733d2d, timestamp=1544719739311}]
[cheduler-1] DEBUG postReceive on channel 'sending', message: GenericMessage [payload=xyz, headers={errorChannel=errorsFromSend, id=b4856e59-ef18-f9dc-bd24-fcbc4f733d2d, timestamp=1544719739311}]
[cheduler-1] DEBUG Poll resulted in Message: GenericMessage [payload=xyz, headers={errorChannel=errorsFromSend, id=b4856e59-ef18-f9dc-bd24-fcbc4f733d2d, timestamp=1544719739311}]
[main      ] DEBUG preSend on channel 'sending', message: GenericMessage [payload=123, headers={errorChannel=errorsFromSend, id=58c31c06-fe11-59cc-df6a-3dd55668998e, timestamp=1544719739312}]
[cheduler-1] DEBUG flow.bridge#0 received message: GenericMessage [payload=xyz, headers={errorChannel=errorsFromSend, id=b4856e59-ef18-f9dc-bd24-fcbc4f733d2d, timestamp=1544719739311}]
[main      ] DEBUG postSend (sent=true) on channel 'sending', message: GenericMessage [payload=123, headers={errorChannel=errorsFromSend, id=58c31c06-fe11-59cc-df6a-3dd55668998e, timestamp=1544719739312}]
[main      ] DEBUG preSend on channel 'sending', message: GenericMessage [payload=ABC, headers={errorChannel=errorsFromSend, id=b99fbb33-dcc7-b353-8f6a-310fc1b94a47, timestamp=1544719739313}]
[cheduler-1] DEBUG preSend on channel 'receiving', message: GenericMessage [payload=xyz, headers={errorChannel=errorsFromSend, id=b4856e59-ef18-f9dc-bd24-fcbc4f733d2d, timestamp=1544719739311}]
[main      ] DEBUG postSend (sent=true) on channel 'sending', message: GenericMessage [payload=ABC, headers={errorChannel=errorsFromSend, id=b99fbb33-dcc7-b353-8f6a-310fc1b94a47, timestamp=1544719739313}]
[cheduler-1] DEBUG postSend (sent=true) on channel 'receiving', message: GenericMessage [payload=xyz, headers={errorChannel=errorsFromSend, id=b4856e59-ef18-f9dc-bd24-fcbc4f733d2d, timestamp=1544719739311}]
[1-thread-1] DEBUG flow.transformer#0 received message: GenericMessage [payload=xyz, headers={errorChannel=errorsFromSend, id=b4856e59-ef18-f9dc-bd24-fcbc4f733d2d, timestamp=1544719739311}]
[cheduler-1] DEBUG postReceive on channel 'sending', message: GenericMessage [payload=123, headers={errorChannel=errorsFromSend, id=58c31c06-fe11-59cc-df6a-3dd55668998e, timestamp=1544719739312}]
[cheduler-1] DEBUG Poll resulted in Message: GenericMessage [payload=123, headers={errorChannel=errorsFromSend, id=58c31c06-fe11-59cc-df6a-3dd55668998e, timestamp=1544719739312}]
[cheduler-1] DEBUG flow.bridge#0 received message: GenericMessage [payload=123, headers={errorChannel=errorsFromSend, id=58c31c06-fe11-59cc-df6a-3dd55668998e, timestamp=1544719739312}]
[cheduler-1] DEBUG preSend on channel 'receiving', message: GenericMessage [payload=123, headers={errorChannel=errorsFromSend, id=58c31c06-fe11-59cc-df6a-3dd55668998e, timestamp=1544719739312}]
[cheduler-1] DEBUG postSend (sent=true) on channel 'receiving', message: GenericMessage [payload=123, headers={errorChannel=errorsFromSend, id=58c31c06-fe11-59cc-df6a-3dd55668998e, timestamp=1544719739312}]
[1-thread-2] DEBUG flow.transformer#0 received message: GenericMessage [payload=123, headers={errorChannel=errorsFromSend, id=58c31c06-fe11-59cc-df6a-3dd55668998e, timestamp=1544719739312}]
[cheduler-2] DEBUG postReceive on channel 'sending', message: GenericMessage [payload=ABC, headers={errorChannel=errorsFromSend, id=b99fbb33-dcc7-b353-8f6a-310fc1b94a47, timestamp=1544719739313}]
[cheduler-2] DEBUG Poll resulted in Message: GenericMessage [payload=ABC, headers={errorChannel=errorsFromSend, id=b99fbb33-dcc7-b353-8f6a-310fc1b94a47, timestamp=1544719739313}]
[cheduler-2] DEBUG flow.bridge#0 received message: GenericMessage [payload=ABC, headers={errorChannel=errorsFromSend, id=b99fbb33-dcc7-b353-8f6a-310fc1b94a47, timestamp=1544719739313}]
[cheduler-2] DEBUG preSend on channel 'receiving', message: GenericMessage [payload=ABC, headers={errorChannel=errorsFromSend, id=b99fbb33-dcc7-b353-8f6a-310fc1b94a47, timestamp=1544719739313}]
[cheduler-2] DEBUG postSend (sent=true) on channel 'receiving', message: GenericMessage [payload=ABC, headers={errorChannel=errorsFromSend, id=b99fbb33-dcc7-b353-8f6a-310fc1b94a47, timestamp=1544719739313}]
[1-thread-2] DEBUG 123
[1-thread-2] DEBUG preSend on channel 'flow.channel#0', message: GenericMessage [payload=123, headers={errorChannel=errorsFromSend, id=821dad29-8be4-5a5f-7369-d1393fb5790a, timestamp=1544719739319}]
&gt;&gt; 123
[1-thread-2] DEBUG postSend (sent=true) on channel 'flow.channel#0', message: GenericMessage [payload=123, headers={errorChannel=errorsFromSend, id=821dad29-8be4-5a5f-7369-d1393fb5790a, timestamp=1544719739319}]
[1-thread-2] DEBUG flow.transformer#0 received message: GenericMessage [payload=ABC, headers={errorChannel=errorsFromSend, id=b99fbb33-dcc7-b353-8f6a-310fc1b94a47, timestamp=1544719739313}]
[1-thread-2] DEBUG ABC
&gt;&gt; ABC
[1-thread-2] DEBUG preSend on channel 'flow.channel#0', message: GenericMessage [payload=ABC, headers={errorChannel=errorsFromSend, id=9aca3eed-c695-2054-ff18-5b1c62f60158, timestamp=1544719739319}]
[1-thread-2] DEBUG postSend (sent=true) on channel 'flow.channel#0', message: GenericMessage [payload=ABC, headers={errorChannel=errorsFromSend, id=9aca3eed-c695-2054-ff18-5b1c62f60158, timestamp=1544719739319}]
Exception in thread ""pool-1-thread-1"" 
org.springframework.integration.transformer.MessageTransformationException: Failed to transform Message; nested exception is org.springframework.messaging.MessageHandlingException: nested exception is java.lang.RuntimeException: xyz, failedMessage=GenericMessage [payload=xyz, headers={errorChannel=errorsFromSend, id=b4856e59-ef18-f9dc-bd24-fcbc4f733d2d, timestamp=1544719739311}], failedMessage=GenericMessage [payload=xyz, headers={errorChannel=errorsFromSend, id=b4856e59-ef18-f9dc-bd24-fcbc4f733d2d, timestamp=1544719739311}]
    at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:114)
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:123)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:162)
    at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:115)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:133)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.access$000(UnicastingDispatcher.java:53)
    at org.springframework.integration.dispatcher.UnicastingDispatcher$1.run(UnicastingDispatcher.java:114)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.messaging.MessageHandlingException: nested exception is java.lang.RuntimeException: xyz, failedMessage=GenericMessage [payload=xyz, headers={errorChannel=errorsFromSend, id=b4856e59-ef18-f9dc-bd24-fcbc4f733d2d, timestamp=1544719739311}]
    at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:107)
    at org.springframework.integration.transformer.AbstractMessageProcessingTransformer.transform(AbstractMessageProcessingTransformer.java:113)
    at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:108)
    ... 9 more
Caused by: java.lang.RuntimeException: xyz
    at sample.Transformer.transform(Transformer.java:12)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:170)
    at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:120)
    at org.springframework.integration.handler.support.MessagingMethodInvokerHelper$HandlerMethod.invoke(MessagingMethodInvokerHelper.java:1087)
    at org.springframework.integration.handler.support.MessagingMethodInvokerHelper.invokeHandlerMethod(MessagingMethodInvokerHelper.java:584)
    at org.springframework.integration.handler.support.MessagingMethodInvokerHelper.processInternal(MessagingMethodInvokerHelper.java:473)
    at org.springframework.integration.handler.support.MessagingMethodInvokerHelper.process(MessagingMethodInvokerHelper.java:317)
    at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:104)
    ... 11 more
</code></pre>
",https://stackoverflow.com/questions/53752767/spring-integration-testing-flow-with-exception,"['unit-testing', 'error-handling', 'spring-integration']",2029,TRUE,1,1
Spring Data Rest and integration testing,"<p>I'm writing some tests in order to test my application. I'm using Spring Boot 2.0.2.</p>

<p>Image the following sitution with
the following entity</p>

<pre><code>@Entity
public class Board extends BaseEntity {

    @Column(length = 128)
    @NotNull
    private String name;

    @OneToMany(cascade = CascadeType.REMOVE, orphanRemoval = true, mappedBy = ""board"")
    private Set&lt;Activity&gt; activities;

    ... ...
}
</code></pre>

<p>and the following repository</p>

<pre><code>@Repository
@RepositoryRestResource
public interface BoardRepository extends PagingAndSortingRepository&lt;Board, Long&gt; {}
</code></pre>

<p>Now the first step of the test that I want to do is to create a Board object, so my test starts with the following code</p>

<pre><code>import static org.junit.Assert.assertNotNull;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureMockMvc
public class BoardControllerRestIT {

    @Autowired
    private TestRestTemplate testRestTemplate;
    @Autowired
    private MockMvc mockMvc;
    @Autowired
    private ObjectMapper objectMapper;


    @Test
    public void testBoardCreation() throws Exception {
        Board b = new Board();
        b.setName(""gianni"");

        String responseFromTestRestTemplate = testRestTemplate.postForObject(""/crud/boards"", b, String.class);
        assertNotNull(responseFromTestRestTemplate);


        ResultActions resultActions = mockMvc.perform(
                post(""/crud/boards"")
                        .content(objectMapper.writeValueAsString(b))
                        .contentType(MediaType.APPLICATION_JSON));
        resultActions.andExpect(MockMvcResultMatchers.status().is2xxSuccessful());
        resultActions.andDo(mvcResult -&gt; {
            String responseFromMockMvc = mvcResult.getResponse().getContentAsString();
        });
    }
}
</code></pre>

<p>The problem is that, the responseFromTestRestTemplate variable is filled with the usual spring data rest response. 
Instead inside the responseFromMockMvc variable, the body is empty.</p>

<p>I want to use the mockMvc solution only because is more effective from the tests point of view, but without the body is impossible to go on.
The approach with the testRestTemplate was only an attemp to understand what's going on.</p>

<p>What I'm doing wrong?
Thank you</p>
",https://stackoverflow.com/questions/50783237/spring-data-rest-and-integration-testing,"['spring', 'spring-mvc', 'spring-boot', 'spring-data', 'spring-data-rest']",1238,TRUE,1,1
Alexa Skill Integration Testing using Postman,"<p>I am in the process of writing a Voice app for Google Home (using DialogFlow) and Amazon Alexa (AWS).  </p>

<p>Both voice apps back onto a custom .net WebAPI that serves the answers.</p>

<p>We have written a series of integration tests that test both the Natural Language Processing (Deriving the Intent) and also the backend service.  DialogFlow provide API access to their NLP making these integration tests pretty easy to set up.</p>

<p>I am in the process of porting the app to Alexa via AWS and want to perform the same set of integration tests against the AWS NLP but cannot see if this is possible.  Most of the testing for Alexa seems to be centered around testing Lambda functions (which we are not using). Does anybody know if it is possible to interact directly with an Alexa skill restfully?</p>
",https://stackoverflow.com/questions/53815115/alexa-skill-integration-testing-using-postman,"['amazon-web-services', 'postman', 'dialogflow-es', 'alexa', 'google-home']",821,TRUE,0,1
Integration testing with spring declarative caching,"<p>I'm trying to write integration tests for a Spring Boot 2 Application.</p>

<p>One test should test updating a value via REST. </p>

<pre><code>@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureTestEntityManager
@Transactional
public class TenantEndpointIT {
    @Autowired
    private TestRestTemplate template;

    @Autowired
    private TestEntityManager entityManager;

    @Test
    public void nok_updateValueForbidden() {

    }
}
</code></pre>

<p>Now, I thought the cleanest way was to create the value with the <code>TestEntityManager</code> in the @Before method, then test the REST endpoint in the actual test.</p>

<p><strong>But</strong> the service called by the REST Endpoint is annotated with Spring Caching annotations. So the test fails if I do that. I could use the service directly or make a second REST call. That creates problems with other tests using the same Value, because even if the DB is rolled-back, the cache seems to contain the value. (Now I'm using @DirtiesContext).</p>

<p>My question is, how do you correctly integration test services with @Cachable?
Is there a way to get the Cache and explicitly put/remove?
I tried autowiring a CacheManager, but it won't find one and fails.</p>
",https://stackoverflow.com/questions/50410062/integration-testing-with-spring-declarative-caching,"['spring', 'spring-boot', 'testing', 'caching', 'integration-testing']",854,TRUE,0,1
Spring Boot Integration Testing - Port Bound,"<p>I'm trying to write a Spring Boot integration test for a microservice I've written.  The microservices runs on port 8888.</p>

<p>This is my test class:</p>

<pre><code>import com.mydomain.app.MyAPI;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpEntity;
import org.springframework.http.ResponseEntity;


@RunWith(SpringRunner.class)
@SpringBootTest(classes = {MyAPI.class}, webEnvironment = WebEnvironment.RANDOM_PORT)
public class MyIntegrationTest {

    @Autowired
    private TestRestTemplate testRestTemplate;

    @Test
    public void contextLoads() {
    }

}
</code></pre>

<p>When I run the test without starting the microservice the test method passes fine - the context loads.  The problem is when I start the microservice then run the test.  I get an error saying that port 8888 is already in use.  I understand that it's in use because the microservice is bound to the port but I don't understand why WebEnvironment = RANDOM_PORT hasn't assigned a different port to the test sever than 8888.</p>

<p>Can anyone assist please?</p>
",https://stackoverflow.com/questions/50295908/spring-boot-integration-testing-port-bound,"['java', 'spring-boot', 'junit']",1099,FALSE,0,1
"Integration testing using SQL, JMS etc","<p>More of a doubt, than an issue. I have a Spring application which exposes both JMS and HTTP endpoints. I have a couple of databases it interacts with, a couple of other services it interfaces via HTTP(s).</p>

<p>Let us say, I want to develop an integration test suite for this application - using Cucumber, or the likes.</p>

<p>Do I provision a separate (preferably in-memory or mock) IT (integration test) environment before the suite starts up and tear it down after I'm done, or do I host it on my developer instance and run my IT against it?</p>

<p>Hosting it on my developer instance is a bit straight-forward, though I seem to have a liking for doing it in-situ, considering the number of external dependencies I can escape for running the test.</p>

<p>If someone has done the in-memory (or mock) way to achieve the same, do you have any resources to share?</p>
",https://stackoverflow.com/questions/51228869/integration-testing-using-sql-jms-etc,"['sql', 'jvm', 'cucumber', 'jms']",75,FALSE,0,1
Integration testing for google cloud spanner,"<p>Is it possible to launch in memory db like h2 or embedded cassandraunit. </p>

<p>I want to setup embedded spanner db without the needs of google credentials json which connects to a remote spanner db. Is it possible to do that ?</p>

<p>Any pointers for setting it up or testing would be appreciated. </p>
",https://stackoverflow.com/questions/50637066/integration-testing-for-google-cloud-spanner,"['google-cloud-platform', 'google-cloud-spanner']",519,FALSE,0,1
Python library for continuous integration testing,"<p>I'm trying to make a testing system for continuous integration and I want to be able to have checks that do specific operations, like formatting files in a specific way, and those checks need to have a flow to them. </p>

<p>Example:</p>

<pre><code>FormatFilesCheck(files):
    Test(see if formatter is installed)
    for prep in prework:
        Test(do prep)
        for file in files:
            Test(try formatting file)
    Test(clean up work)
</code></pre>

<p>I was wondering if there is a python library out there that handles test control. Obviously there is unittest but from what I can tell it's meant linear testing, i.e. testing with dependencies.</p>

<p>If unittest has this capability an example would be amazing.</p>

<p>*edit: What I'm really looking for is a framework with unittest like capabilities for error handling and assertions which allows me to write checks and have them plug into it.</p>

<p>Thanks ahead of time</p>
",https://stackoverflow.com/questions/49058338/python-library-for-continuous-integration-testing,"['python', 'continuous-integration', 'integration-testing']",109,TRUE,0,1
Integration Testing Forms with Nested Objects,"<p>I am using .NET Core with Boilerplate. I'm trying to unit test some new forms that require that I have nested objects with properties. The Integration Tests use <code>AbpAspNetCoreIntegratedTestBase&lt;Startup&gt;</code> which uses an instance of both <code>HttpClient</code> and <code>TestServer</code>.  The client has various types of methods at its disposal. There are GetAsync, PostAsync, SendSync and PutAsync methods just to name a few.  </p>

<p>I thought I had gotten comfortable with some of the methods and helper methods in this frame work and have been successful thus far.  However, I have a form with an Model called Vendor, the Vendor has an Address Model as part of the view model.  This is so I can reuse the Address View Model with other items in the application that also require Address(es).<br>
One of the helpers that is used with BoilerPlate is <code>GetUrl&lt;TController&gt;(string actionName, object queryStringParamsAsAnonymousObject)</code> Since this is a Post from a form I'm attempting to use <code>public Task&lt;HttpResponseMessage&gt; PostAsync(string requestUri, HttpContent content)</code> No matter what I'm attempting to do, I'm getting a 400 Bad Request response and my test fails before it even gets inside the controller method.  I'm at a loss of how to handle this.<br>
Here are my Models:</p>

<p><strong>VendorViewModel:</strong></p>

<pre><code>[AutoMap(typeof(Domains.Vendor))]
public class VendorViewModel : BaseViewModelEntity
{
    [Required]
    public string Name { get; set; }
    [Required]
    public string PointOfContact { get; set; }
    [Required]
    public string Email { get; set; }
    [Required]
    public int AddressId { get; set; }
    //[Required]
    //public string Address1 { get; set; }
    //public string Address2 { get; set; }
    //public string Address3 { get; set; }
    //[Required]
    //public string City { get; set; }
    //[Required]
    //public int State { get; set; }
    //[Required]
    //public string Zip { get; set; }
    //[Required]
    //public string Phone { get; set; }
    //public string Fax { get; set; }
    public AddressViewModel VendorAddress { get; set; }


    public VendorViewModel()
    {
        VendorAddress = new AddressViewModel();
    }

    public VendorViewModel(VendorDto vendor)
    {
        Id = vendor.Id;
        Name = vendor.Name;
        IsActive = vendor.IsActive;
        PointOfContact = vendor.PointOfContact;
        Email = vendor.Email;
        AddressId = vendor.AddressId;
        CreatorUserId = vendor.CreatorUserId;
        CreationTime = vendor.CreationTime;
        DeleterUserId = vendor.DeleterUserId;
        DeletionTime = vendor.DeletionTime;
        LastModificationTime = vendor.LastModificationTime;
        LastModifierUserId = vendor.LastModifierUserId;
        //Address1 = vendor.Address.Address1;
        //Address2 = vendor.Address.Address2;
        //Address3 = vendor.Address.Address3;
        //City = vendor.Address.City;
        //State = vendor.Address.State;
        //Zip = vendor.Address.Zip;
        //Phone = vendor.Address.Phone;
        //Fax = municipalities.Address.Fax;
       VendorAddress = new AddressViewModel()
        {
            Id = vendor.Address.Id,
            Address1 = vendor.Address.Address1,
            Address2 = vendor.Address.Address2,
            Address3 = vendor.Address.Address3,
            City = vendor.Address.City,
            State = vendor.Address.State,
            Zip = vendor.Address.Zip,
            Phone = vendor.Address.Phone,
            Fax = vendor.Address.Fax,
            CreationTime = vendor.Address.CreationTime,


        };


    }
}
</code></pre>

<p><strong>Address View Model:</strong></p>

<pre><code>public class AddressViewModel : BaseViewModelEntity
{
    [Required]
    public string Address1 { get; set; }
    public string Address2 { get; set; }
    public string Address3 { get; set; }
    [Required]
    public string City { get; set; }
    [Required]
    public int State { get; set; }
    [Required]
    public string Zip { get; set; }
    [Required]
    public string Phone { get; set; }
    public string Fax { get; set; }

    public AddressViewModel()
    {

    }

    public AddressViewModel(AddressDto address)
    {
        Id = address.Id;
        Address1 = address.Address1;
        Address2 = address.Address2;
        Address3 = address.Address3;
        City = address.City;
        State = address.State;
        Zip = address.Zip;
        Phone = address.Phone;
        Fax = address.Phone;
        CreatorUserId = address.CreatorUserId;
        CreationTime = address.CreationTime;
        DeleterUserId = address.DeleterUserId;
        DeletionTime = address.DeletionTime;
        LastModificationTime = address.LastModificationTime;
        LastModifierUserId = address.LastModifierUserId;
   }
 }
</code></pre>

<p>I have my Test set up with xUnit </p>

<pre><code>//Arrange
//Add Client Headers so User Auth and Permission Checkers work correctly
        Client.DefaultRequestHeaders.Add(""my-name"", ""admin"");
        Client.DefaultRequestHeaders.Add(""my-id"", ""2"");
//set up test data
        var addressViewModel = new AddressViewModel()
        {
            Address1 = ""123 This Way"", City = ""Arlington"", State = 44, Zip = ""76001"", Phone = ""8175555555"",
            CreationTime = DateTime.Now
        };

        var viewModelSave = new VenderViewModel()
        {
            Name = ""Controller Test Name"",
            PointOfContact = ""Tom Jerry"",
            Email = ""Tom.Jerry@yolo.com"",
            CreationTime = DateTime.Now,
            LastModificationTime = null,
            IsActive = true,
            AddressId = 0,
            VendorAddress = addressViewModel
            //Address1 = ""123 This Way"",
            //City = ""Arlington"",
            //State = 44,
            //Zip = ""76001"",
            //Phone = ""8175555555""
        };
/* This is an attempt to use string interpolation to create querystring parameters */
        //var rawData =
        //    $""?Name={viewModelSave.Name}&amp;Id={viewModelSave.Id}&amp;PointOfContat=${viewModelSave.PointOfContact}&amp;Email={viewModelSave.Email}&amp;CreationTime={DateTime.Now}"" +
        //    $""&amp;LastModificationTime=&amp;IsActive={viewModelSave.IsActive}&amp;AddressId={viewModelSave.AddressId}&amp;VendorAddress.Id={viewModelSave.VendorAddress.Id}&amp;VendorAddress.Address1={viewModelSave.VendorAddress.Address1}"" +
        //    $""&amp;VendorAddress.City={viewModelSave.VendorAddress.City}&amp;VendorAddress.State={viewModelSave.VendorAddress.State}&amp;VendorAddress.Zip={viewModelSave.VendorAddress.Zip}&amp;VendorAddress.Phone={viewModelSave.VendorAddress.Phone}"" +
        //    $""&amp;VendorAddress.CreationTime={DateTime.Now}&amp;VendorAddress.IsActive={viewModelSave.VendorAddress.IsActive}"";

/*This is an attempt to create a json object that could be serialize into an object as the ""queryStringParamsAsAnonymousObject"" that can be used in the GetUrl Helper method below */

        var rawData = $""{{'Name':'Controller Test Name','PointOfContact':'Tom Jerry', 'Email': 'Tom.Jerry@yolo.com',""
                       + ""'CreationTime':'"" +  DateTime.Now + ""','LastModificationTime':'','IsActive' : 'true','AddressId':'0','Address.Address1':'123 This Way',""
                       + ""'Address.City':'Arlington','Address.State':'44','Address.Zip':'76001','Address.Phone':'8175555556','Address.IsActive':'true'}"";

        var jsonData = JsonConvert.DeserializeObject(rawData);

       //Serialize ViewModel to send with Post as part of the HttpContent object 
        var data = JsonConvert.SerializeObject(viewModelSave);


        var vendorAddress = new
        {
            viewModelSave.vendorAddress.Id,
            viewModelSave.vendorAddress.Address1,
            viewModelSave.vendorAddress.City,
            viewModelSave.vendorAddress.State,
            viewModelSave.vendorAddress.Zip,
            viewModelSave.vendorAddress.Phone,
            viewModelSave.vendorAddress.IsActive,
            viewModelSave.vendorAddress.CreationTime
        };

        //actually get the url from helper method (with various attempts at creating an anonymousObject directly
        var url = GetUrl&lt;VendorController&gt;(nameof(VendorController.SaveVendor),
    new
    {
        viewModelSave.Id,
        viewModelSave.Name,
        viewModelSave.PointOfContact,
        viewModelSave.Email,
        viewModelSave.CreationTime,
        viewModelSave.LastModificationTime,
        viewModelSave.IsActive,
        viewModelSave.AddressId,
        vendorAddress
        //VendorAddress_Address1 = vendorAddress.Address1,
        //VendorAddress_Id = vendorAddress.Id,
        //VendorAddress_City = vendorAddress.City,
        //VendorAddress_State = vendorAddress.State,
        //VendorAddress_Zip = vendorAddress.Zip,
        //VendorAddress_Phone = vendorAddress.Phone,
        //VendorAddress_IsActive = vendorAddress.IsActive,
        //VendorAddress = new 
        //{
        //    viewModelSave.VendorAddress.Id,
        //    viewModelSave.VendorAddress.Address1,
        //    viewModelSave.VendorAddress.City,
        //    viewModelSave.VendorAddress.State,
        //    viewModelSave.VendorAddress.Zip,
        //    viewModelSave.VendorAddress.Phone,
        //    viewModelSave.VendorAddress.IsActive,
        //    viewModelSave.VendorAddress.CreationTime
        //},
        //viewModelSave.Address1,
        //viewModelSave.City,
        //viewModelSave.State,
        //viewModelSave.Zip,
        //viewModelSave.Phone
    }

    );
        var content = new StringContent(data, Encoding.UTF8, ""application/x-www-form-urlencoded"");
        var message = new HttpRequestMessage {
            Content = content,
            Method = HttpMethod.Post,
            RequestUri = new Uri(""http://localHost"" + url)

            };

        //Act
        var response = await PostResponseAsObjectAsync&lt;AjaxResponse&gt;(url, content);

        //Assert
        var count = UsingDbContext(context =&gt; { return context.Municipalities.Count(x =&gt; x.IsActive); });

        response.ShouldBeOfType&lt;AjaxResponse&gt;();
        response.Result.ShouldNotBeNull();
        count.ShouldBe(3);
    }
</code></pre>

<p>As I attempt to debug what is happening. I've noticed that the VendorAddress properties that are sent via the test request do not match what the actual form post looks like when parsed in Chrome developer tools. In Chrome I see (example:
PointOfContact:""Tom Jerry""
IsActive:True
VendorAddress.Address1:""123 This Way""
VendorAddress.City: ""Arlington"")
I cannot get my test data into that same format, therefore its not binding correctly to my view models on post, and thus returns a 400 response and fails the test.</p>

<p>I have gotten it to work if I remove the Address View Model all together and put those properties as properties of the VendorViewModel.  However, I would run into the same if not similar issue if I'm attempting to save a collection of objects along with the main view model. 
I feel like there has to be a way to submit test form data via integration tests with boilerplate. I just need some missing piece to this puzzle.</p>
",https://stackoverflow.com/questions/53137493/integration-testing-forms-with-nested-objects,"['.net-core', 'integration-testing', 'aspnetboilerplate']",126,TRUE,0,1
Difference between feature test and integration testing,"<p>I am currently developing a Project using Laravel5.7 and now am doing testing part. I have written code for unit testing in tests/unit directory. 
Next thing I see is a test/Feature directory. So my question is whether feature testing and integration testing are the same or do they have any difference.</p>

<p>Any help is appreciated</p>
",https://stackoverflow.com/questions/53863076/difference-between-feature-test-and-integration-testing,"['php', 'laravel', 'eloquent']",3972,TRUE,7,1
Integration testing for elasticsearch 6.1.1 using ESIntegTestCase,"<p>Not able to run the junit test case using ESIntegTestCase</p>

<pre><code>@RunWith(com.carrotsearch.randomizedtesting.RandomizedRunner.class)
@ClusterScope(scope=SUITE, numDataNodes = 3)
public class SampleClassTest1 extends ESIntegTestCase{
....
}
</code></pre>

<p>Always get the following error</p>

<pre><code>Suppressed: java.lang.IllegalStateException: No context information for thread: Thread[id=16, name=Thread-1, state=RUNNABLE, group=TGRP-SampleClassTest]. Is this thread running under a class com.carrotsearch.randomizedtesting.RandomizedRunner runner context? Add @RunWith(class com.carrotsearch.randomizedtesting.RandomizedRunner.class) to your test class. Make sure your code accesses random contexts within @BeforeClass and @AfterClass boundary (for example, static test class initializers are not permitted to access random contexts).
</code></pre>

<p>Could someone please let me know how to move forward.
Thanks in advance.</p>
",https://stackoverflow.com/questions/48152212/integration-testing-for-elasticsearch-6-1-1-using-esintegtestcase,"['java', 'unit-testing', 'elasticsearch']",413,FALSE,5,0
CompilationFailedException when integration testing ASP.NET Core MVC,"<p>I want to integration test an ASP.NET Core MVC WebSite. I started by adding an empty MVC WebApplication project:</p>

<pre><code>&lt;Project Sdk=""Microsoft.NET.Sdk.Web""&gt;
  &lt;PropertyGroup&gt;
    &lt;TargetFramework&gt;netcoreapp2.0&lt;/TargetFramework&gt;
  &lt;/PropertyGroup&gt;
  &lt;ItemGroup&gt;
    &lt;PackageReference Include=""Microsoft.AspNetCore.All"" Version=""2.0.3"" /&gt;
  &lt;/ItemGroup&gt;
  &lt;ItemGroup&gt;
    &lt;DotNetCliToolReference Include=""Microsoft.VisualStudio.Web.CodeGeneration.Tools"" Version=""2.0.1"" /&gt;
  &lt;/ItemGroup&gt;
&lt;/Project&gt;
</code></pre>

<p></p>

<p>It runs and shows the ASP.NET Core MVC sample page.
Then I added an XUnit-Project:</p>

<pre><code>&lt;Project Sdk=""Microsoft.NET.Sdk""&gt;
  &lt;PropertyGroup&gt;
    &lt;TargetFramework&gt;netcoreapp2.0&lt;/TargetFramework&gt;
    &lt;IsPackable&gt;false&lt;/IsPackable&gt;
  &lt;/PropertyGroup&gt;
  &lt;ItemGroup&gt;
    &lt;PackageReference Include=""Microsoft.AspNetCore.TestHost"" Version=""2.0.1"" /&gt;
    &lt;PackageReference Include=""Microsoft.NET.Test.Sdk"" Version=""15.5.0"" /&gt;
    &lt;PackageReference Include=""xunit"" Version=""2.3.1"" /&gt;
    &lt;PackageReference Include=""xunit.runner.visualstudio"" Version=""2.3.1"" /&gt;
    &lt;DotNetCliToolReference Include=""dotnet-xunit"" Version=""2.3.1"" /&gt;
  &lt;/ItemGroup&gt;
  &lt;ItemGroup&gt;
    &lt;ProjectReference Include=""..\WebApplication1\WebApplication1.csproj"" /&gt;
  &lt;/ItemGroup&gt;
&lt;/Project&gt;
</code></pre>

<p>Where I added the nuget package Microsoft.AspNetCore.TestHost.</p>

<p>The following test fails with a CompilationFailedException:</p>

<pre><code>using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using WebApplication1;
using Xunit;
public class UnitTest1
{
    [Fact]
    public async void Test1()
    {
        var builder = new WebHostBuilder()
            .UseContentRoot(@""C:\path\to\WebApplication1"")
            .UseStartup&lt;Startup&gt;();

        var server = new TestServer(builder);
        var client = server.CreateClient();

        var _ = await client.GetAsync(""/"");
    }
}
</code></pre>

<p>Exception details:</p>

<blockquote>
  <p>Microsoft.AspNetCore.Mvc.Razor.Compilation.CompilationFailedException : One or more compilation failures occurred:
  <br>
  oxhek45x.0i3(4,62): error CS0012: The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
  <br>
  oxhek45x.0i3(4,81): error CS0518: Predefined type 'System.String' is not defined or imported
  <br>
  oxhek45x.0i3(4,110): error CS0518: Predefined type 'System.Type' is not defined or imported
  <br>
  oxhek45x.0i3(4,11): error CS0518: Predefined type 'System.Void' is not defined or imported</p>
</blockquote>

<p><a href=""https://github.com/dotnet/standard/issues/542"" rel=""nofollow noreferrer"">#542</a> and <a href=""https://github.com/dotnet/core-setup/issues/2981"" rel=""nofollow noreferrer"">#2981</a> describe similar problems.</p>

<p>I tried adding this to the test project, but it didn't help:</p>

<pre><code>&lt;ItemGroup&gt;
  &lt;Reference Include=""netstandard"" /&gt;
&lt;/ItemGroup&gt;
</code></pre>

<p>And I tried replacing the MetadataReferenceFeature as described in <a href=""https://github.com/dotnet/core-setup/issues/2981"" rel=""nofollow noreferrer"">#2981</a>.</p>
",https://stackoverflow.com/questions/49078961/compilationfailedexception-when-integration-testing-asp-net-core-mvc,"['c#', 'asp.net-core-mvc']",1265,TRUE,4,1
How to automate Flutter Integration testing command?,"<p>I've read and tried integration testing with flutter. I followed this guide here... </p>

<p><a href=""https://flutter.io/docs/cookbook/testing/integration"" rel=""nofollow noreferrer"">https://flutter.io/docs/cookbook/testing/integration</a></p>

<p>Now, to run the integration test I have to type in the following command:</p>

<pre><code>flutter drive --target=test_driver/app.dart
</code></pre>

<p>My question is, is there a way to automate this inside android studio so I do not have to type in the command manually. I rather just click one button and run the integration test than type the command over and over again.</p>

<p>I'm new in flutter over all so any suggestion will be very much appreciated. Thanks in advance.</p>
",https://stackoverflow.com/questions/53361718/how-to-automate-flutter-integration-testing-command,"['flutter', 'integration-testing']",2506,TRUE,3,3
mvn spring boot plugin breaks integration testing,"<p>My integration testing with <code>maven-failsafe-plugin</code> and <code>JUnit5</code> was difficult to set up initially, but it now works:</p>

<pre><code>plugins:
  - artifactId: maven-failsafe-plugin
    groupId: org.apache.maven.plugins
    version: 2.19.1
    dependencies:
      - artifactId: junit-platform-surefire-provider
        groupId: org.junit.platform
        version: 1.0.3
      - artifactId: junit-jupiter-engine
        groupId: org.junit.jupiter
        version: 5.1.1
    configuration:
        includes:
          - v3api/*IntegrationTests.java
    executions:
      - goals: [ integration-test, verify ]
</code></pre>

<p>However I then want to turn the artifact into a fat jar and it seems as if <code>spring-boot-maven-plugin</code> clashes with <code>maven-failsafe-plugin</code>, because if I put this config into my pom ...</p>

<pre><code>  - artifactId: spring-boot-maven-plugin
    groupId: org.springframework.boot
    version: ${spring.boot.version}
    executions:
      - goals: [ repackage ]
    configuration:
        fork: true
        executable: true
        outputDirectory: ${project.build.directory}/binary
</code></pre>

<p>then I get this error instead on integration testing:</p>

<pre><code>Jun 05, 2018 3:03:15 PM org.junit.platform.launcher.core.DefaultLauncher handleThrowable
WARNING: TestEngine with ID 'junit-jupiter' failed to discover tests
java.lang.NoClassDefFoundError: com/adam/api/DbAccess
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetPublicMethods(Class.java:2902)
    at java.lang.Class.getMethods(Class.java:1615)
    at org.junit.platform.commons.util.ReflectionUtils.getDefaultMethods(ReflectionUtils.java:1024)
    at org.junit.platform.commons.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:997)
    at org.junit.platform.commons.util.ReflectionUtils.findAllMethodsInHierarchy(ReflectionUtils.java:939)
    at org.junit.platform.commons.util.ReflectionUtils.findMethods(ReflectionUtils.java:923)
    at org.junit.platform.commons.util.ReflectionUtils.findMethods(ReflectionUtils.java:909)
    at org.junit.jupiter.engine.discovery.JavaElementsResolver.resolveContainedMethods(JavaElementsResolver.java:189)
    at org.junit.jupiter.engine.discovery.JavaElementsResolver.resolveChildren(JavaElementsResolver.java:177)
    at java.lang.Iterable.forEach(Iterable.java:75)
    at org.junit.jupiter.engine.discovery.JavaElementsResolver.resolveClass(JavaElementsResolver.java:61)
    at org.junit.jupiter.engine.discovery.DiscoverySelectorResolver.lambda$resolve$3(DiscoverySelectorResolver.java:69)
    at java.util.ArrayList.forEach(ArrayList.java:1249)
    at org.junit.jupiter.engine.discovery.DiscoverySelectorResolver.resolve(DiscoverySelectorResolver.java:68)
    at org.junit.jupiter.engine.discovery.DiscoverySelectorResolver.resolveSelectors(DiscoverySelectorResolver.java:50)
    at org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:61)
    at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:130)
    at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:117)
    at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:82)
    at org.junit.platform.surefire.provider.TestPlanScannerFilter.accept(TestPlanScannerFilter.java:50)
    at org.apache.maven.surefire.util.DefaultScanResult.applyFilter(DefaultScanResult.java:98)
    at org.junit.platform.surefire.provider.JUnitPlatformProvider.scanClasspath(JUnitPlatformProvider.java:121)
    at org.junit.platform.surefire.provider.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:111)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
Caused by: java.lang.ClassNotFoundException: com.adam.api.DbAccess
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 28 more

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
</code></pre>

<p>In the <a href=""https://docs.spring.io/spring-boot/docs/2.0.2.RELEASE/maven-plugin/examples/it-skip.html"" rel=""nofollow noreferrer"">maven spring boot docs</a> they describe how the plugin can be configured to start and stop the spring boot app for integration testing with the <code>pre-</code> and <code>post-integration-testing</code> lifecycle phases. </p>

<p>My app's life cycle is slightly different with a docker and kubernetes aspect. It goes like this:</p>

<ul>
<li>package the jar</li>
<li>turn jar into a fat jar with the spring boot plugin</li>
<li>dockerise it</li>
<li>install it to docker registry</li>
<li>deploy to dev</li>
<li>integration testing</li>
<li>promote build from dev to test</li>
<li>deploy to test</li>
</ul>

<p>I have tried binding the spring boot plugin to the <code>package</code> phase, but that makes no difference to the error.  </p>

<p>Apart from the spring boot lifecycle phase issue, it could also have a lot to do with JUnit5, because <code>maven-failsafe-plugin</code> seems to be verging on unsupported for JUnit5: <a href=""https://stackoverflow.com/questions/47079105/how-do-i-run-junit-5-integration-tests-with-the-maven-failsafe-plugin#answer-47079107"">How do I run JUnit 5 integration tests with the Maven Failsafe plugin?</a></p>

<p>i've also seen this on <a href=""https://github.com/spring-projects/spring-boot/blob/master/spring-boot-samples/spring-boot-sample-junit-jupiter"" rel=""nofollow noreferrer"">Spring plus JUnit Jupiter</a> but it doesn't help with integration testing.</p>
",https://stackoverflow.com/questions/50705270/mvn-spring-boot-plugin-breaks-integration-testing,"['maven', 'spring-boot', 'integration-testing', 'junit5', 'maven-failsafe-plugin']",1447,TRUE,3,2
Spring integration testing with jetty and websockets,"<p>I have no problems doing Spring integration testing using Jetty without Websockets, using these annotations: </p>

<pre><code>@RunWith( SpringJUnit4ClassRunner.class )
@ContextConfiguration( classes = { ApplicationConfig.class } )
@WebAppConfiguration
</code></pre>

<p>When I add Websockets into the Jetty, it is not possible to use this approach.</p>

<p>This repo shows that websocket integration tests work with Tomcat but not Jetty:</p>

<p><a href=""https://github.com/isopov/mockmvc-test-websocket"" rel=""nofollow noreferrer"">https://github.com/isopov/mockmvc-test-websocket</a> </p>

<p>The issue seems to be because Spring's MockServletContext doesn't implement Jetty's ContextHandler.Context.</p>

<p><a href=""https://jira.spring.io/browse/SPR-16263"" rel=""nofollow noreferrer"">https://jira.spring.io/browse/SPR-16263</a></p>

<p>The full discussion can be found here:</p>

<p><a href=""https://github.com/spring-projects/spring-boot/issues/7487"" rel=""nofollow noreferrer"">https://github.com/spring-projects/spring-boot/issues/7487</a></p>

<p>Apparently it is possible to Jetty websocket tests by starting Jetty rather than using mockmvc:</p>

<p><a href=""https://github.com/spring-projects/spring-boot/issues/7487#issuecomment-375426956"" rel=""nofollow noreferrer"">https://github.com/spring-projects/spring-boot/issues/7487#issuecomment-375426956</a></p>

<p>How do you use SpringJUnit4ClassRunner without mockmvc?</p>

<p>James</p>
",https://stackoverflow.com/questions/49446510/spring-integration-testing-with-jetty-and-websockets,"['java', 'spring', 'websocket', 'jetty', 'integration-testing']",599,FALSE,3,0
Integration Testing against a service in docker,"<p>I have a microservice which I am testing (Java maven project with JUnit). This has a dependency on another microservice. I am writing an e-2-e system test and want to spin up the external service from a Docker image for a full automated test.</p>

<p>My question is what is the best way to have a maven project spin up a docker image instance which can then be used in an automated test suite?</p>

<p>At the moment I a using maven-exec plugin to call a shell script during the integration-phase which starts the docker container. It may not be the most elegant solution, and I also have no way of knowing when the container is ready.</p>

<p>Any thoughts or help would be appreciated.</p>

<p>Please note: This is for full system testing against real services so I don't want to mock or stub the external service.</p>
",https://stackoverflow.com/questions/49071113/integration-testing-against-a-service-in-docker,"['java', 'maven', 'unit-testing', 'docker', 'docker-compose']",465,TRUE,3,1
Stub for Feign client for integration testing,"<p>I have a spring cloud project with the following packaging structure</p>

<p>Controller (publishes Rest Endpoint)-->flow (business logic)-->service (calls Feign client with hysterix fallback setup )--> Feign client. </p>

<p>Auto-wiring is done in respective classes e.g. flow is auto-wired in controller and service is auto-wired in flow and so on.</p>

<p>I want to perform integration test, by calling the endpoint published by the controller. The problem is I don't have endpoint accessed by the feign client at the moment (neither original nor spring cloud contract stub is available). </p>

<p>How do I stub the call made by feign client in this case.</p>
",https://stackoverflow.com/questions/49972322/stub-for-feign-client-for-integration-testing,"['spring-boot', 'integration-testing', 'spring-cloud', 'wiremock', 'spring-cloud-feign']",2387,TRUE,1,1
Spring boot - integration testing - WebTestClient &amp; HttpServletRequest,"<p>I'm having difficulties figuring this out.</p>

<p>I can mock almost everything but for some reason the <code>HttpServletRequest</code> is mocked but not injected into the <code>@ControllerAdvice</code> <code>@ExceptionHandler</code> method.</p>

<p>Any ideas? Thank you for your help in advance!</p>

<p><strong>STR</strong> Repo with minimal plug and play test suite / code</p>

<p><a href=""https://github.com/krodyrobi/spring-integration-test-str"" rel=""nofollow noreferrer"">https://github.com/krodyrobi/spring-integration-test-str</a></p>

<pre><code>@Component
public class Config {
  private final String url = ""https://httpstat.us/"";

  public String getUrl() {
    return url;
  }
}

@RestControllerAdvice
public class GlobalExceptionHandler {
  @ExceptionHandler(WebClientResponseException.class)
  public ResponseEntity&lt;String&gt; handleException(HttpServletRequest request, WebClientResponseException ex) {
    return new ResponseEntity&lt;&gt;(request.getRequestURL() + "" "" + ex.getResponseBodyAsString(), ex.getStatusCode());
    }
}



@RestController
public class SomeController {
  private final Config config;

  @Autowired
  public SomeController(Config config) {
    this.config = config;
  }

  @GetMapping(""/test"")
  public Mono&lt;String&gt; test() {
     return WebClient
       .create(config.getUrl())
       .get()
       .uri(""/200"")
       .retrieve()
       .bodyToMono(String.class);
  }
}


@RunWith(SpringRunner.class)
@SpringBootTest(classes = {
  SomeController.class,
  GlobalExceptionHandler.class,
})
public class SomeControllerTest {
  private final static String baseUrl = ""http://localhost:9999/"";

  public @Rule WireMockRule wireMockRule = new WireMockRule(9999);

  private @MockBean Config config;
  private @MockBean HttpServletRequest request;

  private WebTestClient webClient;

  private @Autowired SomeController controller;
  private @Autowired GlobalExceptionHandler exceptionHandler;

  @Before
  public void setUp() {
    webClient = WebTestClient
      .bindToController(controller)
      .controllerAdvice(exceptionHandler)
      .build();

    when(config.getUrl()).thenReturn(baseUrl);
  }

  @Test
  public void test_works() {
    wireMockRule
      .stubFor(get(urlEqualTo(""/200""))
      .willReturn(aResponse()
                    .withStatus(200)
                    .withHeader(""Content-Type"", ""text/plain"")
                    .withBody(""200 MOCK"")));

    webClient
      .get()
      .uri(""/test"")
      .exchange()
      .expectStatus()
      .isOk()
      .expectBody(String.class)
      .isEqualTo(""200 MOCK"");

    wireMockRule.verify(getRequestedFor(urlMatching(""/200"")));
  }

  @Test
  public void test_fails() {
    // java.lang.IllegalStateException: No suitable resolver for argument 0 
    // of type 'javax.servlet.http.HttpServletRequest' on public 
    // org.springframework.http.ResponseEntity&lt;java.lang.String&gt; 
    // com.example.demo.GlobalExceptionHandler.handleException(
    //   javax.servlet.http.HttpServletRequest,
    //   ...client.WebClientResponseException
    // )

    wireMockRule
      .stubFor(get(urlEqualTo(""/200""))
      .willReturn(aResponse()
                    .withStatus(404)
                    .withHeader(""Content-Type"", ""text/plain"")
                    .withBody(""404 MOCK"")));

    webClient
       .get()
       .uri(""/test"")
       .exchange()
       .expectStatus()
       .isNotFound()
       .expectBody(String.class)
       .isEqualTo(""Http://localhost:8080/test 404 MOCK"");

    wireMockRule.verify(getRequestedFor(urlMatching(""/200"")));
  }
}
</code></pre>
",https://stackoverflow.com/questions/50453860/spring-boot-integration-testing-webtestclient-httpservletrequest,"['spring', 'spring-boot', 'testng', 'integration-testing', 'spring-webflux']",2186,TRUE,1,1
integration testing of Jooby application using Spock,"<p>I've got pretty simple application that uses <code>Jooby</code> as web framework. Its class responsible for REST looks like this </p>

<pre><code>class Sandbox : Kooby ({
    path(""/sandbox"") {
        get {
            val environment = require(Config::class).getString(""application.env"")
            ""Current environment: $environment""
        }

        get (""/:name"") {
            val name = param(""name"")
            ""Auto response $name""
        }
    }
})
</code></pre>

<p>I want to write integration test for it. My test looks like this. I use <code>spock</code> and <code>rest-assured</code>. The thing is that I don't have the application running and want to run it using some kind of embedded server or whatever.  How to do that?</p>

<p>My simple test looks like this</p>

<pre><code>class SandboxTest extends Specification {

    def ""check current environment""() {
        given:
            def request = given()
        when:
            def response = request.when().get(""/sandbox"")
        then:
            response.then().statusCode(200) // for now 404
    }
}
</code></pre>
",https://stackoverflow.com/questions/51859945/integration-testing-of-jooby-application-using-spock,"['rest', 'kotlin', 'spock', 'jooby']",184,TRUE,0,1
Refresh/rebuild specific beans during Spring integration testing,"<p>Our existing Spring Boot integration setup was using <code>@DirtiesContext</code> to rebuild the entire bean pool in-between different test methods.</p>

<p>This was fairly slow, and so we started working with beans that could be ""refreshed"" or torn down/rebuild <em>internally</em> without re-creating the instance.</p>

<p><strong>The problem</strong> is that only some beans support this. If we control <code>UsersBean</code>, we can implement a <code>UsersBean.refresh()</code> method and call it in our <code>@After</code> method.</p>

<p>But if we have existing beans/classes that don't support refreshing, or we don't control, how can we <strong>conditionally</strong> indicate that certain beans need to be dirtied/rebuilt after a specific test?</p>

<p>Or more succinctly: Is there a way to mark as dirty a <em>subsection</em> of your bean pool, for rebuilding, at the end of a test method?</p>
",https://stackoverflow.com/questions/53213121/refresh-rebuild-specific-beans-during-spring-integration-testing,"['java', 'spring', 'spring-boot', 'junit', 'integration-testing']",2681,TRUE,4,1
RestAssured vs Mockmvc for unit and integration testing,"<p>I am asked to choose one and the best from these two for unit and integration tests-</p>

<pre><code>1. RestAssured
2. Mockmvc
</code></pre>

<p>The application is in Spring and Spring Boot. I have read many blogs and no clear distinction is given or I couldn't find one. For rest assured, its neat and clean code and BDD style that makes it more readable. But doesn't sound a convincing point. Some of the tests are written using Mockmvc and I am trying to write the same in RestAssured to compare the same.</p>

<p>I know this may sound a theoretical question but I am unable to get points in favor of one and suggest which one is better and why. Looks like a choice of flavor to me. Any views and suggestions?</p>
",https://stackoverflow.com/questions/49255965/restassured-vs-mockmvc-for-unit-and-integration-testing,"['rest-assured', 'mockmvc']",2642,TRUE,4,1
Jest Integration Testing - How to manage global context?,"<p>It doesn't seem like Jest allows all the test runs to share a global context for integration testing.  It does have globalSetup and globalTeardown options, but it doesn't seem like those hooks are intended to be a shared testing context across all test runs.  You can hack something together using these hooks, passing variables through the node process, but then other issues start to arise (Different instances of Array constructors during assertions, etc...).</p>

<p>If I have a fairly heavy integration test setup process, is it recommended that I only have one test run, where all my integration tests would live and have access to the shared context?</p>

<p>Currently my integration tests are spread across multiple files (individual entry points) and import a setup process.  However that setup process is getting run once per file.  I'm assuming that alternatively I can have one entry point and then import all my integration test files within the same context.  Is that a good/recommended option?</p>

<p>What's the recommended way of setting up integration tests for use in Jest?</p>
",https://stackoverflow.com/questions/50999400/jest-integration-testing-how-to-manage-global-context,"['integration-testing', 'jestjs']",1548,FALSE,3,1
How to test gRPC (functional and integration testing),"<p>How to test gRPC functional and integration testing? I checked different articles and blogs but found just about unit tests (which doesn't suite). Java.</p>
",https://stackoverflow.com/questions/51705982/how-to-test-grpc-functional-and-integration-testing,"['java', 'integration-testing', 'functional-testing', 'grpc', 'grpc-java']",12063,TRUE,3,1
Spring boot integration testing Jersey JAX-RS resource,"<p>I am using Spring Boot 2.0.3.RELEASE and creating a simple Jersey JAX-RS resource (using the jersey spring boot starter). I would like to do a simple integration test using a Jersey Client class I have written, it doesn't seem however that the resource has started as I get a <code>java.net.ConnectException: Connection refused</code></p>

<p>So here we go, first the simple resource</p>

<pre><code>@Component
@Path(Constants.STATUS_PATH)
public class StatusResource {

    private static final String OK = ""OK"";

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public Response getStatus() {
        return Response.ok(OK).build();
    }

}
</code></pre>

<p>The Jersey config</p>

<pre><code>@Component
public class JerseyConfig extends ResourceConfig {

    private static final Logger logger = LoggerFactory.getLogger(JerseyConfig.class);

    public JerseyConfig() {
        logger.debug(""Registering JAX-RS resources"");
        register(StatusResource.class);
    }

}
</code></pre>

<p>The Spring boot application class</p>

<pre><code>@SpringBootApplication
public class Application {

    private static final Logger logger = LoggerFactory.getLogger(Application.class);

    public static void main(String[] args) {
        logger.info(""==== Starting Services ===="");
        SpringApplication.run(Application.class, args);
    }

}
</code></pre>

<p>The Jersey Client</p>

<pre><code>public class ServicesClient {

    private static final Logger logger = LoggerFactory.getLogger(ServicesClient.class);

    private Client client;

    public ServicesClient() {
        client = initJerseyClient();
    }

    private Client initJerseyClient() {
        logger.debug(""Initialising Jersey Client"");
        ClientConfig jerseyClientConfig = new ClientConfig();
        return ClientBuilder.newClient(jerseyClientConfig);
    }

    /**
     * Returns OK if services are running
     * 
     * @return service status
     */
    public String getServicesStatus() {
        logger.debug(""Client get services status request"");

        Response respone = client.target(""http://localhost:8080"").path(Constants.STATUS_PATH).request().get();

        return respone.readEntity(String.class);
    }
}
</code></pre>

<p>And finally the Spring Boot integration test</p>

<pre><code>@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = Application.class)
public class StatusResourceTest {

    private static Logger logger = LoggerFactory.getLogger(StatusResourceTest.class);

    private static ServicesClient servicesClient;

    @BeforeAll
    public static void setup() throws IOException {
        logger.debug(""--- Starting StatusResourceTest setup ---"");
        System.setProperty(""services.client.file"", ""classpath:com/zurich/utils/services/config/services.yaml"");
        servicesClient = new ServicesClientBuilder().build();
    }

    @Test
    public void testGetStatus() {
        logger.debug(""--- Starting testGetStatus ---"");

        String status = servicesClient.getServicesStatus();

        assertThat(""Service status should be OK"", status, equalTo(""OK""));
    }

}
</code></pre>

<p>Like I said when the test runs and get is called inside the client, I get the following stack trace. Which to me implies the resource isn't running at <code>http://localhost:8080</code> but I don't know why.</p>

<pre><code>javax.ws.rs.ProcessingException: java.net.ConnectException: Connection refused: connect
    at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:284)
    at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:278)
    at org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$0(JerseyInvocation.java:753)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:229)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:414)
    at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:752)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:419)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:319)
    at com.xxx.utils.services.client.ServicesClient.getServicesStatus(ServicesClient.java:178)
    at sit.resource.status.StatusResourceTest.testGetStatus(StatusResourceTest.java:39)
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
    at org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:390)
    at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:282)
    ... 11 more
</code></pre>
",https://stackoverflow.com/questions/51629725/spring-boot-integration-testing-jersey-jax-rs-resource,"['spring-boot', 'jax-rs', 'integration-testing', 'jersey-2.0', 'jersey-client']",2898,TRUE,2,1
integration testing with .net core and identity framework,"<p>I just can't find any answers to this anywhere.
I have read multiple articles and looked at loads of source code, but none of it seems to help.</p>

<p><a href=""http://www.dotnetcurry.com/aspnet-core/1420/integration-testing-aspnet-core"" rel=""nofollow noreferrer"">http://www.dotnetcurry.com/aspnet-core/1420/integration-testing-aspnet-core</a></p>

<p><a href=""https://www.davepaquette.com/archive/2016/11/27/integration-testing-with-entity-framework-core-and-sql-server.aspx"" rel=""nofollow noreferrer"">https://www.davepaquette.com/archive/2016/11/27/integration-testing-with-entity-framework-core-and-sql-server.aspx</a></p>

<p><a href=""https://learn.microsoft.com/en-us/aspnet/core/testing/integration-testing"" rel=""nofollow noreferrer"">https://learn.microsoft.com/en-us/aspnet/core/testing/integration-testing</a></p>

<p>The issue I have is resolving services instead of using <strong>HttpClient</strong> to test controllers.
This is my startup class:</p>

<pre><code>public class Startup: IStartup
{
    protected IServiceProvider _provider;
    private readonly IConfiguration _configuration;
    public Startup(IConfiguration configuration) =&gt; _configuration = configuration;

    // This method gets called by the runtime. Use this method to add services to the container.
    public IServiceProvider ConfigureServices(IServiceCollection services)
    {
        services.Configure&lt;MvcOptions&gt;(options =&gt; options.Filters.Add(new RequireHttpsAttribute()));

        SetUpDataBase(services);
        services.AddMvc();
        services
            .AddIdentityCore&lt;User&gt;(null)
            .AddDefaultTokenProviders();
        return services.BuildServiceProvider();
    }

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app)
    {
        var options = new RewriteOptions().AddRedirectToHttps();

        app.UseRewriter(options);
        app.UseAuthentication();
        app.UseMvc();

        using(var scope = app.ApplicationServices.GetRequiredService&lt;IServiceScopeFactory&gt;().CreateScope())
        {
            var context = scope.ServiceProvider.GetService&lt;DatabaseContext&gt;();
            EnsureDatabaseCreated(context);
        }
    }

    protected virtual void SetUpDataBase(IServiceCollection services) =&gt; services.AddDbContext(_configuration);

    protected virtual void EnsureDatabaseCreated(DatabaseContext dbContext)
    {
        dbContext.Database.Migrate();
    }
}
</code></pre>

<p>Then in my integration tests, I created 2 setup classes. The first is a <strong>TestStartup</strong>:</p>

<pre><code>public class TestStartup: Startup, IDisposable
{

    private const string DatabaseName = ""vmpyr"";

    public TestStartup(IConfiguration configuration) : base(configuration)
    {
    }

    protected override void EnsureDatabaseCreated(DatabaseContext dbContext)
    {
        DestroyDatabase();
        CreateDatabase();
    }

    protected override void SetUpDataBase(IServiceCollection services)
    {
        var connectionString = Database.ToString();
        var connection = new SqlConnection(connectionString);
        services
            .AddEntityFrameworkSqlServer()
            .AddDbContext&lt;DatabaseContext&gt;(
                options =&gt; options.UseSqlServer(connection)
            );
    }

    public void Dispose()
    {
        DestroyDatabase();
    }

    private static void CreateDatabase()
    {
        ExecuteSqlCommand(Master, $@""Create Database [{ DatabaseName }] ON (NAME = '{ DatabaseName }', FILENAME = '{Filename}')"");
        var connectionString = Database.ToString();
        var optionsBuilder = new DbContextOptionsBuilder&lt;DatabaseContext&gt;();
        optionsBuilder.UseSqlServer(connectionString);
        using (var context = new DatabaseContext(optionsBuilder.Options))
        {
            context.Database.Migrate();
            DbInitializer.Initialize(context);
        }
    }

    private static void DestroyDatabase()
    {
        var fileNames = ExecuteSqlQuery(Master, $@""SELECT [physical_name] FROM [sys].[master_files] WHERE [database_id] = DB_ID('{ DatabaseName }')"", row =&gt; (string)row[""physical_name""]);
        if (!fileNames.Any()) return;
        ExecuteSqlCommand(Master, $@""ALTER DATABASE [{ DatabaseName }] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; EXEC sp_detach_db '{ DatabaseName }'"");
        fileNames.ForEach(File.Delete);
    }

    private static void ExecuteSqlCommand(SqlConnectionStringBuilder connectionStringBuilder, string commandText)
    {
        using (var connection = new SqlConnection(connectionStringBuilder.ConnectionString))
        {
            connection.Open();
            using (var command = connection.CreateCommand())
            {
                command.CommandText = commandText;
                command.ExecuteNonQuery();
            }
        }
    }

    private static List&lt;T&gt; ExecuteSqlQuery&lt;T&gt;(SqlConnectionStringBuilder connectionStringBuilder, string queryText, Func&lt;SqlDataReader, T&gt; read)
    {
        var result = new List&lt;T&gt;();
        using (var connection = new SqlConnection(connectionStringBuilder.ConnectionString))
        {
            connection.Open();
            using (var command = connection.CreateCommand())
            {
                command.CommandText = queryText;
                using (var reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        result.Add(read(reader));
                    }
                }
            }
        }
        return result;
    }

    private static SqlConnectionStringBuilder Master =&gt; new SqlConnectionStringBuilder
    {
        DataSource = @""(LocalDB)\MSSQLLocalDB"",
        InitialCatalog = ""master"",
        IntegratedSecurity = true
    };

    private static SqlConnectionStringBuilder Database =&gt; new SqlConnectionStringBuilder
    {
        DataSource = @""(LocalDB)\MSSQLLocalDB"",
        InitialCatalog = DatabaseName,
        IntegratedSecurity = true
    };

    private static string Filename =&gt; Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), $""{ DatabaseName }.mdf"");
}
</code></pre>

<p>That handles all my db creation and configuration of services.
The second is my <strong>TestFixture</strong> class:</p>

<pre><code>public class TestFixture&lt;TStartup&gt; : IDisposable where TStartup : class
{
    private readonly IServiceScope _scope;
    private readonly TestServer _testServer;

    public TestFixture()
    {
        var webHostBuilder = new WebHostBuilder().UseStartup&lt;TStartup&gt;();  

        _testServer = new TestServer(webHostBuilder);
        _scope = _testServer.Host.Services.CreateScope();
    }

    public TEntity Resolve&lt;TEntity&gt;() =&gt; _scope.ServiceProvider.GetRequiredService&lt;TEntity&gt;();

    public void Dispose()
    {
        _scope.Dispose();
        _testServer.Dispose();
    }
}
</code></pre>

<p>This (as you can see) creates the test server, but also exposes a <code>Resolve</code> method that should resolve my services.
Now came my tests. 
I created a <strong>UserContext</strong> class, which looks like this:</p>

<pre><code>public class UserContext
{
    private readonly UserManager&lt;User&gt; _userManager;
    private UserContext(TestFixture&lt;TestStartup&gt; fixture) =&gt; _userManager = fixture.Resolve&lt;UserManager&lt;User&gt;&gt;();

    public static UserContext GivenServices() =&gt; new UserContext(new TestFixture&lt;TestStartup&gt;());

    public async Task&lt;User&gt; WhenCreateUserAsync(string email)
    {
        var user = new User
        {
            UserName = email,
            Email = email
        };
        var result = await _userManager.CreateAsync(user);
        if (!result.Succeeded)
            throw new Exception(result.Errors.Join("", ""));
        return user;
    }

    public async Task&lt;User&gt; WhenGetUserAsync(string username) =&gt; await _userManager.FindByNameAsync(username);
}
</code></pre>

<p>And then I created a test:</p>

<pre><code>[TestFixture]
public class UserManagerTests
{

    [Test]
    public async Task ShouldCreateUser()
    {
        var services = UserContext.GivenServices();
        await services.WhenCreateUserAsync(""tim@tim.com"");
        var user = await services.WhenGetUserAsync(""tim@tim.com"");
        user.Should().NotBe(null);
    }
}
</code></pre>

<p>Unfortunately, it errors out when I run the test and states:</p>

<blockquote>
  <p>Message: System.InvalidOperationException : Unable to resolve service for type 'Microsoft.AspNetCore.Identity.IUserStore<code>1[vmpyr.Data.Models.User]' while attempting to activate 'Microsoft.AspNetCore.Identity.UserManager</code>1[vmpyr.Data.Models.User]'.</p>
</blockquote>

<p>I think this is telling me that, although it found my <strong>UserManager</strong> service, it couldn't find the <strong>UserStore</strong> dependency that is used in the constructor.
I have looked at the <code>services.AddIdentityCore&lt;User&gt;(null)</code> and can see it doesn't appear the register the <strong>UserStore</strong>:</p>

<pre><code>public static IdentityBuilder AddIdentityCore&lt;TUser&gt;(this IServiceCollection services, Action&lt;IdentityOptions&gt; setupAction) where TUser : class
{
  services.AddOptions().AddLogging();
  services.TryAddScoped&lt;IUserValidator&lt;TUser&gt;, UserValidator&lt;TUser&gt;&gt;();
  services.TryAddScoped&lt;IPasswordValidator&lt;TUser&gt;, PasswordValidator&lt;TUser&gt;&gt;();
  services.TryAddScoped&lt;IPasswordHasher&lt;TUser&gt;, PasswordHasher&lt;TUser&gt;&gt;();
  services.TryAddScoped&lt;ILookupNormalizer, UpperInvariantLookupNormalizer&gt;();
  services.TryAddScoped&lt;IdentityErrorDescriber&gt;();
  services.TryAddScoped&lt;IUserClaimsPrincipalFactory&lt;TUser&gt;, UserClaimsPrincipalFactory&lt;TUser&gt;&gt;();
  services.TryAddScoped&lt;UserManager&lt;TUser&gt;, UserManager&lt;TUser&gt;&gt;();
  if (setupAction != null)
    services.Configure&lt;IdentityOptions&gt;(setupAction);
  return new IdentityBuilder(typeof (TUser), services);
}
</code></pre>

<p>I then looked at the <code>.AddIdentity&lt;User, IdentityRole&gt;()</code> method and that also doesn't seem to register the <strong>UserStore</strong>:</p>

<pre><code>public static IdentityBuilder AddIdentity&lt;TUser, TRole&gt;(this IServiceCollection services, Action&lt;IdentityOptions&gt; setupAction) where TUser : class where TRole : class
{
  services.AddAuthentication((Action&lt;AuthenticationOptions&gt;) (options =&gt;
  {
    options.DefaultAuthenticateScheme = IdentityConstants.ApplicationScheme;
    options.DefaultChallengeScheme = IdentityConstants.ApplicationScheme;
    options.DefaultSignInScheme = IdentityConstants.ExternalScheme;
  })).AddCookie(IdentityConstants.ApplicationScheme, (Action&lt;CookieAuthenticationOptions&gt;) (o =&gt;
  {
    o.LoginPath = new PathString(""/Account/Login"");
    o.Events = new CookieAuthenticationEvents()
    {
      OnValidatePrincipal = new Func&lt;CookieValidatePrincipalContext, Task&gt;(SecurityStampValidator.ValidatePrincipalAsync)
    };
  })).AddCookie(IdentityConstants.ExternalScheme, (Action&lt;CookieAuthenticationOptions&gt;) (o =&gt;
  {
    o.Cookie.Name = IdentityConstants.ExternalScheme;
    o.ExpireTimeSpan = TimeSpan.FromMinutes(5.0);
  })).AddCookie(IdentityConstants.TwoFactorRememberMeScheme, (Action&lt;CookieAuthenticationOptions&gt;) (o =&gt; o.Cookie.Name = IdentityConstants.TwoFactorRememberMeScheme)).AddCookie(IdentityConstants.TwoFactorUserIdScheme, (Action&lt;CookieAuthenticationOptions&gt;) (o =&gt;
  {
    o.Cookie.Name = IdentityConstants.TwoFactorUserIdScheme;
    o.ExpireTimeSpan = TimeSpan.FromMinutes(5.0);
  }));
  services.TryAddSingleton&lt;IHttpContextAccessor, HttpContextAccessor&gt;();
  services.TryAddScoped&lt;IUserValidator&lt;TUser&gt;, UserValidator&lt;TUser&gt;&gt;();
  services.TryAddScoped&lt;IPasswordValidator&lt;TUser&gt;, PasswordValidator&lt;TUser&gt;&gt;();
  services.TryAddScoped&lt;IPasswordHasher&lt;TUser&gt;, PasswordHasher&lt;TUser&gt;&gt;();
  services.TryAddScoped&lt;ILookupNormalizer, UpperInvariantLookupNormalizer&gt;();
  services.TryAddScoped&lt;IRoleValidator&lt;TRole&gt;, RoleValidator&lt;TRole&gt;&gt;();
  services.TryAddScoped&lt;IdentityErrorDescriber&gt;();
  services.TryAddScoped&lt;ISecurityStampValidator, SecurityStampValidator&lt;TUser&gt;&gt;();
  services.TryAddScoped&lt;IUserClaimsPrincipalFactory&lt;TUser&gt;, UserClaimsPrincipalFactory&lt;TUser, TRole&gt;&gt;();
  services.TryAddScoped&lt;UserManager&lt;TUser&gt;, AspNetUserManager&lt;TUser&gt;&gt;();
  services.TryAddScoped&lt;SignInManager&lt;TUser&gt;, SignInManager&lt;TUser&gt;&gt;();
  services.TryAddScoped&lt;RoleManager&lt;TRole&gt;, AspNetRoleManager&lt;TRole&gt;&gt;();
  if (setupAction != null)
    services.Configure&lt;IdentityOptions&gt;(setupAction);
  return new IdentityBuilder(typeof (TUser), typeof (TRole), services);
}
</code></pre>

<p>Does anyone know how I can resolve my <strong>UserManager</strong>?
Any help would be appreciated.</p>
",https://stackoverflow.com/questions/49273769/integration-testing-with-net-core-and-identity-framework,"['c#', 'asp.net-core', 'integration-testing', 'asp.net-core-identity']",1558,TRUE,2,1
Alternative to wiremock for spring boot app integration testing,"<p>Currently I have one of the spring boot apps which is using wiremock for mocking the external services dependency in integration testing. However I have experienced that those tests are very fragile and unpredictable and takes lot of time to execute. </p>

<p>I want to know if there are better ways to mock external services dependency for integration testing purposes in spring boot application ?</p>
",https://stackoverflow.com/questions/49697206/alternative-to-wiremock-for-spring-boot-app-integration-testing,"['spring-boot', 'integration-testing']",811,FALSE,8,0
Integration testing using sqlite memory two api calls,"<p>I am having trouble making an insert call (and creating the database) after the query occurs that the database is in memory the problem is that the acada call the database dies. It would be interesting to be able to do the database creation in my test and manipulate it.</p>

<pre><code>// Act
var model = new CreateOrUpdateTagsModel
{
    UserId = 1,
    CatalogItemType = ""Movie"",
    Owner = 1,
    PinRequired = false,
    ProductId = 1,
    TagType = ""Stars"",
    TagValue = ""5""
};

var jsonSerializerSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() };
var json = JsonConvert.SerializeObject(model, jsonSerializerSettings);

var response2 = await _client.PutAsync(""/v1/tags"", new StringContent(json, Encoding.UTF8, ""application/json""));
response2.EnsureSuccessStatusCode();

var responseString2 = await response2.Content.ReadAsStringAsync();

var response = await _client.GetAsync(""/v1/tags?userId=1"");
response.EnsureSuccessStatusCode();
</code></pre>
",https://stackoverflow.com/questions/50430158/integration-testing-using-sqlite-memory-two-api-calls,"['c#', 'asp.net-core', 'integration-testing', 'web-api-testing']",44,TRUE,0,1
Integration testing OpenID Connect for a specific user,"<p>I'm trying to get an integration test going for an API with authentication. Because some API functions call other API's on behalf of the user and this allows us to test everything before publishing.</p>

<p>The problem is I keep getting a 302 redirect even though I pass the token in the header. I'm not familiar with OpenID so perhaps I'm filling in the wrong header(s)? I've pretty much copy pasted the Startup from the sample found <a href=""https://github.com/Azure-Samples/active-directory-dotnet-webapp-openidconnect-aspnetcore"" rel=""nofollow noreferrer"">here</a>. Can someone please point me in the right direction?</p>

<p>FYI everything works without the AuthorizeAttribute on my controller.</p>

<pre><code>public class Startup
{
    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        app.UseAuthentication();
    }

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddAuthentication(sharedOptions =&gt;
            {
                sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
                sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
            })
            .AddOpenIdConnect(options =&gt;
            {
                options.Authority = ""hidden"";
                options.ClientId = ""hidden"";
                options.CallbackPath = ""/signin-oidc"";
                options.RequireHttpsMetadata = false;
                options.UseTokenLifetime = true;
            })
            .AddCookie();
    }
}

[TestClass]
public class Tests
{
    [TestMethod]
    public void Test()
    {
        // Get access token for API.
        var httpClient = new HttpClient();
        var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair&lt;string, string&gt;(""resource"", ""hidden""),
                new KeyValuePair&lt;string, string&gt;(""client_secret"", ""hidden""),
                new KeyValuePair&lt;string, string&gt;(""username"", ""hidden""),
                new KeyValuePair&lt;string, string&gt;(""password"", ""hidden""),
                new KeyValuePair&lt;string, string&gt;(""client_id"", ""hidden""),
                new KeyValuePair&lt;string, string&gt;(""grant_type"", ""password"")
            })
        var result = httpClient.PostAsync(new Uri(""https://login.microsoftonline.com/hidden.onmicrosoft.com/oauth2/token"", formContent).Result;
        var content = result.Content.ReadAsStringAsync().Result;
        var accessToken = JObject.Parse(content)[""access_token""].ToString();

        // Create client calling the API.
        var builder = new WebHostBuilder()
            .UseStartup&lt;Startup&gt;();
        var testServer = new TestServer(builder);

        var client = testServer.CreateClient();
        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(""Bearer"", accessToken);
        var response = client.GetAsync(""/hidden"").Result; // Receiving a 302 redirect
        var content = response.Content.ReadAsStringAsync().Result;

        Console.WriteLine(content);

        Assert.IsTrue(response.IsSuccessStatusCode);
    }
}
</code></pre>
",https://stackoverflow.com/questions/51991724/integration-testing-openid-connect-for-a-specific-user,"['c#', 'asp.net-core', 'openid-connect']",765,FALSE,0,0
Integration Testing .net core 2.1 application without test server,"<p>I want to test business logic class method which fetches configurations from appsettings.json file using MSTEST.</p>

<p>I created test project and copied appsettings.json and startup.cs files from main project to test project.</p>

<pre><code>    [TestClass]
public class TestClass
{
    private BusinessLogicClass businessLogicClass;


    [TestInitialize]
    public void TestInitialize()
    {
        var config = new ConfigurationBuilder()
         .SetBasePath(Directory.GetCurrentDirectory())
         .AddJsonFile(""appsettings.json"", optional: false, reloadOnChange: false).Build();
         var host = WebHost.CreateDefaultBuilder()
                .UseStartup&lt;Startup&gt;()  
                .Build();
            host.Run();
            businessLogicClass = new BusinessLogicClass();

    }

    [TestMethod]
    public void TestMethod()
    {

        // Calling BusinessLogicClass Method
            businessLogicClass.MethodToTest();

    }
</code></pre>

<p>When I debug the test test project gets stuck at host.run and never executes test method. Please help me.</p>
",https://stackoverflow.com/questions/52323669/integration-testing-net-core-2-1-application-without-test-server,"['c#', '.net', 'integration-testing', 'asp.net-core-2.1']",303,FALSE,2,0
Razor Pages .NET Core 2.1 Integration Testing post authentication,"<p>I am looking for some guidance... </p>

<p>I'm currently looking at trying to write some integration tests for a Razor Pages app in .net core 2.1, the pages I'm wanting to test are post authentication but I'm not sure about the best way of approaching it. The docs seem to suggest creating a CustomWebApplicationFactory, but apart from that I've got a little bit lost as how I can fake/mock an authenticated user/request, using basic cookie based authentication.</p>

<p>I've seen that there is an open <a href=""https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-2.1"" rel=""nofollow noreferrer"">GitHub issue</a> against the Microsoft docs (here is the actual <a href=""https://github.com/aspnet/Docs/issues/6882"" rel=""nofollow noreferrer"">GitHub issue</a>), there was a mentioned solution using IdentityServer4 but I’m just looking how to do this just using cookie based authentication. </p>

<p>Has anyone got any guidance they may be able to suggest?</p>

<p>Thanks in advance</p>

<p>My Code so far is:</p>

<p><strong>Startup.cs</strong></p>

<pre><code>public void ConfigureServices(IServiceCollection services)
{
    services.Configure&lt;CookiePolicyOptions&gt;(options =&gt;
        {
            services.AddDbContext&lt;ApplicationDbContext&gt;(options =&gt;
            {
                options.UseMySql(connectionString);
                options.EnableSensitiveDataLogging();
            });

            services.AddLogging(builder =&gt;
            {
                builder.AddSeq();
            });

            services.ConfigureAuthentication();
            services.ConfigureRouting();
    }
}
</code></pre>

<p><strong>ConfigureAuthentication.cs</strong></p>

<pre><code>  namespace MyCarparks.Configuration.Startup
  {
      public static partial class ConfigurationExtensions
      {
          public static IServiceCollection ConfigureAuthentication(this IServiceCollection services)
          {
              services.AddIdentity&lt;MyCarparksUser, IdentityRole&gt;(cfg =&gt;
              {
                  //cfg.SignIn.RequireConfirmedEmail = true;
              })
              .AddDefaultUI()
              .AddDefaultTokenProviders()
              .AddEntityFrameworkStores&lt;ApplicationDbContext&gt;();

              services.ConfigureApplicationCookie(options =&gt;
              {
                  options.LoginPath = $""/Identity/Account/Login"";
                  options.LogoutPath = $""/Identity/Account/Logout"";
                  options.AccessDeniedPath = $""/Identity/Account/AccessDenied"";
              });

              services.AddMvc()
                  .SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
                  .AddRazorPagesOptions(options =&gt;
              {
                    options.AllowAreas = true;
                    options.Conventions.AuthorizeAreaFolder(""Identity"", ""/Account/Manage"");
                    options.Conventions.AuthorizeAreaPage(""Identity"", ""/Account/Logout"");

                    options.Conventions.AuthorizeFolder(""/Sites"");
                });

            return services;
        }
    }
}
</code></pre>

<p><strong><em>Integration Tests</em></strong></p>

<p><strong>PageTests.cs</strong></p>

<pre><code>namespace MyCarparks.Web.IntegrationTests
{
    public class PageTests : IClassFixture&lt;CustomWebApplicationFactory&lt;Startup&gt;&gt;
    {
        private readonly CustomWebApplicationFactory&lt;Startup&gt; factory;

        public PageTests(CustomWebApplicationFactory&lt;Startup&gt; webApplicationFactory)
        {
            factory = webApplicationFactory;
        }


    [Fact]
    public async Task SitesReturnsSuccessAndCorrectContentTypeAndSummary()
    {
        var siteId = Guid.NewGuid();
        var site = new Site { Id = siteId, Address = ""Test site address"" };
        var mockSite = new Mock&lt;ISitesRepository&gt;();
        mockSite.Setup(s =&gt; s.GetSiteById(It.IsAny&lt;Guid&gt;())).ReturnsAsync(site);

        // Arrange
        var client = factory.CreateClient();

        // Act
        var response = await client.GetAsync(""http://localhost:44318/sites/sitedetails?siteId="" + siteId);

        // Assert
        response.EnsureSuccessStatusCode();

        response.Content.Headers.ContentType.ToString()
            .Should().Be(""text/html; charset=utf-8"");

        var responseString = await response.Content.ReadAsStringAsync();
        responseString.Should().Contain(""Site Details - MyCarparks"");
    }

    public class CustomWebApplicationFactory&lt;TStartup&gt; : WebApplicationFactory&lt;Startup&gt;
    {
        protected override void ConfigureWebHost(IWebHostBuilder builder)
        {
            builder.UseStartup&lt;Startup&gt;();
        }
    }
}
</code></pre>
",https://stackoverflow.com/questions/52954724/razor-pages-net-core-2-1-integration-testing-post-authentication,"['authentication', 'asp.net-core', '.net-core', 'asp.net-core-2.1', 'razor-pages']",707,FALSE,1,2
Integration testing with TomEE embedded and Microprofile fault tolerance,"<p>I need to test some components in JavaEE environment which are using annotatations from <a href=""http://microprofile.io/"" rel=""nofollow noreferrer"" title=""Microprofile"">Microprofile</a> project, i.e. @Asynchronous and @Timeout from <a href=""http://microprofile.io/project/eclipse/microprofile-fault-tolerance"" rel=""nofollow noreferrer"">fault tolerance part</a> of project. Implementation library for fault tolerance is <a href=""https://github.com/apache/geronimo-safeguard"" rel=""nofollow noreferrer"">Apache safe guard</a>.
In other to test I'm using Arquillian with TomEE embbedded.</p>

<p>Problem is that during execution of test cases those annotations are ignored, but when application is running on normal TomEE server at least @Timeout is working as expected.</p>

<p>In other to debug little I take one TCK test case from <a href=""https://github.com/eclipse/microprofile-fault-tolerance/blob/master/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/AsynchronousTest.java"" rel=""nofollow noreferrer"">AsynchronousTest.java</a> and imported in my project to test:</p>

<pre><code>@Test
public void testAsyncIsNotFinished() {
    Future&lt;Connection&gt; future = null;
    try {
        future = client.service();
    }
    catch (InterruptedException e) {
        throw new AssertionError(""testAsync: unexpected InterruptedException calling service"");
    }

    Assert.assertFalse(future.isDone());}
</code></pre>

<p>And this case is failling.</p>
",https://stackoverflow.com/questions/50073802/integration-testing-with-tomee-embedded-and-microprofile-fault-tolerance,"['java', 'integration-testing', 'apache-tomee', 'fault-tolerance', 'microprofile']",112,FALSE,1,0
Integration testing when the data layer has multiple implementations,"<p>I have a Kotlin/Vertx API as follows with a graphDB based data repository is injected:</p>

<pre><code>class MyServiceAPI : AbstractVerticle() {
   //dependency injection using KodeIn
  val graphRepository: GraphRepository = kodein.instance()

  fun addFriend (friend: User) {
    graphRepository.addFriend(friend)

  }
}
</code></pre>

<p>GraphRepository has several implementations like <code>OrientDBGraphRepository, JanusGraphRepository</code> etc.</p>

<p>I want to add integration tests using in-memory DB instances. I have following questions:</p>

<ol>
<li>Do I need to write separate integration tests for each DB implementation or should I pass the params(hostname, user, password) of the DB configuration to change the implementation accordingly?</li>
<li>Since I have coded for the repo interface, do I need to I instantiate each implementation for each case when testing them?</li>
</ol>

<p>Apologies if this is opinion based, any insight would be appreciated.</p>
",https://stackoverflow.com/questions/49527345/integration-testing-when-the-data-layer-has-multiple-implementations,"['kotlin', 'integration-testing', 'graph-databases', 'vert.x']",61,FALSE,1,0
Connect to non-standard couchbase ports for integration testing,"<p>I'm trying to set up automated integration-tests for a Spring Boot application that connects to couchbase. I want to test against a fresh containerised database using random available ports so that we don't need to worry about port collisions on developer machines or in continuous integration environments.</p>

<p>So far I've created a test that uses <code>com.palantir.docker.compose.DockerComposeRule</code> to spin up a <a href=""https://hub.docker.com/_/couchbase/"" rel=""nofollow noreferrer"">couchbase docker image</a> that exposes the standard ports on random available ports. However, <a href=""https://github.com/spring-projects/spring-boot/blob/v2.1.0.RELEASE/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java"" rel=""nofollow noreferrer"">org.springframework.boot.autoconfigure.couchbase.CouchbaseProperties</a> doesn't expose any properties for ports.</p>

<p>I can see that <a href=""https://github.com/spring-projects/spring-data-couchbase/blob/3.1.2.RELEASE/src/main/java/org/springframework/data/couchbase/config/CouchbaseEnvironmentParser.java"" rel=""nofollow noreferrer"">org.springframework.data.couchbase.config.CouchbaseEnvironmentParser</a> suggests that there is some way to set the ports. I haven't been able to work out how to use it though. Has anyone else been able to do this?</p>

<p>This is what my test looks like so far:</p>

<pre><code>@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
@Category(IntegrationTest.class)
public class BiscuitRepositoryIT {

    private static final int COUCHBASE_PORT = 8091;
    private static final String COUCHBASE_SERVICE = ""couchbase"";

    @ClassRule
    public static DockerComposeRule docker = DockerComposeRule.builder()
            .file(""src/test/resources/docker-compose-couchbase.yml"")
            .projectName(ProjectName.random())
            .waitingForService(COUCHBASE_SERVICE, HealthChecks.toHaveAllPortsOpen())
            .build();

    @Autowired
    private BiscuitRepositoryConfig config;

    @Autowired
    private BiscuitRepository biscuitRepository;

    @BeforeClass
    public static void initialize() {
        DockerPort couchbase = docker.containers()
                .container(COUCHBASE_SERVICE)
                .port(COUCHBASE_PORT);

        log.info(""couchbase ports: {}"", couchbase);

        // TODO update integration-test properties file with the ports
        // before the spring context starts.
    }

    @After
    public void tearDown() throws Exception {
        biscuitRepository.deleteAll();
    }

    @Test
    public void insertBiscuit() throws Exception {
        Biscuit digestive = Biscuit.builder().name(""digestive"").manufacturer(""biscuitCorp"").build();
        Biscuit persistedBiscuit = biscuitRepository.save(digestive);
        assertThat(persistedBiscuit).isEqualToIgnoringGivenFields(digestive, ""id"", ""version"");
    }
}
</code></pre>
",https://stackoverflow.com/questions/53477926/connect-to-non-standard-couchbase-ports-for-integration-testing,"['integration-testing', 'couchbase', 'spring-data-couchbase']",71,FALSE,1,0
WCF equivalent for OWIN/Katana in-memory integration testing,"<p>For <em>OWIN/KATANA</em> in-memory hosting solution is available: <em>Microsoft.AspNet.WebApi.OwinSelfHost</em>. I'd like to find similar way for WCF services - integration tests which can be run in-memory.</p>
",https://stackoverflow.com/questions/52534492/wcf-equivalent-for-owin-katana-in-memory-integration-testing,"['c#', 'wcf']",106,TRUE,0,1
Database integration testing in client application using COM interface,"<h1>Intro</h1>

<p>I am working in environment in which enterprise host application is calling client applications with implemented COM interface via ProgID. This is the way how programmers of host application allows to enhance application with plugins.</p>

<pre><code>Host app &lt;-&gt; COM interface &lt;-&gt; Client app
</code></pre>

<p>Client app can use methods from provided COM interface.</p>

<p>One of that method is <code>RunSqlQuery(rawSqlQuery)</code>. It has possibilites to fully communicate with SQL within scope of logged-in user of host application (based on connection authentication type it could be Windows or SQL user).</p>

<p>In our client applications we are not using any other database context - we are fully depending on host provided methods for run queries/commands in raw SQL.</p>

<p>As our codebase is growing, I am more and more worried about project architecture, testability and maintenance - which all are close to zero. As always - project managers does not see the problem with it.</p>

<h1>Question</h1>

<p>The biggest problem is, that I cannot find a way how to write database integration tests, because we are coupled with host application methods.</p>

<p>In repository or query object I am using it something like this (simplified):</p>

<pre><code>public List&lt;Entity&gt; GetAll()
{
    var entities = new List&lt;Entity&gt;();

    var result = _host.RunSqlQuery(""SELECT Col1, Col2, Col3 FROM table"");

    while (!result.End())
    {
        // adding to list

        result.Next();
    }

    return entities;
}
</code></pre>

<p>It is impossible to test it in this form, because:</p>

<ol>
<li>I have no context</li>
<li>If I use my own context, I cannot use that methods, because first must start host application, that is a place, where COM interface methods are executing.</li>
</ol>

<p>So what can I do? Make some higher layer and use strategy to choose host methods or .NET SQL client methods based on environment (normal/test)? I can not get it.</p>

<p>I must be prepared, that everything I am doing is only for testability. I can mock it, but as I said, I want to run integration tests for parts, where it is possible.</p>
",https://stackoverflow.com/questions/50962096/database-integration-testing-in-client-application-using-com-interface,"['c#', 'testing']",52,FALSE,0,0
Setting up integration testing environment with KeyCloak in Docker,"<p>I'm trying to setup integration testing environment for one of our Web API project that secured with KeyCloak. My idea is create the docker compose file where connect all required components and then try to call Web API hosted in contained and validate the response.</p>

<p>Here is the example of docker compose file that connect KeyCloak and Web API together</p>

<pre><code>keycloak:
  image: jboss/keycloak:3.4.3.Final
  environment:
    DB_VENDOR: POSTGRES
    KEYCLOAK_USER: admin
    KEYCLOAK_PASSWORD: admin
    POSTGRES_USER: keycloak
    POSTGRES_PASSWORD: keycloak
    POSTGRES_PORT_5432_TCP_ADDR: postgres
    POSTGRES_DATABASE: keycloak
    JDBC_PARAMS: 'connectTimeout=30'
  ports:
    - '18080:8080'
    - '18443:8443'
  networks:
    - integration-test
  depends_on:
    - postgres

test-web-api:
    image: test-web-api
    environment:
    - IDENTITY_SERVER_URL=https://keycloak:18443/auth/realms/myrealm
    networks:
    - integration-test
    ports:
    - ""28080:8080""
</code></pre>

<p>Now, when I host KeyCloak and Web API in different containers I can't get access from Web API container to KeyCloak using the localhost, so I need to use <a href=""https://keycloak:18443/"" rel=""nofollow noreferrer"">https://keycloak:18443/</a> but when I try it and get for example .well-known/openid-configuration from KeyCloak I get connection refused error:</p>

<p>root@0e77e9623717:/app# curl <a href=""https://keycloak:18443/auth/realms/myrealm/.well-known/openid-configuration"" rel=""nofollow noreferrer"">https://keycloak:18443/auth/realms/myrealm/.well-known/openid-configuration</a>
curl: (7) Failed to connect to keycloak port 18443: Connection refused</p>

<p>From the documentation I figured out that I need to enable SSL on KeyCloak but the whole process is a bit confused and it's not very clear what domain to use for the certificate...</p>

<p>If somebody had any experience with the situation like mine and could share it that would be great!</p>
",https://stackoverflow.com/questions/52245461/setting-up-integration-testing-environment-with-keycloak-in-docker,"['docker', 'ssl', 'openssl', 'docker-compose', 'keycloak']",1511,TRUE,0,1
Bazel: how to override git_repository commit for integration testing?,"<p>I'd like to add an integration test to <a href=""https://github.com/bazelbuild/rules_k8s"" rel=""nofollow noreferrer""><code>rules_k8s</code></a> that allows an updated commit SHA to be passed in at the command-line to override the default commit hash of <code>rules_docker</code> in the <a href=""https://github.com/bazelbuild/rules_k8s/blob/master/WORKSPACE#L16:L20"" rel=""nofollow noreferrer""><code>WORKSPACE</code></a>. The motivation is to have a CI test that checks if <code>rules_docker</code> contains a regression that effects <code>rules_k8s</code>.</p>

<p>For <code>rules_scala</code>, I did something similar <a href=""https://github.com/bazelbuild/rules_scala/blob/8117089e8969861b1774485cb49ab95b54c2b9c9/test_intellij_aspect.sh#L23"" rel=""nofollow noreferrer"">via <code>--override_repository</code></a>, but that seems more complex than should be needed for this case.</p>
",https://stackoverflow.com/questions/49721889/bazel-how-to-override-git-repository-commit-for-integration-testing,['bazel'],616,TRUE,0,1
How to mock gRPC api for integration testing with golang,"<p>all</p>

<p>I have a service written in go which communicates with a couple of other services via gRPC protocol. I want to write integration tests for my service but, I have no possibility to use real dependencies.</p>

<p>So, I need to mock the dependencies in some way.</p>

<p>For me, a perfect scenario looks like:</p>

<ul>
<li>I can run a mock-server and pass its address instead of a real dependency to my application</li>
<li>I can register expected response for a specific call to the dependant service</li>
<li>I can reset the mock-server to tear down the data after a test case.</li>
</ul>

<p>I tried to use <a href=""https://github.com/jekiapp/gripmock"" rel=""noreferrer"">https://github.com/jekiapp/gripmock</a> but it doesn't support all the protobuff syntax.</p>

<p>What can help with my problem? Maybe I'm completely wrong and there are best practices for integration testing of services communicating gRPC</p>
",https://stackoverflow.com/questions/53882312/how-to-mock-grpc-api-for-integration-testing-with-golang,"['go', 'mocking', 'integration-testing', 'grpc']",5423,TRUE,6,3
How flipkart is accessing dom elements for integration testing?,"<p>I just noticed, Flipkart has mostly classes with random names( not sure it is static or changes with every build ) in their dom elements like we get using styled-components library.</p>

<p>I just want to know, how are they accessing the dom element for the integration testing?</p>

<p><strong>UPDATED:</strong> For accessing elements using a testing framework like selenium, which locator(id, classes, xpath) they are using? 
<a href=""https://i.stack.imgur.com/ZOml9.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/ZOml9.png"" alt=""enter image description here""></a></p>
",https://stackoverflow.com/questions/53150917/how-flipkart-is-accessing-dom-elements-for-integration-testing,"['javascript', 'reactjs', 'selenium', 'integration-testing']",58,TRUE,0,1
Spring Boot Rest integration testing - How to analyse API coverage?,"<p>I want to analyse API coverage of my spring boot rest project. (During the intergration test which endpoints are used, and related details) My strategy is like that, during the integration test; </p>

<ul>
<li>Run /<strong>mappings</strong> endpoint once, and get the total endpoint list </li>
<li>By using <strong>customtracerepository</strong>, check the visited endpoints.</li>
<li>Create a log file after all tests finished.</li>
</ul>

<p>But I realized that predefined actuator endpoints are not working in test environment. (<strong>SpringJUnit4ClassRunner</strong>) Is there any way to run spring boot actuators on test environment, or do you have any other suggestion to do that? (coverage report) I aim to see missing tests in single report.</p>
",https://stackoverflow.com/questions/49320187/spring-boot-rest-integration-testing-how-to-analyse-api-coverage,"['java', 'spring', 'spring-boot', 'test-coverage']",231,FALSE,3,0
Maven - Integration-testing a multi-module rest api JavaEE project,"<p>My web-app project is made up of multiple modules and has structure like this:</p>

<pre><code>project  //pom
|
|-- mod-pojo  //jar
|   `-- src
|       |-- main
|       |-- test
|   `-- pom.xml
|
|-- mod-util  //jar
|   `-- src
|       |-- main
|       |-- test
|   `-- pom.xml
|
|-- mod-wepapi-war //war
|   |-- pom.xml
|   `-- src
|       |-- main
|       |   |-- java
|       |   |   `-- com
|       |   |       `-- mycompany
|       |   |           `-- myapp
|       |   |               |-- HomeServlet.java
|       |   |               
|       |   |-- resources
|       |   |   |-- com
|       |   |   |   `-- mycompany
|       |   |   |       `-- myapp
|       |   |   |           `-- something.xml
|       |   |   `-- log4j.properties
|       |   `-- webapp
|       |       `-- WEB-INF
|       |           `-- web.xml
|       `-- test
|           `-- java
|               `-- com
|                   `-- mycompany
|                       `-- myapp
|                           |-- TestHome.java
`-- pom.xml
</code></pre>

<p>The build order is mod-pojo, mod-util and then mod-wepapi-war
Each module has it's own unit tests. I want to do integration testing of the whole app. I want the app to be deployed to a tomcat server before the integration tests run, which will basically perform tests by calling the APIs.</p>

<p>I did some research online but nothing really turned out helpful.</p>

<p>I don't want the integration tests to be run during mvn test and i dont want the unit tests to run when I run integration test.</p>

<p>I also want to get the coverage of IT (excluding UT).</p>

<p>What is the best way to write and run these integration tests?</p>

<p>P.S I am new to Java and Maven</p>
",https://stackoverflow.com/questions/49589143/maven-integration-testing-a-multi-module-rest-api-javaee-project,"['java', 'maven', 'jakarta-ee', 'integration-testing', 'maven-3']",253,FALSE,1,1
&quot;OneTimeSetUp: No suitable constructor was found&quot; Integration testing with ApplicationDbContext,"<p>I have an issue regarding integration testing within a razor application combined with MVVM. All my classes use ApplicationDbContext.</p>

<p>The Test class:</p>

<pre><code>[TestFixture]
public class ApiParserControllerTests
{
    private readonly ApplicationDbContext _dbContext;
    public ApiParserControllerTests(ApplicationDbContext dbContext)
    {
        _dbContext = dbContext;
    }
    [Test]
    public void IsOptionValid_Teacher_ShouldReturnTrue()
    {
        var model = new ApiParserController(_dbContext);
        var assign = model.IsOptionValid(""Teacher"");

        Assert.AreEqual(true, assign.Value);
    }
</code></pre>

<p>The method class:</p>

<pre><code>public class ApiParserController : Controller
{
    private readonly ApplicationDbContext _dbContext;

    public ApiParserController(ApplicationDbContext dbContext)
    {
        _dbContext = dbContext;
    }

    [HttpPost]
    public JsonResult IsOptionValid(string Option)
    {
        return Json(_dbContext.Import.Any(x =&gt; x.Option.ToLower() == Option.ToLower()));
    }
}
</code></pre>

<p>Running this gives me the error in the title. I have tried adding an empty constructor to solve this problem, however this just makes the ApplicationDbContext null. </p>

<p>What am I missing here?</p>

<p>EDIT:</p>

<p>I have added a unit test for this method that mocks the database using the inMemory:</p>

<pre><code>    [Test]
    public void IsOptionValid_Teacher_ShouldReturnTrue()
    {
        //Arrange
        var optionsbuilder = new DbContextOptionsBuilder&lt;ApplicationDbContext&gt;();
        optionsbuilder.UseInMemoryDatabase(databaseName: ""TeacherDB"");
        var _dbContext = new ApplicationDbContext(optionsbuilder.Options);

        JsonResult json = new JsonResult(true);
        _dbContext.ImportOption.Add(new ImportOption { Id = 1, isUnique = 1, Option = ""Teacher"" });
        _dbContext.SaveChanges();
        //Act
        var model = new ApiParserController(_dbContext);
        var assign = model.IsOptionValid(""Teacher"");
        //Assert
        Assert.AreEqual(true, assign.Value);
    }
</code></pre>
",https://stackoverflow.com/questions/50815867/onetimesetup-no-suitable-constructor-was-found-integration-testing-with-appli,"['c#', 'razor', 'mvvm', 'nunit']",5343,FALSE,1,2
Web API In Memory Integration Testing - Authentication between two services,"<p>I have searched lots of posts here regarding my problem but have not found anything related to what I am trying to achieve.</p>

<p>I have created a Web API micro service for handling user authentication.  The service uses identity framework and issues bearer tokens.  I have another Web API which is secured using the [Authroize] attribute on the controllers.  Both services talk to the same database via Entity Framework.</p>

<p>One hurdle I had to overcome whilst setting up this infrastructure was both services require the same machine key in their web.configs.  When everything is deployed it works great.</p>

<p>However, I am trying to write some integration tests for my main API using the Microsoft Owin TestServer.  This allows me to write integration tests against an in memory copy of the API which also uses an in memory copy of the database using the entity framework migrations.</p>

<p>I have successfully created integration tests for my user service.  However, I am struggling to get integration tests working for my main service.  I have created a solution with a new test project in it.  I have also linked in my user service and main service.  In the bootstrap for the integration tests, I spin up an in memory copy of each service by using each services Startup.cs. </p>

<p>Everything works ok until I try to hit a controller that is secured with the [Authorize] attribute.  I have successfully hit the user service to register a user, activate that user and obtain the bearer token. I am then passing this over in the request to the main service in the auth header.  However, I always an Unauthorized response from the service.</p>

<p>I suspect this is related to machine keys again and have tried putting the same machine key into an App.config within the integration test project.  This did not make any difference.</p>

<p>If anyone has managed to get this scenario working I would very much appreciate any advice on what could be causing the problem.  I haven't pasted any code as there is quite a lot involved but would be happy to paste any specifics.</p>

<p>Testing in this way is super fast and really powerful.  However, there seems to be a lack of info out there on getting this working.</p>

<p><strong>EDIT</strong></p>

<p>Here is some code as requested.  The two in memory APIs are created in a OneTimeSetUp as follows:</p>

<pre><code>_userApi = TestServer.Create&lt;UserApi.Startup&gt;();
_webApi = TestServer.Create&lt;WebApi.Startup&gt;();
</code></pre>

<p>The Authorized HttpClient is then taken from the API as follows:</p>

<pre><code>var client = _webApi.HttpClient;
var authorizationValue = new AuthenticationHeaderValue(""Bearer"", token);
client.DefaultRequestHeaders.Authorization = authorizationValue;
</code></pre>

<p>""token"" is obtained from the user service.</p>

<p>The GET is then performed using the client as follows:</p>

<pre><code>var result = await client.GetAsync(uri);
</code></pre>

<p><strong>EDIT 2</strong></p>

<p>I should also point out that I have authenticated integration tests working within the User Service.  The problem is only when I try to use both services together.  E.g.  Obtain token from User Service and use that token to authenticate against my main service.  The in memory entity framework database is created as follows:</p>

<pre><code>AppDomain.CurrentDomain.SetData(""DataDirectory"", Path.Combine(TestContext.CurrentContext.TestDirectory, string.Empty));
using (new ContractManagerDatabase())
{
System.Data.Entity.Database.SetInitializer(new DropCreateDatabaseAlways&lt;ContractManagerDatabase&gt;());
}
</code></pre>
",https://stackoverflow.com/questions/50700879/web-api-in-memory-integration-testing-authentication-between-two-services,"['entity-framework-6', 'asp.net-web-api2', 'integration-testing', 'owin', 'in-memory']",893,TRUE,0,1
Is using HSQLDB considered integration testing? Should I use it?,"<p>My team uses Redshift and we'd like to validate our queries and general logic without having to rely on pre-existing data. In other words, like in traditional integration testing, we'd like to insert data, do the testing, and then clean up. We reference specific tables + schemas in our DAOs so if we choose to integration test with Redshift, then we'd be inserting into our test DB that some of our customers use (we use this DB in Beta so data is still ""production-quality"" data, only that Beta has a subset of what Prod does). The nature of our queries are performing aggregations/functions on the dataset - no CUD transactions.</p>

<p>I was wondering if there's some intrinsic value in using Redshift or can I simply rely on HSQLDB (full-control, transparency, and clean-slate)? Does using HSQLDB still fall under the realm of integration testing?</p>

<p>Thanks!</p>
",https://stackoverflow.com/questions/52172207/is-using-hsqldb-considered-integration-testing-should-i-use-it,"['java', 'unit-testing', 'junit', 'integration-testing']",284,FALSE,0,1
Integration testing in spring non transactional by mocking database calls,"<p>My database calls are mocked and the actual methods that invokes DB are annotated with @Transactional. When I execute test cases, it internally tries to create the transaction and fails as no driver found. The database used is Neo4j and is not running while executing test cases.  How can I test transactional methods in a non-transactional way? I tried annotating the integration test method with   <code>@Transactional(propagation=Propagation.NEVER)</code>. but that makes no difference</p>
",https://stackoverflow.com/questions/49122743/integration-testing-in-spring-non-transactional-by-mocking-database-calls,"['integration-testing', 'spring-data-neo4j', 'transactional']",175,FALSE,0,0
ASP.NET Core 2.1 integration testing with Windows authentication and Active Directory,"<p>After years of TBH not bothering doing any integration testing with my apps I've decided to jump in and give it a go.</p>
<p>So now I'm trying to get integration testing with my .NET Core 2.1 application, the app works fine when debugging normally through Visual Studio or when its been deployed to our IIS server, but when I run an integration test in Visual Studio to test a controller I just get the following error:-</p>
<p><strong>No authenticationScheme was specified, and there was no DefaultChallengeScheme found</strong></p>
<p>I'm using the Authorize attribute and Active Directory groups in the roles. If I remove the [Authoize(Roles = &quot;MYDOMAIN\SomeGroup&quot;)] from the controller the integration tests work fine!?!</p>
<p>At first I thought it was because I'd not done 'AddAuthentication' in the ConfigureServices method and 'UseAuthentication' in Configure method but this seems to make no difference.</p>
<p>Here's my test code:</p>
<pre><code>public class TestMyController : IClassFixture&lt;WebApplicationFactory&lt;Startup&gt;&gt;
{
    private readonly WebApplicationFactory&lt;Startup&gt; _factory;
    private readonly HttpClient _client;

    public TestMyController(WebApplicationFactory&lt;Startup&gt; factory)
    {
        _factory = factory;
        _client = _factory.CreateClient();
    }        

    [Theory]
    [InlineData(&quot;api/somecontroller/someaction&quot;)]
    public async Task TestSomeControllerSomeAction(string url)
    {            
        var response = await _client.GetAsync(url);
        response.EnsureSuccessStatusCode();

        var responseBody = await _client.GetStringAsync(url);
                
        Assert.NotEmpty(responseBody);
    }
}
</code></pre>
<p>So again, this test code works, but only if I remove the [Authorize] attributes from the controller. I couldn't find anything referring to this in the Microsoft docs I was following and I'm struggling to find anyone who is out there having this particular problem using Active Directory 'roles' in the authorize attribute - maybe I'm doing something wrong or daft :-)</p>
<p>Can anyone help or advise?</p>
",https://stackoverflow.com/questions/51882081/asp-net-core-2-1-integration-testing-with-windows-authentication-and-active-dire,"['c#', 'authentication', 'asp.net-core', 'active-directory', 'integration-testing']",1025,FALSE,4,0
Integration testing transaction outputs on the @InitiatedBy side post transaction finality,"<p>I have a situation where I have an <code>@InitiatingFlow</code>, called ProposeMemberFlow, and a corresponding <code>@InitiatedBy</code> ProposeMemberFlowResponder.  I would like include in my integration test something that tests that the responder has one of the transaction output states post the FinalityFlow sub flow having been kicked off by the initiating flow.</p>

<p>I naively called <code>waitForLedgerCommit</code> in the responding flow, post responding to the CollectSignaturesFlow, but I'm finding that the initiating flow finishes before the responding flow does - presumably the latter is waiting for the vault update.</p>

<p>I'm integration testing through a CordaService - is ""the corda way"" to use <code>expectEvents</code> to wait for <code>VaultUpdate</code>s so that I then know when it's safe to test against the CordaService?  Much like <a href=""https://docs.corda.net/tutorial-integration-testing.html"" rel=""nofollow noreferrer"">here</a>?</p>

<p>Thanks</p>
",https://stackoverflow.com/questions/48526044/integration-testing-transaction-outputs-on-the-initiatedby-side-post-transactio,['corda'],137,TRUE,2,1
"React integration testing, how to wait for page to be ready","<p>We have a web application written with React JS in the frontend and a PHP backend.</p>

<p>We are setting up Selenium integrated testing for the React frontend. In the past when we've done this for PHP applications, it is easy to wait for the page to be loaded before processing the assertions.</p>

<p>However in the React application, the web-browser doesn't actually change pages, instead the React renderer just renders the page differently.</p>

<p>Is there an easy way to tell if Reach is still busy fetching data from the server, and so the tests assertions need to wait?</p>
",https://stackoverflow.com/questions/49633963/react-integration-testing-how-to-wait-for-page-to-be-ready,"['reactjs', 'selenium-chromedriver']",348,FALSE,2,0
Spring Boot integration testing with Async Jobs and Request Scope beans,"<p>the problem I'm facing consists of 3 factors:</p>

<ul>
<li>Spring Boot integration testing with Maven &amp; JUnit</li>
<li>A request scope bean within the context of the application</li>
<li>An async job that runs on app start.</li>
</ul>

<p>The problem occurs <strong>on testing only</strong>, the application runs as intended when building without tests.</p>

<p>Simplified application flow:</p>

<ul>
<li><strong>On Spring Boot startup</strong>, an <strong>async</strong> job concurrently fetches data from Data Source and stores it on cache (Guava CacheLoader)</li>
<li>When user requests this data, intercept the request, authenticate header tokens, store user info in <strong>Request scope</strong> bean and continue.</li>
<li>Fetch data from Cache and return to user.</li>
</ul>

<p>The error I get when trying to run Maven Test:</p>

<blockquote>
  <p>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.requestBean': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.</p>
</blockquote>

<p><strong>Important note &amp; clue to solving this</strong>: When the controller fetches directly from DAO (Data Source), the tests pass!!! Only when it fetches from Guava Cache it fails.</p>

<p>Simplified code:</p>

<pre><code>/* Part of the controller: */
 @Autowired AsyncCacheService cacheService;
 @RequestMapping(""/resellers"")
 public HashMap&lt;String, Reseller&gt; getAllResellers() throws Exception {
   return cacheService.getAllResellers();
   //When I switch to get directly from DAO below, tests pass.
   //return partnerDao.getAllResellers(); &lt;-- get directly from DAO.
 }




/* The service which the controller calls */
@Service
public class AsyncCacheService {
  private LoadingCache&lt;String, List&lt;Reseller&gt;&gt; resellersCache;
  public AsyncCacheService() {

    resellersCache = CacheBuilder.newBuilder().build(new CacheLoader&lt;String, 
    HashMap&lt;String, Reseller&gt;&gt;() {
      public HashMap&lt;String, Reseller&gt; load(String key) throws Exception {
        return partnerDao.getAllResellers();
      }
    });
  }
  @PostConstruct
  private void refreshCache() {
    /* Refresh cache concurrently */    
    Executors.newSingleThreadScheduledExecutor().scheduleWithFixedDelay(
                () -&gt; resellersCache.refresh(this.getClass().toString()), 0, 
                cacheRefreshTimeInterval, TimeUnit.SECONDS);
  }
  /* Return resellers from cache */
  public HashMap&lt;String, Reseller&gt; getAllResellers() {
    return resellersCache.getUnchecked(this.getClass().toString());
  }
}
</code></pre>

<p>Interceptor code is straight forward:</p>

<pre><code>@Component
public class AuthInterceptor extends HandlerInterceptorAdapter {
  private @Autowired RequestBean requestBean;
  @Override
  public boolean preHandle(HttpServletRequest request, HttpServletResponse 
       response, Object handler) throws Exception {
    //Verify request and requestBean.set(email, ip, foo)
  }
}
</code></pre>

<p>How we instantiate request bean:</p>

<pre><code>@Bean
@RequestScope
public RequestBean requestBean() {
    return new RequestBean();
}
</code></pre>

<p>And finally, the tests:</p>

<pre><code>@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
tester {
  @Test
  public void allResellersSizeTest() throws Exception {

    //MvcResult r = 

      mockMvc.perform(get(""/api/resellers"").header(authHeaderName, jwtToken))
            .andExpect(status().isOk());//.andReturn();
  }
}
</code></pre>
",https://stackoverflow.com/questions/51124001/spring-boot-integration-testing-with-async-jobs-and-request-scope-beans,"['java', 'spring', 'multithreading', 'spring-boot', 'testing']",957,TRUE,0,1
How do I do integration testing and end to end testing?,"<p>We recently started TDD approach in our .NET project and we have done good unit testing so far but we are stuck with the question of integration and end to end tests. Say I have three objects whose constructors are as following</p>

<pre><code>constructor(kafka, sql, filesystem); // MOQ all the three
constructor(mongo, webservice, kafka); // MOQ all the three
constructor(googlemaps, sql); // MOQ all the two
</code></pre>

<p>Here we have 6 external components to be integrated into our application. We can do unit testing for the three objects by mocking all their dependencies in constructor injection and We can also do end to end testing by having real time set up for all the 6 external components.</p>

<p>My question is how do we deal with integration testing? does Integration testing deal with object testing? I believe unit testing deals with object testing, so integration must deal with external component testing. If we want to write integrate testing, How do I go with?</p>

<pre><code>// Setup kafka real and other objects must still be mocked
constructor(kafka, sql, filesystem); MOQ sql, filesystem but kafka is real
constructor(mongo, webservice, kafka); MOQ mongo, webservice but kafka is real
constructor(googlemaps, sql); MOQ all the two   
</code></pre>

<p>Write tests by making kafka component as real setup and all other objects as mocked. If we go this way, we end up with repetitive code similar to Unit test but instead of mock objects, we typically end up with real environment setup but the test cases will still be same right?</p>

<p>Can we just have unit tests and end to end tests only? because end to end test does integration test for all objects at once. If end to end tests does all the real time objects testing then why does we still do integration tests? What are some best practices for doing integration tests. When we should we go with doing integration tests. Any help is greatly appreciated.</p>
",https://stackoverflow.com/questions/48308908/how-do-i-do-integration-testing-and-end-to-end-testing,"['c#', 'unit-testing', 'testing', 'tdd', 'integration-testing']",4914,TRUE,0,1
Stub http-request in integration testing of js-app run with selenium,"<p>I do integration testing in my Vue SPA with <code>webdriverio</code> and <code>cucumberjs</code>.
When loaded my application does request to get data from api-server.</p>

<p>In my tests I'd like to modify / stub data returned from api-server without 'touching endpoint' (i.e. deny request and return my json).</p>

<p><code>Nock</code>, <code>moxios</code> and others won't work as my application is loaded with selenium.</p>

<p>I am aware about <code>json-server</code>, <code>wiremock</code>, but I don't want to modify my source code (urls) just for testing purposes.</p>

<p>Ideally <code>selenium</code> / <code>webdriverio</code> should intercept request or add custom code to webpage and return my json. </p>

<p>What options do I have? </p>
",https://stackoverflow.com/questions/49226414/stub-http-request-in-integration-testing-of-js-app-run-with-selenium,"['node.js', 'selenium', 'vue.js', 'mocking', 'integration-testing']",1206,TRUE,3,1
"A kind of integration testing in ASP.NET Core, with EF and AutoMapper","<p>I'm trying to test the path from my ASP.NET Core Controller to the DB, through repository which includes the usage of AutoMapper.</p>

<p>Here's my repository:</p>

<pre><code>using System;
using System.Linq;
using AutoMapper;
using DS.DTO.MasterData;
using DS.Utilities.DSExceptions;
using Microsoft.Extensions.Logging;
using Omu.ValueInjecter;

namespace DS.MasterData.Repositories
{
    public class PersonFactRepository : IPersonFactRepository
    {
        private readonly Database.MasterDataContext dbContext;
        private readonly ILogger&lt;PersonFactRepository&gt; logger;
        private readonly IMapper mapper;
        public PersonFactRepository(ILogger&lt;PersonFactRepository&gt; logger, Database.MasterDataContext dbcontext, IMapper mapper)
        {
            this.dbContext = dbcontext;
            this.mapper = mapper;
            this.logger = logger;
        }

        public PatientDto CreatePatient(CreatePatientDto inModel)
        {
            var dbPersonDim = mapper.Map&lt;CreatePatientDto, Database.PersonDim&gt;(inModel);
            var dbAddressDim = mapper.Map&lt;CreatePatientDto, Database.AddressDim&gt;(inModel);
            var dbPhoneDim = mapper.Map&lt;CreatePatientDto, Database.PhoneDim&gt;(inModel);

            var dbPersonFact = new Database.PersonFact { FactId = Guid.NewGuid() };

            dbPersonDim.PersonFact = dbPersonFact;
            dbAddressDim.PersonFact = dbPersonFact;
            dbPhoneDim.PersonFact = dbPersonFact;

            dbPersonDim.InitDates();
            dbAddressDim.InitDates();
            dbPhoneDim.InitDates();

            dbContext.SaveChanges();

            var returnVal = new PatientDto();
            returnVal.InjectFrom(dbPersonDim)
                     .InjectFrom(dbAddressDim)
                     .InjectFrom(dbPhoneDim);

            return returnVal;
        }
    }
}
</code></pre>

<p>My AutoMapper configuration:</p>

<pre><code>public class AutoMapperConfig : Profile
{
    public AutoMapperConfig()
    {
        CreateMap&lt;CreatePatientDto, Database.PersonDim&gt;(MemberList.None).ReverseMap();
        CreateMap&lt;CreatePatientDto, Database.AddressDim&gt;(MemberList.None).ReverseMap();
        CreateMap&lt;CreatePatientDto, Database.PhoneDim&gt;(MemberList.None).ReverseMap();
    }
}
</code></pre>

<p>My problem is how do I get my Mapper configuration into my fakeMapper?</p>

<pre><code>var inMemDB = Fakes.FakeDB.DB;
var loggerCntl = Substitute.For&lt;ILogger&lt;Controllers.PatientController&gt;&gt;();
var loggerPersonFactRepo = Substitute.For&lt;ILogger&lt;Repositories.PersonFactRepository&gt;&gt;();

AutoMapper.IMapper fakeMapper = ????

var personRepo = new PersonFactRepository(loggerPersonFactRepo, inMemDB, fakeMapper);
</code></pre>

<p>It's on purpose that I'm going for a integration test, as I want my test to be able to post data to the controller and test if the right data ends up in the right tables.</p>
",https://stackoverflow.com/questions/50944862/a-kind-of-integration-testing-in-asp-net-core-with-ef-and-automapper,"['c#', 'asp.net-core', 'automapper', 'xunit']",334,TRUE,0,1
What are the options for integration testing of React + Webpack + Rails API site?,"<p>Consider a site where Rails is used only for API. No server-side rendering.</p>

<p>With server-side rendering it's more or less clear. <code>capybara</code> starts <code>puma</code>, after which tests can connect to <code>puma</code> for pages.</p>

<p>But with no server-side rendering, there's no <code>puma</code> to ask for pages. How do I do that?</p>

<p><strong>Explain</strong> yourself when downvoting, please.</p>
",https://stackoverflow.com/questions/49840873/what-are-the-options-for-integration-testing-of-react-webpack-rails-api-site,"['ruby-on-rails', 'reactjs', 'rest', 'webpack', 'integration-testing']",481,TRUE,-1,2
Is It Acceptable To Get Reference Data From Database For Unit/Integration Testing?,"<p>Instead of manually constructing and populating my in-memory database with reference data objects mimicking what's really in my database to test my calls to Entity Framework Core (yes I know, I should be isolating the database and not testing it for a unit test; however 95% of my application's logic is all related to fetching the right entities for the right values from my database, not actual business logic), is it considered acceptable to connect to my physical database to pull just my reference data, then populate it in my in-memory database for running unit tests (really integration tests at this point) against said in-memory database?</p>

<p><strong>Edit - 4/23/2018:</strong>
The odds of me needing to delete any of my reference data are slim to none, although admittedly I'll probably be adding to my reference tables as time goes on. Is it still a poor idea to do this? I figure at the start of my test, I could query the underlying database once, cache that data, and then make use of it in my tests instead of querying the database repeatedly which would obviously be a bad idea because it'd slow the tests down a lot. Is it really preferable to create fakes/mocks of your reference data objects instead of pulling them in from the database? I understand for non-reference data that you'd want to fake/mock those, but I figured I'd save a lot of time if I didn't have to create fakes/mocks for all my reference data.</p>
",https://stackoverflow.com/questions/49951232/is-it-acceptable-to-get-reference-data-from-database-for-unit-integration-testin,"['unit-testing', 'integration-testing', 'entity-framework-core', 'in-memory-database']",105,FALSE,0,0
Integration testing of a WordPress plugin that needs composer and npm to be executed,"<p>I am writing integration tests for a plugin, and I did everything using <code>wp-cli</code> and <a href=""https://developer.wordpress.org/cli/commands/scaffold/plugin-tests/"" rel=""nofollow noreferrer"">scaffolding</a> the tests. And they are running fine when I run <code>phpunit</code>. But the problem I have is that I am using <code>composer</code> and <code>npm</code> - composer for some extra functionality, and <code>npm</code> for bundling my scripts.</p>

<p>The scripts part is important because I'm enqueueing the scripts from the <code>public</code> folder (build folder)</p>

<pre><code>$main_script = 'public/scripts/application.js';

wp_register_script( 'plugin-scripts', plugin_dir_url( __DIR__ ) . $main_script, array() );

wp_enqueue_script( 'plugin-scripts' );
</code></pre>

<p>I need to test if my scripts and styles are enqueued, so I added a test</p>

<pre><code>public function test_enqueued_scripts() {
    $this-&gt;admin-&gt;enqueue_styles();
    $this-&gt;assertTrue( wp_script_is( 'plugin-scripts' ) );
}
</code></pre>

<p><code>$this-&gt;admin</code> is just an instance of the class where my enqueue method is in the <code>setUp()</code> method.</p>

<p>And I get an error because it says that <code>Failed asserting that false is true.</code></p>

<p>The plugin I'm testing is built and composer is installed. All the folders exist and everything works when I'm locally on my WordPress instance. But the test instance is not the same as my local instance (ofc). I <code>error_log</code>ed in the enqueue method to check if the <code>file_exist</code> and I get <code>false</code>.</p>

<p>I need to test this with phpunit (clients requirements are to have full test coverage).</p>

<p>My <code>bootstrap.php</code> looks like this</p>

<pre><code>&lt;?php
/**
 * PHPUnit bootstrap file
 *
 * @package Plugin
 */

$_tests_dir = getenv( 'WP_TESTS_DIR' );

if ( ! $_tests_dir ) {
  $_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
}

if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) {
  echo ""Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?"" . PHP_EOL;
  exit( 1 );
}

// Give access to tests_add_filter() function.
require_once $_tests_dir . '/includes/functions.php';

/**
 * Manually load the plugin being tested.
 */
function _manually_load_plugin() {
  // Update array with plugins to include ...
  $plugins_to_active = array(
      'advanced-custom-fields-pro/acf.php',
      'my-plugin/my-plugin.php',
  );

  update_option( 'active_plugins', $plugins_to_active );

  require dirname( dirname( dirname( __FILE__ ) ) ) . '/advanced-custom-fields-pro/acf.php';
  require dirname( dirname( __FILE__ ) ) . '/my-plugin.php';
}
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );

// Start up the WP testing environment.
require $_tests_dir . '/includes/bootstrap.php';
</code></pre>

<p>How can I start the build process (<code>npm run build</code>) so that my scripts exist before my unit tests? Also is it possible to have this build step run only once, not once every time I run <code>phpunit</code>?</p>
",https://stackoverflow.com/questions/50722315/integration-testing-of-a-wordpress-plugin-that-needs-composer-and-npm-to-be-exec,"['php', 'wordpress', 'unit-testing', 'phpunit', 'integration-testing']",470,TRUE,2,2
getting the data from appsettings.json doesn&#39;t contain values during integration testing in asp.net core 2,"<p>I have one problem with integration testing in new .net core framework.</p>

<p>I've put some custom data in appsettings.json config and wanted to use it in some class. </p>

<pre><code>""Data"": {
  ""FolderName"": ""Data"",
  ""Files"": {
    ""Json"": ""work.json"",
    ""Csv"": ""work.csv""
  }
}
</code></pre>

<p>But when I do getting of the data inside class using IConfiguration interface - <code>folderName</code> variable is empty. </p>

<pre><code>private void InitializeDataFileFullPath(IConfiguration configuration)
    {
        var root = Directory.GetCurrentDirectory();

        var folderName = configuration[""Data:FolderName""];
        if (folderName == null)
        {
            throw new NullReferenceException(""Folder name with data files isn't specified in appsettings.json"");
        }
</code></pre>

<p>Also <code>root</code> variable shows not right path - <code>"".IntegrationTests\bin\Debug\netcoreapp2.0""</code>, but I expected to see something like <code>\.WebApi\</code></p>

<p>I followed <a href=""https://learn.microsoft.com/en-US/aspnet/core/mvc/controllers/testing"" rel=""nofollow noreferrer"" title=""thisquot;"">this</a> manual. I also wanted to do something like <a href=""https://stackoverflow.com/questions/41382978/appsettings-json-for-integration-test-in-asp-net-core"">there</a>, <strong><em>but there's no project.json file anymore</em></strong>.</p>

<p>P.S. </p>

<ol>
<li>If I run project just under Visual Studio - everything is fine.</li>
<li>My fixture class is absolutely the same as in manual from Microsoft. I thought all that manipulations provide me to have project which is being tested in right directory at least.</li>
</ol>

<p>Thanks for any advice.</p>

<p>(added)
The main thing of my post is that getting from appsettings shows different values for integration testing and for common running of the program. I want it to be the same. </p>
",https://stackoverflow.com/questions/48600901/getting-the-data-from-appsettings-json-doesnt-contain-values-during-integration,"['asp.net-core', '.net-core', 'integration-testing', 'xunit.net', 'appsettings']",601,FALSE,1,3
"Kafka Streams Integration Testing - Unable to Compile due to Class Package Mismatch - Apache Kafka, KafkaEmbedded","<p>I'm trying to compile code for integration test classes found in Confluent GitHub - <a href=""https://github.com/JohnReedLOL/kafka-streams/blob/master/src/test/java/io/confluent/examples/streams/GenericAvroIntegrationTest.java"" rel=""nofollow noreferrer"">GenericAvroIntegrationTest.java</a></p>

<p>I'm getting a compile time exception for one of the classes SecurityProtocol which is currently present in <code>import org.apache.kafka.common.security.auth.SecurityProtocol;</code>. When I compile using maven, it is complaining saying the following:</p>

<pre><code>[105,82] cannot access org.apache.kafka.common.protocol.SecurityProtocol


class file for org.apache.kafka.common.protocol.SecurityProtocol not found
</code></pre>

<p>This is used in the <a href=""https://github.com/JohnReedLOL/kafka-streams/blob/master/src/test/java/io/confluent/examples/streams/kafka/KafkaEmbedded.java"" rel=""nofollow noreferrer"">KafkaEmbedded.java</a> class. The code on Confluent GitHub uses the <code>org.apache.kafka.common.protocol.SecurityProtocol</code> package but the version I'm using has the same class moved to the other package I mentioned: <code>import org.apache.kafka.common.security.auth.SecurityProtocol</code>. If I revert back to the version Confluent is using, my code might not work (not sure which dependency version I've got wrong! :( ). How do I resolve this conflict? How do I find where it is wrongly being referred? </p>
",https://stackoverflow.com/questions/52933056/kafka-streams-integration-testing-unable-to-compile-due-to-class-package-misma,"['java', 'apache-kafka', 'apache-kafka-streams']",344,TRUE,0,1
Guide to automation framework in detox : React Native? Creating End 2 end and integration testing framework,"<hr />
<p>Automation testing on <strong>detox</strong> for <strong>react native apps</strong> to create E2E tests and integration tests.
Need suggestion on the following:</p>
<ul>
<li>Best Automation Framework that can be used TDD,BDD to avoid refactoring of code.</li>
<li>How to create integration tests for Android and iOS using detox and jest</li>
<li>Easy to use TestRunner Mocha or Jest or any other.</li>
<li>Any reporting mechanism once the test has been executed.</li>
<li>Any POC on detox automation for e2e testing with CI/CD.</li>
<li>Design Pattern like POM how to use it for React Native</li>
<li>Any Sample detox repository with step by step approach to integrate it with RN app.</li>
</ul>
<p><strong>Note:</strong> I have already installed the required dependency need in <strong>detox</strong> with <strong>Mocha</strong> from <a href=""https://github.com/wix/detox"" rel=""nofollow noreferrer"">Wix</a> git repo and successfully launched the demo project.Looking for a Framework template that I can use it as a reference in designing my own framework.</p>
",https://stackoverflow.com/questions/50837274/guide-to-automation-framework-in-detox-react-native-creating-end-2-end-and-in,"['react-native', 'automated-tests', 'mocha.js', 'jestjs', 'detox']",2025,TRUE,4,1
Integration testing using spring data persistance with SpringRunner and JUnit - dummy data differ for each test,"<p>I am not sure if the title is descriptive enough. I am trying to insert dummy data to my database for testing purposes and I thought I should check that the dummy data has been persisted as expected. To my surprise a particular record was not persisting, so I tried to to find what is wrong with that record. In the end I realized that there is nothing wrong with that particular record. </p>

<p>Bellow you can see the that there are 4 tests asserting exactly the same thing. 1 of them is failing 3 are passing...
<a href=""https://i.stack.imgur.com/JA44J.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/JA44J.png"" alt=""enter image description here""></a></p>

<p><a href=""https://i.stack.imgur.com/dZXOW.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/dZXOW.png"" alt=""enter image description here""></a></p>

<p>I think I am missing something fundamental here. Bellow is the test code</p>

<pre><code>package testingSpring.rentals.service;

import testingSpring.affiliates.Affiliate;
import testingSpring.affiliates.AffiliateDbUtils;
import testingSpring.cars.Car;
import testingSpring.cars.CarDbUtils;
import testingSpring.clients.Client;
import testingSpring.clients.ClientDbUtils;
import testingSpring.rentals.db.*;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.Date;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;

@RunWith(SpringRunner.class)
@ComponentScan({
        ""testingSpring.cars"",
        ""testingSpring.rentals.db"",
        ""testingSpring.clients"",
        ""testingSpring.rentals.service"",
        ""testingSpring.affiliates""
})
@DataJpaTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
public class RentalServiceTest {

    @Autowired
    private RentalRepository rentalRepository;

    @Autowired
    private CarDbUtils carDbUtils;

    @Autowired
    private RentalDbUtils rentalDbUtils;

    @Autowired
    private ClientDbUtils clientDbUtils;

    @Autowired
    private RentalService rentalService;

    @Autowired
    private AffiliateDbUtils affiliateDbUtils;

    @Before
    public void setup(){
        addDummyData();
    }



    @Test
    public void dummyDataIsPersisted(){
        assertThat(carDbUtils.count(), equalTo(5L));
        assertThat(clientDbUtils.count(), equalTo(1L));
        assertThat(affiliateDbUtils.count(), equalTo(1L));
        assertThat(rentalDbUtils.count(), equalTo(6L));

    }

    @Test
    public void letsCheckAgainJustForFun(){
        assertThat(carDbUtils.count(), equalTo(5L));
        assertThat(clientDbUtils.count(), equalTo(1L));
        assertThat(affiliateDbUtils.count(), equalTo(1L));
        assertThat(rentalDbUtils.count(), equalTo(6L));
    }
    @Test
    public void letsCheckAgainJustForFun2(){
        assertThat(carDbUtils.count(), equalTo(5L));
        assertThat(clientDbUtils.count(), equalTo(1L));
        assertThat(affiliateDbUtils.count(), equalTo(1L));
        assertThat(rentalDbUtils.count(), equalTo(6L));
    }
    @Test
    public void letsCheckAgainJustForFun3(){
        assertThat(carDbUtils.count(), equalTo(5L));
        assertThat(clientDbUtils.count(), equalTo(1L));
        assertThat(affiliateDbUtils.count(), equalTo(1L));
        assertThat(rentalDbUtils.count(), equalTo(6L));
    }

    private void addDummyData(){

        Car car1 = new Car(""1plate1"", ""datsun"", ""A"", ""2000"", ""manual"", ""4x4"", ""green"");
        Car car2 = new Car(""2plate2"", ""datsuna"", ""b"", ""2000"", ""manual"", ""4x4"", ""yellow"");
        Car car3 = new Car(""3plate3"", ""datsuno"", ""c"", ""2000"", ""manual"", ""4x4"", ""black"");
        Car car4 = new Car(""4plate4"", ""datsuni"", ""v"", ""2000"", ""manual"", ""4x4"", ""white"");
        Car car5 = new Car(""5plate5"", ""datsunu"", ""a"", ""2000"", ""manual"", ""4x4"", ""red"");
        carDbUtils.addCar(car1);
        carDbUtils.addCar(car2);
        carDbUtils.addCar(car3);
        carDbUtils.addCar(car4);
        carDbUtils.addCar(car5);


        Client client0 = new Client(0L,""kakakias"",""trois"", ""licencenu3"",""GH92312312"",1996,""09801983123"",""putanga3@grail.com"",""UK"",""40 falsefall way"");
        clientDbUtils.addClient(client0);

        Affiliate affiliate = new Affiliate(""Klasikos Malakas"", 0.25F, ""4234234"");
        affiliateDbUtils.addAffiliate(affiliate);

        Rental rental1 = new Rental(1L, car2,client0, affiliate, ""aerobromio"", ""aerobromio"", new Date(2018, 8, 10,12,0), new Date(2018,8,15,11,0), 150L,""gamistronas in"",""afroditi"", PaymentType.CASH, RemainingPetrol.R1_2, ""owefowekokfwek1"", ""no"");
        Rental rental3 = new Rental(2L, car3,client0, affiliate, ""aerobromio"", ""aerobromio"", new Date(2018, 8, 11,12,0), new Date(2018,8,5,11,0), 150L,""gamistronas in"",""afroditi"", PaymentType.CASH, RemainingPetrol.R1_2, ""owefowekokfwek2"", ""no"");
        Rental rental33 = new Rental(3L, car3,client0, affiliate, ""aerobromio"", ""aerobromio"", new Date(2018, 8, 20,12,0), new Date(2018,8,30,11,0), 150L,""gamistronas in"",""afroditi"", PaymentType.CASH, RemainingPetrol.R1_2, ""owefowekokfwek3"", ""no"");
        Rental rental4 = new Rental(4L, car4,client0, affiliate, ""aerobromio"", ""aerobromio"", new Date(2018, 8, 21,12,0), new Date(2018,8,30,11,0), 150L,""gamistronas in"",""afroditi"", PaymentType.CASH, RemainingPetrol.R1_2, ""owefowekokfwek4"", ""no"");
        Rental rental5 = new Rental(5L, car5,client0, affiliate, ""aerobromio"", ""aerobromio"", new Date(2018, 8, 15,12,0), new Date(2018,8,25,11,0), 150L,""gamistronas in"",""afroditi"", PaymentType.CASH, RemainingPetrol.R1_2, ""owefowekokfwek8"", ""no"");
        Rental rental = new Rental(6L, car1,client0, affiliate, ""aerobromio"", ""aerobromio"", new Date(2018, 8, 1,12,0), new Date(2018,8,10,11,0), 150L,""gamistronas in"",""afroditi"", PaymentType.CASH, RemainingPetrol.R1_2, ""owefoweko654kfwek"", ""no"");
        rentalDbUtils.addRental(rental);
        rentalDbUtils.addRental(rental1);
        rentalDbUtils.addRental(rental3);
        rentalDbUtils.addRental(rental33);
        rentalDbUtils.addRental(rental4);
        rentalDbUtils.addRental(rental5);


    }

}
</code></pre>

<p>Bellow is the dependencies</p>

<pre><code>&lt;dependencies&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
        &lt;groupId&gt;org.liquibase&lt;/groupId&gt;
        &lt;artifactId&gt;liquibase-core&lt;/artifactId&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
        &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
        &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
        &lt;version&gt;42.2.2&lt;/version&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
        &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;

    &lt;!-- https://mvnrepository.com/artifact/de.svenkubiak/jBCrypt --&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;de.svenkubiak&lt;/groupId&gt;
        &lt;artifactId&gt;jBCrypt&lt;/artifactId&gt;
        &lt;version&gt;0.4.1&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;

&lt;/dependencies&gt;

&lt;build&gt;
    &lt;plugins&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
            &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
        &lt;/plugin&gt;
    &lt;/plugins&gt;
&lt;/build&gt;
</code></pre>

<p>Please let me know if I need to include anything else to this description.</p>

<p>Thank you!</p>

<p>[EDIT]
I am using a workaround which can be consider as a hack, but for the time being it will let me proceed.
In Junit 4.11 and later you can specify the order a set of test will run by annotating the test class with:
<code>@FixMethodOrder(MethodSorters.NAME_ASCENDING)</code></p>

<p>so a an empty method <code>@Test public void AAA_WarmUp(){}</code></p>

<p>will run first and then the others are green. 
I am still curious though, so if someone has a proper explanation of what's going on I will be grateful. Thanks
[/EDIT]</p>
",https://stackoverflow.com/questions/52239215/integration-testing-using-spring-data-persistance-with-springrunner-and-junit,"['java', 'junit', 'spring-data-jpa']",82,FALSE,2,1
How to mock LocalDateTime.now() in an integration testing. I am using Spring Runner and not PowerMock,"<p>I have to compare with the current time.
Any solution would be helpful, it must run in integration testing  <code>LocalDateTime localDateTime = LocalDateTime.now();</code>.  </p>
",https://stackoverflow.com/questions/52055265/how-to-mock-localdatetime-now-in-an-integration-testing-i-am-using-spring-run,"['integration-testing', 'junit5', 'springrunner']",903,TRUE,1,1
Running single integration test inside docker in maven,"<p>I am trying to run integration testing on my maven project inside a docker container. I am using <a href=""https://github.com/spotify/dockerfile-maven"" rel=""nofollow noreferrer"">dockerfile-maven</a> plugin to move jar file inside my docker container and maven-failsafe-plugin to initiate my integration testing. But somehow integration testing starts before docker being built. Also it doesn't call my test functions.</p>
<p>Here is my pom.xml snippet.</p>
<pre><code>        &lt;plugin&gt;
            &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
            &lt;artifactId&gt;maven-failsafe-plugin&lt;/artifactId&gt;
            &lt;version&gt;2.12&lt;/version&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                &lt;goals&gt;
                    &lt;goal&gt;integration-test&lt;/goal&gt;
                &lt;/goals&gt;
                &lt;configuration&gt;
                    &lt;includes&gt;
                        &lt;include&gt;**/*.java&lt;/include&gt;
                    &lt;/includes&gt;
                &lt;/configuration&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
        &lt;/plugin&gt;

        &lt;plugin&gt;
            &lt;groupId&gt;com.spotify&lt;/groupId&gt;
            &lt;artifactId&gt;dockerfile-maven-plugin&lt;/artifactId&gt;
            &lt;version&gt;1.3.7&lt;/version&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                    &lt;id&gt;default&lt;/id&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;build&lt;/goal&gt;
                        &lt;goal&gt;push&lt;/goal&gt;
                    &lt;/goals&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
            &lt;configuration&gt;
                &lt;repository&gt;rohitbarnwal7/presto_him&lt;/repository&gt;
                &lt;tag&gt;${project.version}&lt;/tag&gt;
                &lt;buildArgs&gt;
                    &lt;JAR_FILE&gt;plugin-${project.version}-jar-with-dependencies.jar&lt;/JAR_FILE&gt;
                &lt;/buildArgs&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;
</code></pre>
<p>Update: With above configuration, integration test class are being called but none of the test is actually executed.</p>
<p>Any help will be highly appreciated. Thanks.</p>
",https://stackoverflow.com/questions/48577486/running-single-integration-test-inside-docker-in-maven,"['java', 'maven', 'docker', 'integration-testing', 'presto']",1832,FALSE,0,1
how to mock failure for google oauth?,"<p>I am doing integration testing on omniauth. I am following this tutorial.</p>

<p><a href=""https://github.com/omniauth/omniauth/wiki/Integration-Testing"" rel=""nofollow noreferrer"">https://github.com/omniauth/omniauth/wiki/Integration-Testing</a></p>

<p>The tutorial says in order to mock failure we put this line</p>

<pre><code>OmniAuth.config.mock_auth[:twitter] = :invalid_credentials
</code></pre>

<p>When i use facebook, it works. i.e it throws invalid credentials</p>

<pre><code>OmniAuth.config.mock_auth[:facebook] = :invalid_credentials
</code></pre>

<p>When i use google, it doesn't work. i.e it successfully authenticates</p>

<pre><code>OmniAuth.config.mock_auth[:google] = :invalid_credentials
</code></pre>

<p>Why does gmail not work? should i use any other symbol other than :google. I appreciate any help! Thanks!</p>
",https://stackoverflow.com/questions/52169390/how-to-mock-failure-for-google-oauth,"['ruby-on-rails', 'rspec', 'google-oauth']",391,TRUE,0,1
Spring context cache between integration tests - slow startup times,"<p>I have a spring boot application and when I am doing some integration testing I must wait the spring context to load, for example it takes about 4 seconds for the JPA slice (I know this is not too much time). Is there a way to make this instant at least while I am developing? </p>

<p>e.g. something like spring-dev-tools but between integration test runs, or run a separate integration testing application, or lazy init whole spring boot context</p>
",https://stackoverflow.com/questions/49177444/spring-context-cache-between-integration-tests-slow-startup-times,"['spring', 'startup']",255,FALSE,0,0
fails in user acceptance,"<pre><code> create table Minutes(Minute varchar2(5));
 create table orders(OrderID varchar(54), Orderplaced TIMESTAMP , 
 Ordercompleted TIMESTAMP);
 insert into orders
 VALUES   
 ('#1',TO_TIMESTAMP('2018-01-15 00:12:20', 'YYYY-MM-DD HH24:MI:SS'), 
 TO_TIMESTAMP( '2018-01-15 00:12:42', 'YYYY-MM-DD HH24:MI:SS'));
 insert into orders
 VALUES
 ('#2',TO_TIMESTAMP('2018-01-15 01:15:20', 'YYYY-MM-DD HH24:MI:SS'), 
 TO_TIMESTAMP( '2018-01-15 02:56:20', 'YYYY-MM-DD HH24:MI:SS'));
 insert into orders
 VALUES
 ('#3',TO_TIMESTAMP('2018-01-15 01:20:20', 'YYYY-MM-DD HH24:MI:SS'), 
 TO_TIMESTAMP( '2018-01-15 03:00:20', 'YYYY-MM-DD HH24:MI:SS'));

 insert into Minutes (Minute)

 select to_char(trunc(sysdate) + interval '1' minute * (level - 1), 
 'HH24:MI') as minute
 from dual
 connect by level &lt;= 1440;

 select a.Minute, nvl(count(b.OrderID),0) as orders
 from Minutes a
 left join orders b
 on a.Minute between to_char(cast( b.Orderplaced as date),'hh24:mi:ss')  and 
 to_char(cast( b.Ordercompleted as date),'hh24:mi:ss')
 where
 a.Minute &lt;= (select to_char(cast (sysdate as date),'hh24:mi:ss') from dual)
 group by a.Minute
 order by 1;
</code></pre>

<p>The processing time is too long and the result is undelivered as well.
 It works fine with Integration testing. Please have a look once.</p>
",https://stackoverflow.com/questions/48259995/fails-in-user-acceptance,"['sql', 'oracle']",72,FALSE,0,2
How do you define functional testing with two popular and seemingly contradictory explanations?,"<p>I've been researching the definition of functional testing and can't come across a concrete explanation and would appreciate some additional info to help reconcile this.</p>

<p>The two main ideas I have come across are:</p>

<ol>
<li>Functional Testing as a Testing Type and is comprised of the following Testing Levels: Unit Testing, Integration Testing, System Testing and Acceptance Testing.</li>
</ol>

<p><a href=""https://i.stack.imgur.com/jRGTy.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/jRGTy.png"" alt=""enter image description here""></a></p>

<ol start=""2"">
<li>Functional Testing as a separate level from Unit Testing and Integration Testing (sometimes a subset of System Testing other times precedes it) that tests the product end-to-end with a Black-box approach. Purpose is to verify all functional specifications defined.</li>
</ol>

<p><a href=""https://i.stack.imgur.com/NIMIM.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/NIMIM.png"" alt=""enter image description here""></a></p>
",https://stackoverflow.com/questions/48614190/how-do-you-define-functional-testing-with-two-popular-and-seemingly-contradictor,"['unit-testing', 'testing', 'functional-testing', 'system-testing']",1375,TRUE,1,2
How can I spy an inner function return value,"<p>I'm doing some integration testing, and I wonder how to get some inner function's return value, I thought about using mocks , but there's only get parameters there</p>

<p>example:</p>

<pre><code>def foo():
    goo()

def goo():
    return 3

def test():
    with patch(goo) as goo_mock:
        foo()
        assert goo_mock.return_value == 3
</code></pre>
",https://stackoverflow.com/questions/50323580/how-can-i-spy-an-inner-function-return-value,"['python', 'testing', 'mocking']",2945,TRUE,0,1
Using @Profile annotation for stubbing external behaviour,"<p>There are several web spring boot java applications. I need to prepare several components for integration testing. My task is to mock all external behaviour such as other projects's components, db calls etc. I found a solution for this using <code>@Profile</code>annotation from spring framework. Here's an <a href=""https://tuhrig.de/a-mocked-spring-security-configuration-for-testing/"" rel=""nofollow noreferrer"">example</a>. I can simply create new profile and declare two beans implementations for each profile: one for real usage, for production and another one for integration testing, for stubbing. It would look like this:</p>

<pre><code>@Profile(""PROD"")
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
}

@Profile(""MOCK"")
@Configuration
@EnableWebSecurity
public class SecurityMockConfig extends WebSecurityConfigurerAdapter {
}
</code></pre>

<p>But I have doubts about this design. It looks little bit messy for me. Does this solution considered acceptable for task I have?</p>
",https://stackoverflow.com/questions/51200145/using-profile-annotation-for-stubbing-external-behaviour,"['java', 'spring', 'spring-boot', 'integration-testing', 'stubbing']",667,FALSE,0,1
Making Spring Boot cron tasks configurable,"<p>Spring Boot allows you to create background ""cron-like"" tasks like so:</p>

<pre><code>@Component
public class MyTask {
    // Every hour on the hour
    @Scheduled(cron = ""0 0 0/1 1/1 * ? *"")
    public void doSomething() {
        // blah whatever
    }
}
</code></pre>

<p>This makes automated integration testing a wee bit difficult! I shouldn't have to have a running integration testing just hanging for an hour, waiting to see what happens when my task runs at the top of the hour. Nor should I have to wait to run my test near the hour so that I can confirm proper behavior at the top of the hour!</p>

<p><strong>Is there a way to make these <code>cron</code> values configurable?</strong> That way if I want to run my app in ""test mode"" I could schedule the <code>MyTask#doSomething()</code> method to run, say, every 30 seconds, etc.</p>
",https://stackoverflow.com/questions/48186354/making-spring-boot-cron-tasks-configurable,"['spring-boot', 'cron', 'scheduled-tasks']",4066,TRUE,3,2
Unable iterate all index when a range over JSON Array,"<p>I'm creating a standalone mockserver with JSON file as my input (request and response) for integration testing. I was able to serve first request only.</p>

<pre><code>// MockServices ...
type MockServices struct {
    Request  string `json:""request""`
    Response string `json:""response""`
}

func main() {
r := getMockServices()

for i, s := range r {
    for i &gt;= 0 {
        // fmt.Println(i)
        // fmt.Println(s.Request)
        http.HandleFunc(s.Request, func(w http.ResponseWriter, r *http.Request) {
            // not serving remaing endpoints
            w.Write([]byte(s.Response))
        })

        if err := http.ListenAndServe("":8080"", nil); err != nil {
            panic(err)
        }
    }
}}
</code></pre>

<p><a href=""https://play.golang.org/p/_kFaxMnRTJJ"" rel=""nofollow noreferrer"">https://play.golang.org/p/_kFaxMnRTJJ</a></p>

<p>Any help greatly appreciated.</p>

<p>Thanks in advance </p>
",https://stackoverflow.com/questions/49076206/unable-iterate-all-index-when-a-range-over-json-array,['go'],127,TRUE,-3,1
Testing Flutter code that uses a plugin and platform channel,"<p>I have a flutter plugin which uses the platform channel to do some native work.</p>

<p>How do I properly write tests for my application that requires this plugin?</p>

<p>Unit tests only are good for pure dart functions. I don't believe Widget testing will be able to test things that use the platform channel to native. So that leaves integration testing.</p>

<p>From what I understand is that integration testing will start your main application and you can control it around your app and test things.</p>

<p>For my case, I want to test just the code that uses the plugin (that uses the platform channel for native stuff).</p>

<p>Also what is important is the values that come back from the platform channel, so it is important to call the native side using a real platform channel and not a mock one.</p>

<p>Is that possible? Can I tell the integration tester to open a dummy version of my application, kind of like an integrated widget tester?</p>
",https://stackoverflow.com/questions/52028969/testing-flutter-code-that-uses-a-plugin-and-platform-channel,"['dart', 'flutter', 'flutter-test']",5609,TRUE,17,3
Testing Consul in two datacenter mode,"<p>We're integration testing a Java application which uses Consul for Service Discovery.  <a href=""https://github.com/pszymczyk/embedded-consul#passing-custom-configuration"" rel=""nofollow noreferrer"">The Embedded Consul examples</a> bootstrap a Consul server in a single datacenter, which works well for most of our testing.  However, we're trying to test a situation in which a service record exists in one datacenter and not another.  The <a href=""https://www.consul.io/intro/getting-started/join.html"" rel=""nofollow noreferrer"">consul guide</a> uses vagrant to create virtual environments for each datacenter, but this seems difficult to do in an automated testing environment.</p>

<p>Is this the only way to have a consul cluster running locally and simulating two datacenters?  Can the Embedded Consul library do this behind the scenes for us, or do we need to invoke vagrant in our integration testing configuration?</p>
",https://stackoverflow.com/questions/50295425/testing-consul-in-two-datacenter-mode,"['java', 'vagrant', 'consul']",688,TRUE,0,2
@ContextConfiguration and Security Chain Filter,"<p>I'm trying to implement integration testing in my app and have test class like that:</p>

<pre><code>@ExtendWith(value={SpringExtension.class})
@WebAppConfiguration
@ContextConfiguration(classes={AppConfiguration.class,WebMvcConfiguration.class})
public class TestClass{ ... }
</code></pre>

<p>inside class i have:</p>

<pre><code>mvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(SecurityMockMvcConfigurers.springSecurity()).build();
</code></pre>

<p>Sadly <code>@Autowired</code> cannot find my Security Spring Chain Filter (or <code>DelegatingFilterProxy</code>) and without it I feel like I won't be able to achievie full functionality of integration testing in spring (espescially the spring-security-test part).  In my opinion it's because I initialize my whole app by creating a class that extends <code>AbstractHttpSessionApplicationInitializer</code>. I also feel like adding some sort of custom initializer or loader classes into <code>@ContextConfiguration</code> would help, but acutally have no idea how to do it. Do you guys think it will help and/or can you guys steer me into creating my own loader/initializer?</p>
",https://stackoverflow.com/questions/51613873/contextconfiguration-and-security-chain-filter,"['spring', 'spring-mvc', 'spring-security', 'integration-testing']",170,FALSE,0,0
Should integration tests redo unit tests that use mocking?,"<p>While writing unit tests I will check only one class at a time. If I need to use additional classes then I will use mocking to make sure that test is independent.</p>

<p>Later I want to write integration tests, should I just copy/paste all unit tests that use mocking and test them after removing mock objects?</p>

<p>Example code:</p>

<pre><code>public class Event
{
    string title;
    List&lt;Hour&gt; hoursList = new List&lt;Hour&gt;();
    public Event(string title) { this.title = title; }
    public void AddHour(Hour newHour) { hoursList.Add(newHour); }
    public int HourCount() { return hoursList.Count; }
    public int TotalDuration() {
        int total = 0;
        foreach (var hour in hoursList)
        total += hour.GetDuration();
        return total;
    }
}
public class Hour
{
    string start;
    string end;
    public Hour(string start, string end) { this.start = start; this.end = end; }
    public virtual int GetDuration() { /* algorightm calculating duration in minutes */  }
}
</code></pre>

<p>Example test:</p>

<pre><code>int expected = 165;
Event Concert = new Event(""Local band concert"");
Mock&lt;Hour&gt; ehMock = new Mock&lt;Hour&gt;(""07:00"", ""08:30"");
ehMock.Setup(x =&gt; x.GetDuration()).Returns(90);
Mock&lt;Hour&gt; ehMock2 = new Mock&lt;Hour&gt;(""19:15"", ""20:30"");
ehMock2.Setup(x =&gt; x.GetDuration()).Returns(75);
Concert.AddHour(ehMock.Object);
Concert.AddHour(ehMock2.Object);
Assert.AreEqual(expected, Concert.TotalDuration());
</code></pre>

<p>In above unit test I'm testing TotalDurationmethod from Event class, the Hour class is mocked and I override the GetDuration() method. Now should I use the same test for integration testing, but without the Mock?</p>

<p>Maybe above example is too simple and integration testing isn't required. If I would have more advanced unit test then the integration test of same functionality is recommended?</p>
",https://stackoverflow.com/questions/51733746/should-integration-tests-redo-unit-tests-that-use-mocking,"['c#', 'unit-testing', 'tdd']",374,TRUE,3,2
Whitelist Google Cloud Build IPs to test database connection,"<p>I'm looking to give Cloud Build access to a PostgreSQL database during the steps because it's part of an integration testing from the Python application I'm running. Any suggestions on how to handle this authorization without exposing the database to the world?</p>
<p><a href=""https://i.stack.imgur.com/ho2Rn.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/ho2Rn.png"" alt=""enter image description here"" /></a></p>
",https://stackoverflow.com/questions/52903359/whitelist-google-cloud-build-ips-to-test-database-connection,"['google-container-registry', 'google-container-builder']",3865,TRUE,3,2
How does one write an automated integration test?,"<p>I read a lot about unit testing and integration testing, and the unit testing part I understand fairly well - isolate the object under test, and mock out dependencies using interfaces and inject those. (Or use seams to inject testable behavior). </p>

<p>However something that is still a mystery to me even after searching is integration testing. Every blog and link talks about testing various components together, do's and dont's, CI Servers, etc, but there's not much explanation in the way of how this is to be done. </p>

<p>Is an integration test automated? Or is this a manual effort? If it is automated, do I write this as code in the native language my app is in? How do I check or verify if the integration test is working as expected?</p>

<p>For example, if I have 4 services (a Socket Client, a Socket Server, a Database, and a Web Application) and I want to do some integration testing on how these 4 services interact with each other. How exactly how would I approach this? I know that some dummy data will be involved, but which part of my integration test is checking if the systems are working together correctly? This part is really unclear to me.</p>
",https://stackoverflow.com/questions/48176991/how-does-one-write-an-automated-integration-test,"['unit-testing', 'integration-testing']",1308,TRUE,2,1
Classes not found with Hadoop 3.0.0 alpha onward releases,"<p>In integration testing of my hBase based application iam using hbaseTestingUtil. In my dependency i have hadoop common and hadoop hdfs, upto 2.9.0 version everything was but after 3.0.0 release my facing classes not found errors like DistributedFileSystem , MiniCluster etc</p>
",https://stackoverflow.com/questions/51349683/classes-not-found-with-hadoop-3-0-0-alpha-onward-releases,"['hadoop', 'hbase']",40,FALSE,0,0
haskell mocking: define func in datatype with class-constraint,"<p>there is the function </p>

<pre><code>httpLBS :: MonadIO m =&gt; Request -&gt; m (Response ByteString) 
</code></pre>

<p>in the <strong>Network.HTTP.Simple</strong> module (<a href=""https://hackage.haskell.org/package/http-conduit-2.2.3/docs/Network-HTTP-Simple.html"" rel=""nofollow noreferrer"">doc</a>), which i want to pass around (for mocking later in integration-testing) with my <strong>Ctx</strong> data-object</p>

<pre><code>data Ctx =
    Ctx {
        token :: String,
        httpLBSFunc :: MonadIO m =&gt; Request -&gt; m (Response ByteString)
    } deriving (Show)
</code></pre>

<p>but I'm getting this error:</p>

<pre><code>Prelude&gt; :l Context.hs
[1 of 1] Compiling Context          ( Context.hs, interpreted )

Context.hs:19:32: error: Not in scope: type variable ‘m’
   |
19 |         httpLBSFunc :: MonadIO m =&gt; Request -&gt; m (Response B.ByteString)
   |                                ^

Context.hs:19:48: error: Not in scope: type variable ‘m’
   |
19 |         httpLBSFunc :: MonadIO m =&gt; Request -&gt; m (Response B.ByteString)
   |                                                ^
Failed, no modules loaded.
</code></pre>

<p>how is it possible to define this method in my <strong>Ctx</strong> data-type correctly??</p>
",https://stackoverflow.com/questions/53375057/haskell-mocking-define-func-in-datatype-with-class-constraint,['haskell'],74,FALSE,3,1
Embedded Elastic Search for Python 2.7,"<p>I am trying to do some Unit as well as Integration testing for a Python API which searches from an Elastic Search. For this I am looking for an Embedded version of  Elastic search for Python 2.7 version. Could someone please point me in the correct direction ?</p>
",https://stackoverflow.com/questions/51383084/embedded-elastic-search-for-python-2-7,"['python-2.7', 'elasticsearch']",120,FALSE,2,0
Citrus vs Mockito,"<p>I have recently come across the Citrus framework and was trying to use it.
But I found I can use Mockito as well in mocking the external service to do some Integration testing of my code.</p>

<p>What are specific advantages of using Citrus over Mockito?</p>
",https://stackoverflow.com/questions/49107395/citrus-vs-mockito,['citrus-framework'],310,TRUE,0,1
Failing to trigger StreamingMultipleProgramsTestBase Test in Scala,"<p>according to </p>

<p><a href=""https://ci.apache.org/projects/flink/flink-docs-release-1.4/dev/stream/testing.html"" rel=""nofollow noreferrer"">https://ci.apache.org/projects/flink/flink-docs-release-1.4/dev/stream/testing.html</a> for Scala</p>

<p>Integration testing part</p>

<p>the test try looks pretty much the same</p>

<pre><code>import java.util
import java.lang.Long
import com.google.common.collect.Lists
import org.apache.flink.streaming.api.functions.sink.SinkFunction
import org.apache.flink.streaming.api.scala.{DataStream, StreamExecutionEnvironment}
import org.apache.flink.streaming.util.StreamingMultipleProgramsTestBase
import org.apache.flink.api.common.typeinfo.TypeInformation
import org.junit.Test
import org.junit.Assert.assertEquals



class HotelSearchIntegrationTest extends StreamingMultipleProgramsTestBase{

  @Test
  def testMatching(): Unit = {
    val env = StreamExecutionEnvironment.getExecutionEnvironment
    env.setParallelism(1)


    env
      .fromElements(1L)
      .map( v =&gt; v).addSink( v =&gt; println(s""v""))

    // execute
    env.execute()

    assertEquals(1L, 1L)

  }

}
</code></pre>

<p><code>sbt test</code>
brings me no executes tests back</p>

<pre><code>[info] Compiling 1 Scala source to         .../target/scala-2.11/test-classes...
[info] Run completed in 10 milliseconds.
[info] Total number of tests run: 0
[info] Suites: completed 0, aborted 0
[info] Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
[info] No tests were executed.
[success] Total time: 1 s, completed Mar 7, 2018 4:30:45 PM
</code></pre>

<p>i just don't get what is wrong here.</p>

<p>thx for any hint.</p>
",https://stackoverflow.com/questions/49155762/failing-to-trigger-streamingmultipleprogramstestbase-test-in-scala,"['apache-flink', 'flink-streaming']",141,TRUE,0,2
HDFS / Hive / Spark Integration test,"<p>Consider the following scenario with the following steps:</p>

<ol>
<li>Load a csv file into HDFS  </li>
<li>Read this file using Spark  </li>
<li>Transform it  </li>
<li>Persist it to Hive  </li>
<li>Query it using SparkSQL  </li>
</ol>

<p>What is the best approach doing it in Scala? Which libraries can help with this integration testing?</p>
",https://stackoverflow.com/questions/52854688/hdfs-hive-spark-integration-test,"['scala', 'apache-spark', 'hadoop', 'integration-testing']",403,FALSE,1,0
How to restrict inner test @Configuration class to work only for this class?,"<p>Base test class for integration testing imports base configuration with component scan that includes almost all packages. In one test class I want to override some beans with Mocs, but this inner configuration is scanned and overrides beans for all tests. Is there some way to avoid this?</p>
",https://stackoverflow.com/questions/51154813/how-to-restrict-inner-test-configuration-class-to-work-only-for-this-class,"['java', 'spring']",1041,TRUE,2,1
haskell: reader-monad for dependency-injection,"<p>i get the basic functionality of the reader-monad from learnyouahaskell book and i've seen some advises here to make use of it for dependency-injection.
even there are some examples here on stackoverflow, i dont know how to use it for integration-testing.</p>

<p>my code is:</p>

<pre><code>list :: Ctx -&gt; [String] -&gt; IO String
list ctx args = do
    d &lt;- eitherDecode &lt;$&gt; Uplink.get (token ctx) (endpointActivities ctx) :: IO (Either String Activities)
    case d of 
        Left err -&gt; return err 
        Right result -&gt; return $ unlines . filterByPrefix (parsePrefix args) . extractNames $ activities result
</code></pre>

<p>uplink.hs</p>

<pre><code>get :: String -&gt; String -&gt; IO B.ByteString
get token endpoint = do
    req &lt;- parseRequest endpoint
    resp &lt;- httpLBS $ withAuth token req
    return $ getResponseBody resp
</code></pre>

<p>how can i mock the <strong>httpLBS</strong> - call for integration-testing with the reader-monad?</p>

<hr>

<p><strong>EDIT: !!!!</strong></p>

<p>i almost have it now with the reader-monad. the only problem left is that i dont know how i can define that httpsLBS-function in my Ctx-data-type.</p>

<p><strong>httpLBS</strong>-function-signature:</p>

<pre><code>httpLBS :: MonadIO m =&gt; Request -&gt; m (Response ByteString) 
</code></pre>

<p>my Ctx data-type-definition:</p>

<pre><code>data Ctx =
    Ctx {
        token :: String,
        endpointActivities :: String,
        endpointTimeTrackingStart :: String,
        httpLBSFunc :: MonadIO m =&gt; Request -&gt; m (Response ByteString)
    } deriving (Show)
</code></pre>

<p>i always get the error: <em>Not in scope: type variable ‘m’</em>
how can i define that function in my Ctx-data-type with its constraints?</p>

<p>i promise, that i will post my solution afterwards, when this last problem is solved </p>
",https://stackoverflow.com/questions/53284484/haskell-reader-monad-for-dependency-injection,"['haskell', 'dependency-injection']",340,FALSE,2,1
"Running Flutter Integration Tests in AWS Device Farm, Saucelabs, Firebase Test Lab etc","<p><strong>How do I run flutter integration tests (flutter_driver) non locally within an infrastructure like AWS Device Farm, Saucelabs, Firebase Test Lab?</strong></p>

<p><a href=""https://flutter.io/docs/testing#integration-testing"" rel=""noreferrer"">Running flutter_driver tests</a> on my local machine works smoothly and easily however cloud based mobile testing services don't have the required dependencies installed to utilize Flutter CLI commands.</p>

<p><strong>There are a few places in the Flutter repo that indicate this is possible</strong>, however I'm having a hard time finding exactly what needs to happen to make this possible (I have limited experience with Android &amp; iOS integration testing).</p>

<p><strong>A few references I've found</strong>:<br>
A comment discussing an integration test in the flutter_gallery: <a href=""https://github.com/flutter/flutter/issues/18879#issuecomment-400816050"" rel=""noreferrer"">https://github.com/flutter/flutter/issues/18879#issuecomment-400816050</a></p>

<p>A github issue to add a Firebase Test Lab integration test: <a href=""https://github.com/flutter/flutter/issues/11718"" rel=""noreferrer"">https://github.com/flutter/flutter/issues/11718</a></p>

<p><strong>What do I need to add to my flutter app to allow for remote integration testing inside AWS Device Farm, Saucelabs, Firebase Test Lab etc?</strong></p>

<p>Thanks for your help.</p>
",https://stackoverflow.com/questions/53307617/running-flutter-integration-tests-in-aws-device-farm-saucelabs-firebase-test-l,"['flutter', 'flutter-test']",2811,TRUE,8,2
Test automation Google Apps Script Gmail Add-ons,"<p>I am working on Gmail Add-on using Google Apps Script. I am using <a href=""https://script.google.com"" rel=""nofollow noreferrer"">Clasp</a> to develop it on locally then using this I am pushing it to <a href=""https://codelabs.developers.google.com/codelabs/clasp"" rel=""nofollow noreferrer"">script.google.com</a>. </p>

<p>In local, I can do <strong>Unit testing</strong> using any JavaScript testing framework. </p>

<p>But is there any way to do <strong>Integration testing</strong> and automate it?</p>
",https://stackoverflow.com/questions/50560866/test-automation-google-apps-script-gmail-add-ons,"['google-apps-script', 'automation', 'integration-testing', 'gmail-addons']",480,FALSE,3,1
how to mock mongo update error when use sinon,"<p>ref: <a href=""https://stackoverflow.com/questions/29120905/integration-testing-with-mongojs-to-cover-database-errors/29121096#29121096"">Integration testing with mongojs to cover database errors</a></p>

<p>the scene of link is as same as mine - integration test with mongoskin to cover db errors.</p>

<pre><code>var mongoskin = require('mongoskin');
var db = require('./setting').DB;
var collection = db.collection('test');
var route = require('express').Router();

...
route.post('test', function(req,res) {
    db.collection('test').update({...}, {...}, function (err, data) {
        if (err) {
            // this code should be tested
            logger.error(err);
            return;
        }

        // all is good, this is usually covered
    });
});
</code></pre>

<p>file.test.js</p>

<pre><code>var sinon = require('sinon');
var rewire = require('rewire');
var tc = rewire('./file');
var superagent = require('superagent');
var mongoskin = require('mongoskin');
var db = tc.__get__('db');

it('xx', function(done){
    var update = sinon.stub().yields(new Error('error'));
    sinon.stub(db, 'collection').returns({update: update})

    superagent.post(url).send(data).end(function(e,res){
        done();
    });
})
</code></pre>

<p>I try it but invalid.</p>

<p>Help. I hope to mock update of mongodb and set error to the 3rd arg, logger output the scream.</p>
",https://stackoverflow.com/questions/48458501/how-to-mock-mongo-update-error-when-use-sinon,"['mongodb', 'sinon']",337,FALSE,1,0
"Using the Elasticsearch test framework in IntelliJ, how to resolve the jar hell regarding idea_rt.jar?","<p>I am trying to use the provided Elasticsearch java test framework to do some integration testing on my es project.
I have a very simple test setup in IntelliJ:</p>
<pre><code>class FormTest : ESIntegTestCase() {

    override fun nodeSettings(nodeOrdinal: Int): Settings = Settings.builder()
        .put(super.nodeSettings(nodeOrdinal))
        //.put(&quot;node.mode&quot;, &quot;network&quot;)
        .build()

    @org.junit.Test fun start() {
        ensureGreen()
    }
}
</code></pre>
<p>However, when I run this, I get the following exception:</p>
<pre><code>java.lang.RuntimeException: found jar hell in test classpath

    at org.elasticsearch.bootstrap.BootstrapForTesting.&lt;clinit&gt;(BootstrapForTesting.java:92)
    at org.elasticsearch.test.ESTestCase.&lt;clinit&gt;(ESTestCase.java:190)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:592)
Caused by: java.lang.IllegalStateException: jar hell!
duplicate jar [C:\Users\user\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\181.5281.24\lib\idea_rt.jar] on classpath: ...
    at org.elasticsearch.bootstrap.JarHell.parseClassPath(JarHell.java:142)
    at org.elasticsearch.bootstrap.JarHell.parseClassPath(JarHell.java:98)
    at org.elasticsearch.bootstrap.JarHell.checkJarHell(JarHell.java:89)
    at org.elasticsearch.bootstrap.BootstrapForTesting.&lt;clinit&gt;(BootstrapForTesting.java:90)
    ... 4 more
</code></pre>
<p>I found some ways to bypass the jar hell check, but how to solve the issue?</p>
",https://stackoverflow.com/questions/51045201/using-the-elasticsearch-test-framework-in-intellij-how-to-resolve-the-jar-hell,"['elasticsearch', 'intellij-idea', 'kotlin']",1141,TRUE,3,2
spring boot override date,"<p>I am writing integration testing for the REST API. I am facing an issue while while testing
the logic for validateDate in MyService class. I would like to mock the currentDate() method MyService class in order to write the different test scenarios. How can I achieve this in spring boot?</p>

<pre><code>@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class MyControllerTest {

    TestRestTemplate restTemplate = new TestRestTemplate();

    @LocalServerPort
    private int port;   

    //@MockBean
    //MyService service;

    @Test
    public void testRetrieveStudentCourse() {
        HttpHeaders headers = new HttpHeaders();
        HttpEntity&lt;String&gt; entity = new HttpEntity&lt;String&gt;(null, headers);

        ResponseEntity&lt;String&gt; response = restTemplate.exchange(
                createURLWithPort(""/validatedate""),
                HttpMethod.GET, entity, String.class);

        String expected = ""true"";

        assertEquals(expected, response.getBody(), false);
    }

    private String createURLWithPort(String uri) {
        return ""http://localhost:"" + port + uri;
    }





import java.util.Date;

import org.springframework.stereotype.Service;

public interface IMyService {

    public boolean validateDate(Date date);
}

@Service
public class MyService implements IMyService{

    public boolean validateDate(Date date) {
        if(currentDate().before(date)) {
            return true;
        }
        return false;
    }

    private Date currentDate() {
        return new Date();
    }
}


import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MyController {
    @Autowired
    IMyService service;

    @GetMapping(value = ""/validatedate"", produces = MediaType.APPLICATION_JSON_VALUE)
    public boolean validateDate() {
        // date object will be retrieved.
        Date date = somedate;
        service.validateDate(date);
    }
}



Mockito.when(myservice.currentDate()).thenReturn(null);

         doReturn(null).when(myservice.currentDate());
</code></pre>
",https://stackoverflow.com/questions/52932691/spring-boot-override-date,"['spring-mvc', 'spring-boot', 'integration-testing']",129,FALSE,0,1
Conditional compilation in Elixir,"<p>I have an Elixir module that contains a demo that I use in development and for integration testing with other systems. I do not want that module to be compiled for the prod environment. Is there some cute trick with mix/config I can use to make sure this module is unavailable in certain contexts?</p>
",https://stackoverflow.com/questions/48565879/conditional-compilation-in-elixir,['elixir'],573,TRUE,3,1
Difference between spec and test folders,"<p>I have a concept problem, I am working on a rails project &amp; as per my knowledge both the test &amp; spec are used for tests. Where test refers to unit testing &amp; spec refers to integration testing. But I want to have to have full idea about those two folders &amp; if they both refers to test then what is the major difference between them?</p>
",https://stackoverflow.com/questions/48828372/difference-between-spec-and-test-folders,"['ruby-on-rails', 'unit-testing', 'testing', 'integration-testing']",4049,TRUE,10,1
Qnit and OPA testing in SAP UI5,"<p>I wanted to learn unit and integration testing in SAP UI5, but even after reading the documentations many things are unclear like</p>

<ol>
<li>what are we doing with sinon stub?  </li>
<li>How can we test controllers in Qunit?</li>
<li>How OPA testing works</li>
</ol>

<p>If anyone can explain with examples that would be really helpful.</p>

<p>Regards,
Raju</p>
",https://stackoverflow.com/questions/51224479/qnit-and-opa-testing-in-sap-ui5,"['unit-testing', 'integration-testing', 'qunit', 'sapui5']",1406,TRUE,0,1
Elasticsearch unit testing,"<p>With the latest <code>elasticsearch 6.4.1</code> I would like to implement unit testing. Currently implemented unit testing as integration testing as <code>RestHighLevelClient</code> is not mockable.I see that <code>RestClient</code> though mockable cannot be set to the restHighLevelClient. I want to mock elasticsearch so that i can run tests anywhere. Any possible way using the <code>Node</code> and <code>Settings</code> i don't want a full blown cluster.</p>
",https://stackoverflow.com/questions/52453660/elasticsearch-unit-testing,"['java', 'elasticsearch']",1969,TRUE,3,1
Docker Microservice Architecture - Communication between different containers,"<p>I've just started working with docker and I'm currently trying to work out how to setup a project using microservice architecture.</p>

<p>My goal is to move out different services from the api and instead have each one in their own container.</p>

<p><strong>Current architecture</strong></p>

<p><a href=""https://i.stack.imgur.com/ewRMg.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/ewRMg.png"" alt=""enter image description here""></a></p>

<p><strong>Desired architecture</strong></p>

<p><a href=""https://i.stack.imgur.com/mCKD7.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/mCKD7.png"" alt=""To""></a></p>

<p><strong>Questions</strong></p>

<ol>
<li>How does the API gateway communicate with the internal services? Should all microservices have their own API which only accept communication from the API gateway? Any other means of communications?</li>
<li>What would be the ideal authentication between the gateway and the microservices? JWT token? Basic Auth?</li>
<li>Do you see any problems with this architecture if hosted in Azure?</li>
<li>Is integration testing even possible in the desired architecture? For example, I use EF SQlite inmemory for integration testing and its easily accessible within the api, but I don't see this working if the database is located in it's own container.</li>
<li>Anything important here that i've missed?</li>
</ol>
",https://stackoverflow.com/questions/48296421/docker-microservice-architecture-communication-between-different-containers,"['azure', 'docker', 'microservices', 'docker-container']",685,TRUE,1,1
Object Not Updated in Unit Test,"<p>I'm trying to create a unit test using Moq and xUnit. The operation is very straightforward: calculate the number of days in a date range and update an object property. This works in integration testing, however the object property is not updated in my unit test</p>

<p>Unit Test:</p>

<pre><code>[Fact]
public void Bill_DayCount_IsCorrect()
{
    // Arrange
    Mock&lt;IRepository&gt; mockRepo = new Mock&lt;IRepository&gt;();

    Bill bill = new Bill
    {
        StartDate = DateTime.Parse(""2/1/2018""),
        EndDate = DateTime.Parse(""3/1/2018""),
    };

    // Act
    mockRepo.Object.GetBillDayCount(bill);

    // Assert
    // Here the bill.DayCount value = 0
    Assert.Equal(28, bill.DayCount);
}
</code></pre>

<p>The method in the repo:</p>

<pre><code>public Bill GetBillDayCount(Bill bill)
{
    bill.DayCount = (bill.EndDate - bill.StartDate).Days;
    return bill;
}
</code></pre>
",https://stackoverflow.com/questions/48855937/object-not-updated-in-unit-test,"['c#', 'unit-testing', 'asp.net-core', 'xunit']",201,TRUE,-2,1
Reset database container on openshift,"<p>I have a multi-modules vertx application deployed on OpenShift. For integration testing purposes, I would like to deploy a database container with pre-defined data, and destroy it when the test is finished.</p>

<p>How can I achieve this ?</p>

<p>My application uses junit and maven fabric8 plugin to deploy containers in Openshift. </p>
",https://stackoverflow.com/questions/49884577/reset-database-container-on-openshift,"['maven', 'junit', 'openshift', 'fabric8']",79,TRUE,0,1
how to provide @Property value to karaf bundle with pax-exam,"<p>I have my ipojo component like</p>

<pre><code>@Component(immediate = true)
@Provides
public class MyComponent {
    public MyComponent (@Property(mandatory = true, name = ""initialDelay"", value = ""60"") Long initialDelay)
    {
        ...
    }
</code></pre>

<p>For integration testing using pax-exam i am using test like below using </p>

<p><a href=""https://github.com/apache/karaf/blob/master/itests/common/src/main/java/org/apache/karaf/itests/KarafTestSupport.java"" rel=""nofollow noreferrer"">https://github.com/apache/karaf/blob/master/itests/common/src/main/java/org/apache/karaf/itests/KarafTestSupport.java</a></p>

<pre><code>@Test
    public void installBundle() throws Exception
    {
        executeCommand(""bundle:install mvn:com.my.osgi/MyComponent/2.0.2-SNAPSHOT"", ADMIN_ROLES);
        assertBundleInstalled(""MyComponent "");
    }
</code></pre>

<p>Now my question is how i can pass different values for ""initialDelay"" property so bundle test with my provided values?</p>
",https://stackoverflow.com/questions/51344541/how-to-provide-property-value-to-karaf-bundle-with-pax-exam,"['osgi', 'apache-karaf', 'pax-exam']",135,FALSE,0,1
How to know when record is committed in Kafka?,"<p>In case of integration testing, I send a record into Kafka, and I would like to know when it will be processed and committed, and then do my assertions (instead of using a <code>Thread.sleep</code>)...</p>

<p>Here is my try :</p>

<pre><code>public void sendRecordAndWaitUntilItsNotConsumed(ProducerRecord&lt;String, String&gt; record)
      throws ExecutionException, InterruptedException {

    RecordMetadata recordMetadata = producer.send(record).get();
    TopicPartition topicPartition = new TopicPartition(recordMetadata.topic(),
        recordMetadata.partition());

    try (KafkaConsumer&lt;String, String&gt; consumer = new KafkaConsumer&lt;&gt;(consumerConfig)) {

      consumer.assign(Collections.singletonList(topicPartition));

      long recordOffset = recordMetadata.offset();
      long currentOffset = getCurrentOffset(consumer, topicPartition);

      while (currentOffset &lt;= recordOffset) {
        currentOffset = getCurrentOffset(consumer, topicPartition);
        LOGGER.info(""Waiting for message to be consumed - Current Offset = "" + currentOffset
            + "" - Record Offset = "" + recordOffset);
      }
    }
  }

  private long getCurrentOffset(KafkaConsumer&lt;String, String&gt; consumer,
      TopicPartition topicPartition) {

    consumer.seekToEnd(Collections.emptyList());

    return consumer.position(topicPartition);
  }
</code></pre>

<p>But it doesn't work. Indeed, I disabled the commit of the consumer, and it doesn't loop on <code>Waiting for message to be consumed...</code></p>
",https://stackoverflow.com/questions/50148433/how-to-know-when-record-is-committed-in-kafka,"['apache-kafka', 'kafka-consumer-api']",547,TRUE,0,1
ASPNetCore Web API integration tests using Test Host or WebApplicationFactory,"<p>I am writing Integration Test for an ASPNetCore web API project. While reading about it I came across two terminologies, first is </p>

<p><code>Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory</code> </p>

<p>and second is </p>

<p><code>Microsoft.AspNetCore.TestHost</code></p>

<p>References:</p>

<ol>
<li><p><a href=""https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-2.1"" rel=""noreferrer"">https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-2.1</a></p></li>
<li><p><a href=""https://koukia.ca/integration-testing-in-asp-net-core-2-0-51d14ede3968"" rel=""noreferrer"">https://koukia.ca/integration-testing-in-asp-net-core-2-0-51d14ede3968</a></p></li>
</ol>

<p>I am a little confused, why and which kind of setup I should use to test Web API controllers?</p>
",https://stackoverflow.com/questions/52813368/aspnetcore-web-api-integration-tests-using-test-host-or-webapplicationfactory,"['c#', 'asp.net-core', 'integration-testing', 'xunit.net']",1458,TRUE,10,1
Awaitility in java,"<p>I am trying to write up a scenario for my integration testing using Awaitility package in java. </p>

<p>I have a call as below: </p>

<pre><code>System.out.println(...)
await().atMost(10,Duration.SECONDS).until(myFunction());
and some code here....
</code></pre>

<p>Here, it waits for 10 seconds until the myFunction() is called. </p>

<p>I want something like this,my requirement is: 
It should keep calling myFunction() for every second for a duration of 10 seconds. Is there any better approach for this?</p>
",https://stackoverflow.com/questions/51418237/awaitility-in-java,['awaitility'],15187,TRUE,3,2
Any pointers for creating Kafka endpoint support?,"<p>I have a fairly immediate need to support Kafka integration testing using the Citrus Framework. I was thinking of taking the existing jms module as an example/framework and using Spring Kafka. Any pointers or gotchas that I should be aware of? I am willing, assuming I'm successful, to donate the module back to the project.</p>
",https://stackoverflow.com/questions/49244539/any-pointers-for-creating-kafka-endpoint-support,"['apache-kafka', 'citrus-framework']",375,FALSE,0,1
Should Helper methods for cucumber steps definitions be tested?,"<p>I am using cucumber for integration testing. The steps definitions use some helper methods so that I don't have to replicate common functions in all the tests. The structure is the following- </p>

<pre><code>+---.idea
+---main
|   +---java
|   +---resources
\---test
|   +---java
|   |   \---stepdefs
|   |   |   |---ServiceHooks.java
|   |   |   |---StepDefinitions.java
|   |   |---TestRunner.java
|   |   \---stepdefsHelpers
|   |   |   |---ClientHelper
|   \---resources
|       \---features
|           |---LoginProfile.feature
|           |---UpdateProfile.feature
|---pom.xml
|---testng.xml
</code></pre>

<p>My question is: <strong>shouldn't I create UT in order to test stepdefsHelpers?</strong> Cause I don't want that somebody messes up the Helpers and my tests become brittle.</p>
",https://stackoverflow.com/questions/50845300/should-helper-methods-for-cucumber-steps-definitions-be-tested,"['cucumber', 'cucumber-java']",796,TRUE,0,1
Unit Testing when using EF Core 2.0,"<p>For the project I am doing in my internship we have to use a repository pattern. Since the project was already using EF Core and I read that there was already repository and unit of work in the underlying implementation. I figured I would just use the EF Core methods directly without implementing repository classes as I wanted to prevent clutter.</p>

<p>Well now I am in a bit of a problem, I can't seem to find much useful information on unit testing when I implement this way. The requirement is a hard requirement, and I required 100% coverage of CRUD functions within my controllers due to the standards of this firm. I found some of the Microsoft Documentation <a href=""https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-with-dotnet-test?view=aspnetcore-2.1"" rel=""noreferrer"">here</a>, <a href=""https://learn.microsoft.com/en-us/aspnet/core/mvc/controllers/testing?view=aspnetcore-2.1"" rel=""noreferrer"">here</a>, and the integration testing <a href=""https://learn.microsoft.com/en-us/ef/core/miscellaneous/testing/sqlite"" rel=""noreferrer"">using SQLite</a> but I still can't seem to figure out unit testing. I did some googling as well and I can't find resources aside from integration testing.</p>

<p>Is there some way I can unit test using EF Core directly, or am I gonna have to make repositories in order to properly unit test this program?</p>
",https://stackoverflow.com/questions/51749932/unit-testing-when-using-ef-core-2-0,"['c#', 'unit-testing', 'asp.net-core', 'entity-framework-core', 'asp.net-core-mvc-2.0']",7507,TRUE,6,2
Unit Testing with Laravel,"<p>I'm using PHP with Laravel 5.5 framework.
I recently started writing unitTests for my code and I got a few questions:</p>

<ol>
<li><p>What is the best way to interact with my database? 
Should I use InMemoryDB like SQLite or Mock everything with Mockery.</p></li>
<li><p>If I have an interaction with DB than that is still unitTesting or Integration Testing?</p></li>
</ol>

<p>Thank you for the answers in advence</p>
",https://stackoverflow.com/questions/53740130/unit-testing-with-laravel,"['laravel', 'unit-testing']",567,FALSE,5,1
NodeJS write to stdin in jest tests,"<p>I have a command-line app that reads user input from <code>stdin</code>:</p>

<pre><code>const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
});

rl.on('line', (line) =&gt; {
  doSomething();
});
</code></pre>

<p>To write integration tests, I need to be able to write to <code>stdin</code> to activate the <code>'line'</code> event. However, calling <code>process.stdin.write(`abc${os.EOL}`)</code> in my test case produces an error (since the stream is unidirectional read-only):</p>

<blockquote>
  <p>This socket is closed</p>
</blockquote>

<p>How should I resolve this?</p>

<p>Is the only option to skip the command-line integration testing and test <code>doSomething</code> only?</p>
",https://stackoverflow.com/questions/52463456/nodejs-write-to-stdin-in-jest-tests,"['javascript', 'node.js', 'testing', 'integration-testing', 'jestjs']",2145,FALSE,4,1
"Express, Mongoose, Jest sometimes failed sometimes pass","<p>I want to make integration testing with MonggoDB.
I use jest and mongoose.</p>

<p>My code sometimes pass, sometimes not.
I'v search for two days, and modify the code. But it doesn't solve the problem.</p>

<p>I currently only have two test file:
here is my repo: <a href=""https://github.com/tsulatsitamim/sia-server/tree/d6a211f2dc773f4469c988dd9746b206a398d67f/test/integration"" rel=""nofollow noreferrer"">https://github.com/tsulatsitamim/sia-server/tree/d6a211f2dc773f4469c988dd9746b206a398d67f/test/integration</a></p>

<p><a href=""https://i.stack.imgur.com/QNO5m.png"" rel=""nofollow noreferrer"">PASS TEST</a></p>

<p><a href=""https://i.stack.imgur.com/x5FMy.png"" rel=""nofollow noreferrer"">FAILED TEST</a></p>

<p><a href=""https://i.stack.imgur.com/HUfY4.png"" rel=""nofollow noreferrer"">OTHER FAILED TEST</a></p>
",https://stackoverflow.com/questions/51569835/express-mongoose-jest-sometimes-failed-sometimes-pass,['jestjs'],95,TRUE,0,1
How to run a slightly different version of a test class in xunit,"<p>I am integration-testing a ASP.NET Core API application, where clients can access the same resource in two different routes (for backward compatibility reasons).</p>

<p>I have a test class with around 40 tests.</p>

<p>How can I run the test two times, one with route A and one with route B? Like a <code>[Theory]</code> but at the class level.</p>

<p>My alternative is to decorate each method with:</p>

<pre><code>[Theory]
[InlineData(""/routeA"")]
[InlineData(""/routeB"")]
</code></pre>
",https://stackoverflow.com/questions/52771016/how-to-run-a-slightly-different-version-of-a-test-class-in-xunit,"['asp.net-core', 'xunit', 'xunit.net']",64,TRUE,3,2
Can i access the metamask using Selenium Webdriver.,"<p>For one of my projects, i am doing an integration testing. 
I have done the UI Automation, API Automation and Performance testing.
But i also want to test the the backend i.e. the blockchain side of the project, where i want to test whether the actual cryptocurrency got transferred or not.
So do we have any provision to automate the Metamask plugin using any test framework?</p>
",https://stackoverflow.com/questions/49274081/can-i-access-the-metamask-using-selenium-webdriver,"['selenium', 'testing', 'frameworks', 'blockchain', 'metamask']",827,FALSE,1,0
How to skip remaining steps if previous steps failed in Junit,"<p>I had some integration testing cases, they ran as Junit test cases with a special category: </p>

<pre><code>@Category(IntegrationTest.class)
</code></pre>

<p>Because they are integration testing cases, so the cost of every steps is high.
Usually I will re-use some results from previous steps to reduce this cost.
To make it works, I added this into them:</p>

<pre><code>@FixMethodOrder(MethodSorters.NAME_ASCENDING)
</code></pre>

<p>Some samples like this:</p>

<pre><code>@Category(IntegrationTest.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestAllocationPlanApi {

    @Test
    public void testStep01_verifyOrigProgram22275() {...}

    @Test
    public void testStep02_CopyProgram() {...}
}
</code></pre>

<p>They work well except the failure process:</p>

<p>If step01 failed, we don't need to run step02, but Junit still go to step02. </p>

<p>It is a waste and makes the test cases more complicated because you need to carefully handle those variables which are passed into step02.</p>

<p>I tried </p>

<pre><code>-Dsurefire.skipAfterFailureCount=1
</code></pre>

<p>Which is discussed in <a href=""https://stackoverflow.com/questions/1923857/is-there-a-way-to-fail-fast-for-junit-with-the-maven-surefire-plugin"">another thread</a>, but it doesn't work, the test cases still go to next step if previous steps fails.</p>

<p>Another annoying thing about the test cases is that Junit always resets all instance variables before every step. This forces me to use static variable to pass previous result into next step:</p>

<pre><code>private static Integer contractAId;
</code></pre>

<p>And I have no way to run  them in multiple threads.</p>

<p>Does anybody have good ideas to handle those things?</p>

<p>Thanks!</p>

<p>Happy new year!  </p>
",https://stackoverflow.com/questions/48066736/how-to-skip-remaining-steps-if-previous-steps-failed-in-junit,"['java', 'maven', 'junit', 'integration-testing']",1671,TRUE,1,2
XUnit Net Core Web API Integration Test: &quot;The ConnectionString property has not been initialized.&quot;,"<p>Just trying to build an Integration Test project for a NET Core Web API.
So I've followed a few examples, including this one (<a href=""https://dotnetcorecentral.com/blog/asp-net-core-web-api-integration-testing-with-xunit/"" rel=""nofollow noreferrer"">https://dotnetcorecentral.com/blog/asp-net-core-web-api-integration-testing-with-xunit/</a>) and naturally, I run into issues.  When I run the simple GET test I get an exception:
""System.InvalidOperationException : The ConnectionString property has not been initialized.""</p>

<p>Any help would be appreciated.</p>
",https://stackoverflow.com/questions/53826747/xunit-net-core-web-api-integration-test-the-connectionstring-property-has-not,"['integration-testing', 'asp.net-core-webapi', 'xunit']",924,TRUE,0,2
Is it possible to attach an unversioned file to a pull request?,"<p>In TFS, is it possible to attach a non-versioned file to a pull request? We use pull requests as documentation of code review and would like to attach proof of testing to pull requests so the evidence is all in the same place. </p>

<p>Our proof of integration testing is usually as a PDF with attached screenshots, hence the question.</p>

<p>We are using TFS Version 16.122.27102.1.</p>
",https://stackoverflow.com/questions/51895044/is-it-possible-to-attach-an-unversioned-file-to-a-pull-request,['tfs'],88,FALSE,0,1
Tools for scaffolding a .NETCore WebAPI project with Entity Framework and integration tests,"<p>I'm making the switch from frontend/Angular to backend/.NETCore. The biggest hurdle I've had is understanding what goes into scaffolding, especially when it comes to integration testing a WebAPI project and Entity Framework migrations.</p>

<p>Are there scaffolding tools similar to Angular Cli that promote good practices around things like setting up new projects or adding new classes in an organized, easily maintainable way?</p>
",https://stackoverflow.com/questions/51275906/tools-for-scaffolding-a-netcore-webapi-project-with-entity-framework-and-integr,"['entity-framework', '.net-core', 'asp.net-core-webapi']",316,TRUE,0,2
integration tests for react redux redux-saga,"<p>I have a project structure like this: </p>

<pre><code>app/
  global/
    styles/
    components/
  scenes/
    Home/
      actions.js
      constants.js
      index.jsx
      reducer.js
      sagas.js
      styles.styl
      index.spec.jsx
    some-other-scene/
      actions.js
      constants.js
      index.jsx
      reducer.js
      sagas.js
      styles.styl
      index.spec.jsx
</code></pre>

<p>so I have no problem with unit test with this structure, but I'm pretty confused as to how to structure integration test. For my unit tests I am exporting each scene component as a class </p>

<pre><code>export class SomeComponent extends Component {}
</code></pre>

<p>and as a redux connected component</p>

<pre><code>export default connect(
  mapStateToProps,
  mapDispatchToProps
)(SomeComponent)
</code></pre>

<p>So for the fist style of export (the class) I am unit testing it, but for the second way (the connected component way) I am unsure how to approach this specifically how to do integration testing in react/redux. I've searched the internet about this, but nothing that is close to this structure.</p>

<p>So:</p>

<ol>
<li>is integration testing in react/redux/middleware (in this case redux saga) how one component integrates with redux and middleware.</li>
<li>Or is it about how the whole app works with all the components mounted?</li>
<li>if it's #1 does that mean each component should have a single integration test file that tests how the component integrates with redux and middleware or if it's #2 then is it one test file that tests all components as one app?</li>
</ol>

<p>also, if it's #1 then how should I test routes via react router?</p>
",https://stackoverflow.com/questions/51295853/integration-tests-for-react-redux-redux-saga,"['reactjs', 'redux', 'react-redux', 'integration-testing', 'redux-saga']",1025,TRUE,7,3
What is the best approach to declare Api constants,"<p>I am developing a RESTful application using Spring Boot. Currently I am using interfaces to declare endpoints because I want to re-use those endpoint in :</p>

<ol>
<li>Spring controllers (e.g. Api.Product.GET_ONE) </li>
<li>Integration Testing (e.g. Api.Product.BASE_PATH + Api.Product.GET_ONE) </li>
<li><p>Share same interface in client application</p>

<pre><code>public interface Api {
    String CONTEXT_PATH = ""/gateway"";

    interface Product {
        String BASE_PATH = ""/product"";
        String GET_ONE = ""/{id}"";
    }

    interface Order {
        String BASE_PATH = ""/order"";
        String GET_ONE = ""/{id}"";
    }
}
</code></pre></li>
</ol>

<p>According to Joshua Bloch, The constant interface pattern is a poor use of interfaces. SonarQube also shows this (<a href=""https://sbforge.org/sonar/rules/show/squid:S1214"" rel=""nofollow noreferrer"">squid:S1214</a>) warning.</p>

<p>What is the best way to declare endpoints? </p>
",https://stackoverflow.com/questions/48053381/what-is-the-best-approach-to-declare-api-constants,"['java', 'spring-mvc', 'restful-url']",1248,FALSE,0,1
Parameters not getting passed in REST call. But works fine in postman,"<p>I'm performing Integration testing in below getPlanPreferenceRules endpoint and the parameters values are not passed over to preferences-admin-service. However, when i try to test the same in postman it works fine.</p>

<p>Below is the code that performs REST call.</p>

<pre><code>@Override
    public ServiceClientResponse&lt;GetPlanPrefRulesResponse&gt; getPlanPrefereneRules(GetPlanPrefRulesRequest parameters,
            String currentUserId, String correlationId, String requestorApp) {

        RequestEntity&lt;?&gt; targetRequest = 
                createGetPlanPrefRulesRequest(parameters, currentUserId, correlationId, requestorApp);

        return this.restClientService.exchangeAndParse(
                this.getRulesRestTemplate, targetRequest, new TypeReference&lt;GetPlanPrefRulesResponse&gt;(){});
    }
</code></pre>

<p>Below is the Spring controller service:</p>

<pre><code>@GetMapping(value = PATH_PLAN_PREF_RULES)
    public ResponseEntity&lt;?&gt; getPlanPrefRules(
            @Valid  final GetPlanPrefRulesRequest request )
    {
        log.info(""getPlanPrefRulesDataRequest: Entering: GetPlanPrefRulesRequest={}"", request); 
        return ResponseEntity.ok(this.getPlanPreferenceRulesService.getPlanPrefRules(request));
    }
</code></pre>

<p>Below is the code that creates the request for the REST call:</p>

<pre><code>protected RequestEntity&lt;?&gt; createGetPlanPrefRulesRequest(
            final GetPlanPrefRulesRequest parameters,
            final String currentUserId,
            final String correlationId,
            final String requestorApp)
    {
        URI targetUri = UriComponentsBuilder.fromUri(this.preferencesServiceUri)
                .path(this.rulesPath).build().toUri();

        HttpHeaders targetHeaders = createHeaders(
                currentUserId,
                correlationId,
                requestorApp);

        return new RequestEntity&lt;&gt;(
                parameters,
                targetHeaders,
                HttpMethod.GET,
                targetUri);
    }
</code></pre>

<p>I am not sure what i am missing. Any inputs appreciated!</p>
",https://stackoverflow.com/questions/51833127/parameters-not-getting-passed-in-rest-call-but-works-fine-in-postman,"['java', 'rest', 'spring-boot', 'controller', 'endpoint']",53,FALSE,0,1
Delete CloudFormation stack if CodeBuild fails,"<p>I have a Stage in CodePipeline that deploys CloudFormation templates to generate environments on the fly to perform integration testing. I would like to erase those environment if the integration tests fail but I do not know how to approach the issue. I was thinking on adding a CloudWatch event to trigger a lambda but then I have the constraint of the 5 minutes timeout for the lambda.</p>
",https://stackoverflow.com/questions/50409085/delete-cloudformation-stack-if-codebuild-fails,"['integration-testing', 'aws-cloudformation', 'aws-codepipeline']",247,TRUE,0,1
Running maven integration test inside docker container,"<p>I am using dockerfile-maven plugin to move my jar file inside docker container before running integration testing. But mvn verify command builds the images and run integration test, as a result test fails. Can someone help me run the docker images before running integration test. So that I can ping to service running inside docker container from my integration test file.</p>

<p>Below is my integration test file.</p>

<pre><code>import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.SQLException;
import java.sql.ResultSet;
import java.io.IOException;
import java.io.File;
import java.util.Scanner;
import static org.hamcrest.MatcherAssert.*;
import static org.junit.matchers.JUnitMatchers.*;
import org.junit.Assert.*;
import com.facebook.presto.jdbc.PrestoDriver;
import io.airlift.log.Logger;
import org.testng.annotations.Test;

class IntegrationTestIT {

@Test
public void checkForQueryInFile() {

    System.out.println(""This test method should be run"");
    String url = ""jdbc:presto://localhost:8889/jmx/default"";

    Statement stmt = null;
    try {
        Connection connection = DriverManager.getConnection(url, ""jumbo"", null);

        stmt = connection.createStatement();
        String file_path = """";
        String sql_string = ""show schemas"";

        ResultSet rs = stmt.executeQuery(sql_string);
        File folder = new File(""//jars"");
        // Move this to constant class
        File[] files = folder.listFiles(); 

        for (File file:files) {
            if (file.isFile()) {
                file_path = file.getAbsolutePath();
            }
        }
        File log_file = new File(file_path);
        final String scanner = new Scanner(log_file).useDelimiter(""\\Z"").next();;

        assertThat(scanner, containsString(sql_string));

    rs.close();
    stmt.close();
    connection.close();

    } catch (IOException exception) {
        exception.printStackTrace();
    } catch(SQLException sqlException) {
        sqlException.printStackTrace();
    }
}
}
</code></pre>

<p>Test Report:</p>

<pre><code>[INFO] Successfully built rohitbarnwal7/presto_log_updated:0.0.1
[INFO] maven-failsafe-plugin:2.5:integration-test (default) @plugin
[INFO] Failsafe report directory: /Users/rohit/workspace/presto plugins/target/failsafe-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestSuite
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.833 sec &lt;&lt;&lt; FAILURE!

Results :

Failed tests:
  checkForQueryInFile(IntegrationTestIT)

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
</code></pre>

<p>Integration Test result from TestSuite.txt</p>

<pre><code>Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.559 sec &lt;&lt;&lt; FAILURE!
checkForQueryInFile(IntegrationTestIT)  Time elapsed: 0.015 sec  &lt;&lt;&lt; FAILURE!
java.lang.IllegalAccessException: Class org.testng.internal.MethodInvocationHelper can not access a member of class IntegrationTestIT with modifiers ""public""
    at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102)
    at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:296)
    at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:288)
    at java.lang.reflect.Method.invoke(Method.java:491)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
    at org.testng.TestRunner.privateRun(TestRunner.java:774)
    at org.testng.TestRunner.run(TestRunner.java:624)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
    at org.testng.SuiteRunner.run(SuiteRunner.java:261)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1191)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1116)
    at org.testng.TestNG.run(TestNG.java:1024)
    at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62)
    at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:141)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:180)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
    at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)
</code></pre>
",https://stackoverflow.com/questions/48657869/running-maven-integration-test-inside-docker-container,"['java', 'maven', 'dockerfile']",2647,TRUE,2,1
Automated integration tests of Azure Service integrations in Azure DevOps CI,"<p>I have a project written on Java within Azure DevOps.</p>

<p>I have some integrations, like Postgresql DB, CosmosDB, Storage Queue, Storage Blob. There are some emulators for these Azure service, which I can use for integration testing on my local machine <strong>during development</strong>.</p>

<p>What about <strong>CI?</strong> Are there practices/tools for such tests?</p>

<p><em>For example, GitLab provides (they call them) Services which are Docker containers with some applications, like relational databases, inside:</em> <a href=""https://docs.gitlab.com/ee/ci/services/postgres.html"" rel=""nofollow noreferrer"">https://docs.gitlab.com/ee/ci/services/postgres.html</a></p>
",https://stackoverflow.com/questions/53063196/automated-integration-tests-of-azure-service-integrations-in-azure-devops-ci,"['postgresql', 'azure', 'azure-devops', 'azure-storage', 'azure-cosmosdb']",916,TRUE,3,2
How can I get/print the JSON response from a RESTful service call in Groovy with Spring Cloud Contract,"<p>While implementing Spring Cloud Contract for integration testing of micro services, I have defined a Contract in Groovy and compared the expected JSON response by hard coding the values in a .json file. Everything works.</p>

<p>But, if I want to validate dynamically instead of having a static JSON response, I found a way but I need to get the dynamic JSON response into a string variable from the response of a REST endpoint invocation.</p>

<pre><code>import org.springframework.cloud.contract.spec.Contract

Contract.make {

    request {
        method 'GET'
        url '/micro-service/90640454'
        headers {
            header 'Content-Type': 'application/json;charset=UTF-8'
        }
    }

    response {
        status 200
        headers {
            header 'Content-Type': 'application/json;charset=UTF-8'
        }
        -- how can i get the actual_response here
        body (file('expected_response.json'))
    }
}
</code></pre>
",https://stackoverflow.com/questions/53857831/how-can-i-get-print-the-json-response-from-a-restful-service-call-in-groovy-with,"['json', 'spring-boot', 'groovy', 'spring-cloud-contract']",467,FALSE,0,1
Creating docker images from puppet for jenkins,"<p>I'm currently trying to set up some continuous integration testing for the company I work for. System is LAMP based web application and I'm trying to get jenkins set up to do some continuous integration testing.</p>

<p>Current stumbling block is finding a docker image to run jenkins within PHP, most of the images I've found are out of date (haven't been updated in a year) and then don't work when you try to run through the jenkins setup.</p>

<p>We currently have a puppet configuration for our production servers and my current line of thinking is to use <a href=""https://github.com/puppetlabs/puppetlabs-image_build"" rel=""nofollow noreferrer"">puppet image build</a> to create a docker image based on our production set up; with the added bonus of like for like testing. </p>

<p>The problem here though is that we don't want to install jenkins on all our production servers. <strong>Is there a way to add jenkins to a created docker image?</strong> (preferably via CLI). And am I tackling this the right way or am I putting the cart before the horse i.e. <strong>should I be looking at trying to put PHP on a working jenkins image?</strong></p>
",https://stackoverflow.com/questions/51191229/creating-docker-images-from-puppet-for-jenkins,"['php', 'docker', 'jenkins', 'puppet']",76,TRUE,0,1
"What is the difference between unit, integration and end-to-end tests in Angular?","<ol>
<li>What is the difference between Unit, Integration and End-to-end testing in Angular?</li>
<li>Which the principles or paradigms should I know to implement each kind of these tests, how it works?</li>
</ol>
<p>I found out that unit testing is for component class, integration testing is for component's class and template together.</p>
<p>But I didn't find how does end-to-end testing differ from these ones, how can I implement them in Angular, which are the principles and paradigms for these types of testing.</p>
",https://stackoverflow.com/questions/52606199/what-is-the-difference-between-unit-integration-and-end-to-end-tests-in-angular,"['angular', 'testing']",2244,TRUE,4,1
How do I properly use TransactionScope with Nunit,"<p>I am attempting to do some integration testing on my Data Access Layer object.</p>

<p>I am using C#, Nunit3 and MySQL 5.7.</p>

<p>Here is my code.</p>

<pre><code>    [TestCase(""payee"", 0)]
    [TestCase(""payee"", 53)]
    [TestCase(""payee_to_corp_to_permissions"", 0)]
    [TestCase(""payee_to_corp_to_permissions"", 53)]
    [Test]
    public void AllRecordsToMigrateTest(string tableName, decimal corpId)
    {
        using (TransactionScope transactionScope = new TransactionScope())
        {
            List&lt;Payee&gt; payees = new List&lt;Payee&gt;
            {
              new Payee { payee_id = 1, corp_id = 1 },
              new Payee { payee_id = 2, corp_id = 53 },
              new Payee { payee_id = 3, corp_id = 22, payee_type_id = 3 },
              new Payee { payee_id = 4, corp_id = 1 },
            };

            using (MySqlConnection mySqlConnection = new MySqlConnection(DstConnectionString))
            {
                mySqlConnection.Open();
                foreach (var payee in payees)
                {
                    payee.Insert(mySqlConnection);
                }
                PayeeToCorpToPermission payeeToCorpToPermission = new PayeeToCorpToPermission { payee_id = 4, corp_id = 53 };
                payeeToCorpToPermission.Insert(mySqlConnection);
            }

            DataTable result = dbConnect.AllRecordsToMigrate(adilasMySQLTable, 53);

            Assert.AreEqual(3, result.Rows.Count);
        }
    }
</code></pre>

<p>The if I run the cases separately they all execute properly, but when I run them together I get a primary key conflict on payee_id for all test cases after the first.</p>

<p>dbConnect opens it's own connection to the same server as the setup code but does not modify anything just queries.</p>
",https://stackoverflow.com/questions/52614046/how-do-i-properly-use-transactionscope-with-nunit,"['c#', 'mysql', 'transactionscope', 'nunit-3.0']",104,FALSE,1,0
SonarQube. Custom rule needs to access to file,"<p>I implemented rule where I needed to extract data from external file. I put this file in resources folder and extract it with the following construction:</p>

<p><code>CustomRuleCheck.class.getResource(/com/packagename/file.json)</code></p>

<p>During JUnit testing is everething ok, but when I run an integration testing I cannot get this file.</p>

<p><code>ava.io.FileNotFoundException: file:/home/username/.sonar/cache/587ed81cbc083da501c4bfdcefd65f35/sonar-plugin-0.0.10-SNAPSHOT.jar_unzip/META-INF/lib/custom-checks-0.0.10-SNAPSHOT.jar!/com/packagename/file.json (No such file or directory)</code></p>

<p>I followed to pointed url and it turned out that folder <code>/home/username/.sonar/cache/587ed81cbc083da501c4bfdcefd65f35/sonar-plugin-0.0.10-SNAPSHOT.jar_unzip/META-INF/lib/</code> contains <code>custom-checks-0.0.10-SNAPSHOT.jar</code> and this jar has necessary file inside. 
And I don't have any idea how to extract this. Could you help me please?</p>
",https://stackoverflow.com/questions/48538130/sonarqube-custom-rule-needs-to-access-to-file,"['java', 'sonarqube']",1056,TRUE,1,1
Test driven development for react js,"<p>Just started learning the React js.Some of testing libraries such as chai,Sinon,Enzyme and mocha is used for unit testing. Is there any testing library is available for test driven development practices in react js. One more question how to test the page navigation in react js since the state and props will be updated once the page is submitted. Note:Through react router it would navigate to other page. how to write the test cases for integration testing.</p>
",https://stackoverflow.com/questions/50908923/test-driven-development-for-react-js,"['reactjs', 'tdd', 'integration-testing']",144,FALSE,0,1
WireMock Request was not matched,"<p>I am creating integration testing using spring cloud contract. Everything's working fine from configuration until adding stubs jar to the project. Hence I found that the request not match despite having all params and headers same.</p>

<pre><code>{
  ""url"" : ""/my-project/api/checkTransaction/id?id=ASDFGHJKL"",
  ""absoluteUrl"" : ""http://127.0.0.1:8085/my-project/api/checkTransaction/id?id=ASDFGHJKL"",
  ""method"" : ""GET"",
  ""clientIp"" : ""127.0.0.1"",
  ""headers"" : {
    ""Accept"" : ""application/json"",
    ""X-B3-ParentSpanId"" : ""6f922af45db72e2e"",
    ""User-Agent"" : ""Java/1.8.0_111"",
    ""Connection"" : ""keep-alive"",
    ""Host"" : ""127.0.0.1:8085"",
    ""X-Span-Name"" : ""http://my-project/api/checkTransaction/id"",
    ""X-B3-SpanId"" : ""886d8cfcdeec47ca"",
    ""X-B3-Sampled"" : ""0"",
    ""X-B3-TraceId"" : ""6f922af45db72e2e"",
    ""requestKey"" : ""RANDOM"",
    ""defaultId"" : ""12345"",
    ""baggage-requestKey"" : ""RANDOM"",
    ""baggage-defaultId"" : ""12345"",
    ""Content-Type"" : ""application/json"",
    ""username"" : ""589e329c-1cf1-4eb5-b7bb-eaffdd266560""
  },
  ""cookies"" : { },
  ""browserProxyRequest"" : false,
  ""loggedDate"" : 1526541502499,
  ""bodyAsBase64"" : """",
  ""body"" : """",
  ""loggedDateString"" : ""2018-05-17T07:18:22Z"",
  ""queryParams"" : {
    ""id"" : {
      ""key"" : ""id"",
      ""values"" : [ ""ASDFGHJKL"" ]
    }
  }
}
Closest match:
{
  ""urlPath"" : ""/api/checkTransaction/id"",
  ""method"" : ""GET"",
  ""headers"" : {
    ""defaultId"" : {
      ""equalTo"" : ""12345""
    },
    ""username"" : {
      ""matches"" : ""[\\p{L}]*""
    },
    ""requestKey"" : {
      ""equalTo"" : ""RANDOM""
    },
    ""Content-Type"" : {
      ""matches"" : ""application/json.*""
    },
    ""Accept"" : {
      ""matches"" : ""application/json.*""
    }
  },
  ""queryParameters"" : {
    ""id"" : {
      ""equalTo"" : ""ASDFGHJKL""
    }
  }
} 
</code></pre>

<p>Here's the Test for API</p>

<pre><code>@Test
public void checkId_Contract() throws Exception {
    // given:
        MockMvcRequestSpecification request = given()
                .header(""requestKey"", ""RANDOM"")
                .header(""accept-language"", ""en"")
                .header(""accept-encoding"", ""gzip"")
                .header(""Content-Type"", ""application/json;charset=UTF-8"");

    // when:
        ResponseOptions response = given().spec(request)
                .queryParam(""id"",""ASDFGHJKL"")
                .when().async()
                .timeout(10000)
                .get(""/api/id/ASDFGHJKL/check"");

    // then:
        assertThat(response.statusCode()).isEqualTo(200);
        assertThat(response.header(""Content-Type"")).matches(""application/json;charset=UTF-8.*"");
    // and:
        DocumentContext parsedJson = JsonPath.parse(response.getBody().asString());
        assertThatJson(parsedJson).field(""['errors']"").isNull();
        assertThatJson(parsedJson).field(""['message']"").isEqualTo(""Id not found"");
        assertThatJson(parsedJson).field(""['value']"").isNull();
        assertThatJson(parsedJson).field(""['code']"").isEqualTo(""ID_NOT_FOUND"");
}
</code></pre>

<p>Here's the contract that being called by the API  </p>

<pre><code>Contract.make {
        request {
            method 'GET'
            url('/api/checkTransaction/id') {
                headers {
                    header 'defaultId' : '12345'
                    header 'username' : $(anyAlphaUnicode())
                    header 'requestKey' : 'RANDOM'
                    contentType('application/json')
                    accept('application/json')
                }
                queryParameters {
                    parameter 'id' : 'ASDFGHJKL'
                }
            }
        }
        response {
            status 200
            async()
            fixedDelayMilliseconds(5000)
            headers{
                contentType('application/json')

            }
            body '''\
            {
              ""code"": ""ID_NOT_FOUND"",
              ""message"": ""ID not found"",
              ""errors"": null,
              ""value"": null,
              ""success"": false
            }
            '''
        }
  }
</code></pre>

<p>even when I delete the username from contract request, still getting the same error.</p>

<p>Do I need to create headers for X-B3-ParentSpanId, etc to make it match?</p>
",https://stackoverflow.com/questions/50386084/wiremock-request-was-not-matched,"['java', 'spring', 'spring-cloud', 'wiremock', 'spring-cloud-contract']",9198,TRUE,0,1
How to mock S3 in order to test Java code in Junit,"<p>I have taken reference form <a href=""https://github.com/findify/s3mock"" rel=""nofollow noreferrer"">here</a> in order to implement S3 mocking for integration testing</p>
<p>My confusion and the part that i did not get is that how can i use docker here ?
Do i have to install something ?</p>
<p>I have just added below code in my maven</p>
<pre><code>&lt;dependency&gt;
            &lt;groupId&gt;com.amazonaws&lt;/groupId&gt;
            &lt;artifactId&gt;aws-java-sdk-datapipeline&lt;/artifactId&gt;
            &lt;version&gt;1.11.295&lt;/version&gt;
        &lt;/dependency&gt;
</code></pre>
<p>And have written below class</p>
<pre><code>package com.amazonaws.lambda.demo;

import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.AnonymousAWSCredentials;
import com.amazonaws.client.builder.AwsClientBuilder;
import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Builder;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import io.findify.s3mock.S3Mock;

public class S3Mock {
     
    S3Mock api = new S3Mock.Builder().withPort(8001).withInMemoryBackend().build();
    api.start();

    AmazonS3Client client = new AmazonS3Client(new AnonymousAWSCredentials());
    // use local API mock, not the AWS one
    client.setEndpoint(&quot;http://127.0.0.1:8001&quot;);
    client.createBucket(&quot;testbucket&quot;);
    client.putObject(&quot;testbucket&quot;, &quot;file/name&quot;, &quot;contents&quot;);
}
</code></pre>
<p>But i am not able to compile my class itself .
Can some body help me understand what else i have to do in order to make this work .</p>
",https://stackoverflow.com/questions/50753358/how-to-mock-s3-in-order-to-test-java-code-in-junit,"['java', 'amazon-s3', 'junit', 'integration-testing']",8912,TRUE,2,1
How do I use Laravel&#39;s service container in a package (outside of an app)?,"<p>I'm developing a package, which can be consumed by Laravel applications. The package has a ServiceProvider, which consumers use when they want to instantiate stuff from the package.</p>

<p>Now, I would like to use this ServiceProvider in the package's own tests to resolve dependencies. Integration testing if you will.</p>

<p>How can I do that?</p>

<p>It looks like <code>resolve()</code> depends on <code>app()</code>, so am I correct in assuming that the Laravel service container is not standalone and can only be used inside of an application?</p>
",https://stackoverflow.com/questions/52403556/how-do-i-use-laravels-service-container-in-a-package-outside-of-an-app,"['laravel', 'laravel-5']",776,FALSE,2,1
No dependencies were set for resolution,"<p>I run tests using Arquillian integration testing framework.
""Arquillian does not use the entire classpath to isolate the test archive. Instead, it uses the ShrinkWrap class, that is a Java API for creating archives. When we create the archive to test, we specify what files to include in the classpath to use the test. During the deployment, ShrinkWrap isolates only the classes needed for the test"" (<a href=""http://www.baeldung.com/arquillian"" rel=""nofollow noreferrer"">Introduction to Testing with Arquillian</a>).  </p>

<p>There is my configurations:</p>

<pre><code>@Deployment
public static WebArchive createDeployment() {
    MavenResolverSystem resolver = Maven.resolver();
    File[] files = resolver.loadPomFromFile(""pom.xml"").importRuntimeAndTestDependencies().resolve().withTransitivity().asFile();

    WebArchive webArchive = ShrinkWrap.create(WebArchive.class, ""test.war"");
    webArchive.addAsLibraries(files)
            .addClasses(""There I add my classess"")
    .addAsManifestResource(""arquillian/arquillian.xml"");

    System.out.println(webArchive.toString(true));
    return webArchive;
}
</code></pre>

<p>And pom.xml:</p>

<pre><code>&lt;dependency&gt;
        &lt;groupId&gt;org.jboss.arquillian&lt;/groupId&gt;
        &lt;artifactId&gt;arquillian-bom&lt;/artifactId&gt;
        &lt;type&gt;pom&lt;/type&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.jboss.arquillian.container&lt;/groupId&gt;
        &lt;artifactId&gt;arquillian-tomcat-embedded-8&lt;/artifactId&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.jboss.arquillian.junit&lt;/groupId&gt;
        &lt;artifactId&gt;arquillian-junit-container&lt;/artifactId&gt;
        &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.jboss.arquillian.container&lt;/groupId&gt;
        &lt;artifactId&gt;arquillian-container-spi&lt;/artifactId&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.jboss.arquillian.container&lt;/groupId&gt;
        &lt;artifactId&gt;arquillian-container-test-spi&lt;/artifactId&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat-catalina&lt;/artifactId&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.glassfish.main.extras&lt;/groupId&gt;
        &lt;artifactId&gt;glassfish-embedded-all&lt;/artifactId&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.jboss.shrinkwrap.resolver&lt;/groupId&gt;
        &lt;artifactId&gt;shrinkwrap-resolver-impl-maven&lt;/artifactId&gt;
        &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
</code></pre>

<p>But I am getting errors with stacktrace:</p>

<pre><code>java.lang.RuntimeException: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.spec.WebArchive com.project.MyControllerTest.createDeployment()
Caused by: java.lang.IllegalArgumentException: No dependencies were set for resolution
INFO: Stopping service [arquillian-tomcat-embedded]
</code></pre>

<p>What I've missed?</p>
",https://stackoverflow.com/questions/49072556/no-dependencies-were-set-for-resolution,"['java', 'jboss-arquillian', 'shrinkwrap']",757,FALSE,4,0
WPF Application Automation Testing Framework support embedded Web pages,"<p>I am currently looking for automation open source framework &amp; tool either in C#, Java or any language to automate WPF application. </p>

<p>I have already explore TestStack White for WPF automation and its working perfect for me. BUT </p>

<p>My WPF application has 60% to 70% are embedded web pages (HTML) Dynamics CRM forms are loading. </p>

<p>TestStack White doesn't support embedded web pages. </p>

<p>Please guide me any open source framework or tool which can help me to automate my UI &amp; integration testing. </p>
",https://stackoverflow.com/questions/49202182/wpf-application-automation-testing-framework-support-embedded-web-pages,"['wpf', 'automation', 'automated-tests', 'ui-automation', 'teststack']",197,FALSE,0,0
How to find iOS back button programatically with FlutterDriver,"<p>I'm using <a href=""https://docs.flutter.io/flutter/flutter_driver/FlutterDriver-class.html"" rel=""noreferrer"">FlutterDriver</a> to perform integration testing for a <a href=""https://flutter.io/"" rel=""noreferrer"">Flutter</a> package. </p>

<p>When the platform is Android, an <a href=""https://docs.flutter.io/flutter/material/AppBar-class.html"" rel=""noreferrer"">AppBar</a> is used in the scaffold, and when the platform is iOS, a <a href=""https://docs.flutter.io/flutter/cupertino/CupertinoPageScaffold/navigationBar.html"" rel=""noreferrer"">CupertinoNavigationBar</a> is used.</p>

<p>When testing on Android I can find the back button with the following code</p>

<pre><code>await driver.tap(find.byTooltip('Back'));
</code></pre>

<p>However this fails on iOS. As the button is generated automatically I'm unable to add a tag programatically. Any suggestions for how to select it on iOS? Bonus points for cross-platform solutions.</p>

<p>Also, any suggestions for simulating an android-device back button tap (outside of the app)?</p>
",https://stackoverflow.com/questions/51257189/how-to-find-ios-back-button-programatically-with-flutterdriver,"['flutter', 'flutter-test']",1655,TRUE,5,5
Azure AD Bearer Token for integration tests?,"<p>We are about to start integration testing our REST API's, those are secured using ADAL.js / Bearer token / passport-azure-ad.</p>

<p>So now to the actual question, in an automated test, how would I go about to get a bearer token to pass to the API?</p>

<p>The test cannot open the browser and force a login using the login page so how would I go about getting the token via e.g. a Node.js script running the tests suite?</p>

<p>I cannot provide much more info because I do not know where to even start looking for this.</p>
",https://stackoverflow.com/questions/48812703/azure-ad-bearer-token-for-integration-tests,"['azure', 'integration-testing', 'azure-active-directory', 'adal']",855,FALSE,4,1
Spring Boot: Mocking SOAP Web Service,"<p>I was wondering what the best practise to mock SOAP web services in spring boot is in order to run integration tests. All I could find on the spring website was <a href=""https://spring.io/guides/gs/consuming-web-service/"" rel=""nofollow noreferrer"">https://spring.io/guides/gs/consuming-web-service/</a>. Do we have to create a schema/wsdl for something as simple as mocking a dependency?</p>

<p>To mock a REST service, all we have to do is add the @RestController annotation to our mock service for it to boot. I was looking for a solution as lightweight.</p>

<p>Note: I'm currently using REST Assured for integration testing.</p>

<p>Thanks!</p>
",https://stackoverflow.com/questions/48219631/spring-boot-mocking-soap-web-service,"['java', 'spring', 'spring-boot', 'soap', 'integration-testing']",15645,TRUE,4,3
How to generate Java REST client from Spring REST Docs like it is generated from swagger.json?,"<p>My team used swagger for documenting REST API.</p>

<p>As a QA engineer I was able to generate rest client from swagger.json that was published on remote server upon deploy and use the client for REST API integration testing.</p>

<p>Now we are about to switch from swagger to Spring REST Docs.</p>

<p><strong>QUESTION</strong>:
Is there a way to generate java rest client from Spring REST Docs like it was possible for swagger? </p>

<p>If yes - how to do that? </p>

<p>If no - are there any alternative ways to get/generate REST API client.</p>
",https://stackoverflow.com/questions/49983642/how-to-generate-java-rest-client-from-spring-rest-docs-like-it-is-generated-from,"['swagger', 'swagger-codegen', 'spring-restdocs']",405,TRUE,4,1
"Using Mountebank, is it possible for an imposter to perform some logic after returning a response to the client?","<p>My app has a workflow where it calls out to an external service and receives a response. Sometime after that, the external service will eventually call an endpoint in my app. For integration testing, is it possible to setup an imposter with Mountebank to mimic this behavior?</p>

<p>In my research, my best guess is to use an injection and then maybe setTimeout() to later perform the POST request I need to make. However, I'm not sure that this is what Mountebank was intended to do.</p>

<p>Thanks!</p>
",https://stackoverflow.com/questions/49989605/using-mountebank-is-it-possible-for-an-imposter-to-perform-some-logic-after-ret,"['javascript', 'node.js', 'rest', 'mountebank']",504,TRUE,1,1
MockMvc - Configuration error : org.springframework.beans.factory.UnsatisfiedDependencyException,"<p>I have gone through many solutions but I am unable to figure out what is the problem, also I am new to MockMvc so I might missing some basic thing, but don't know what.</p>
<p>Problem:
I have existing application on which I am trying to do Integration testing using MockMvc JUnit, I have following structure:</p>
<pre><code>@RestController
public class MyController{
    @Autowired
    private MyService myService;

//requestMappingMethods..

}

public interface MyService{
    public List&lt;LocationMstrModel&gt; getData();
}

@Service
public class MyServiceImpl implements MyService{
    @Autowired
    LocationMstrDAO locationMstrDAO;
//calling DAO methods and ding business operations..
}

public interface MyDAO{
public List&lt;LocationMstrModel&gt; getData();
}

@Repository
public class MyDAO{
@Override
public List&lt;LocationMstrModel&gt; getData(){
}
}
</code></pre>
<p>below is Test class I have wrote to test above flow.</p>
<pre><code>//Required imports..
RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
        &quot;classpath*:testContext.xml&quot;,
    &quot;classpath*:dispatcher-servlet.xml&quot;
        
})
@WebAppConfiguration
@EnableWebMvc
public class LocationServiceImplTest {
     
    private MockMvc mockMvc;
    
    
    @Autowired
    MyService myService;
    
    
    @Autowired
    WebApplicationContext wContext;
        
        
    @Before
    public void before() {
        
        this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wContext).build();
    }
    
    @Test
    public void test() {
        /*fail(&quot;Not yet implemented&quot;);*/
    }

    @Test
    public void checkinsanceOfMyService() throws Exception{
        MockHttpServletRequestBuilder request = MockMvcRequestBuilders.get(&quot;/public/location&quot;);
        ResultActions result = mockMvc.perform(request);
        result.andDo(print())
        .andExpect(status().isOk());
         
    }
}
</code></pre>
<p>testContext.xml</p>
<pre><code>&lt;bean id=&quot;myService&quot; class=&quot;org.mockito.Mockito&quot; factory-method=&quot;mock&quot;&gt;
    &lt;constructor-arg value=&quot;com.service.MyService&quot;/&gt;
&lt;/bean&gt;
</code></pre>
<p>Any help is much appriciated..</p>
<p>EDIT:
<br/> Error is as mentioned in tile,
Full staack trace is here,</p>
<pre><code>org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.test.LocationServiceImplTest': Unsatisfied dependency expressed through field 'locationService';
 nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean found for dependency [com.fpl.techCafe.service.LocationService]:
 expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:569)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:349)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1219)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:385)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean found for dependency [com.fpl.techCafe.service.LocationService]: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1463)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1094)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1056)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:566)
    ... 28 more
</code></pre>
",https://stackoverflow.com/questions/48578621/mockmvc-configuration-error-org-springframework-beans-factory-unsatisfieddep,"['spring', 'junit', 'mockmvc']",944,FALSE,0,0
Track and log/debug yarn apllication which have been started from a scala binary using spark-submit,"<p>I am trying to design an integration testing framework.
I will be running some jars, which are written in Scala and run Spark processes with <code>spark-submit --master yarn</code> command. 
Is there any way that while running this jar I can submit some id or some name which will help me find which yarn process was called by which jar so that it becomes easier to debug?</p>

<p>Edit: I can't edit the code in scala, the only thing I can do it run the jars in my environment.</p>
",https://stackoverflow.com/questions/52810136/track-and-log-debug-yarn-apllication-which-have-been-started-from-a-scala-binary,"['scala', 'apache-spark', 'debugging', 'hadoop', 'hadoop-yarn']",84,TRUE,0,2
How to add properties via Spring TestExecutionListener,"<p>I created a <code>TestExecutionListener</code> to run a docker container for integration testing. I would like to be able to inject properties (eg container port) that can be used by <code>@ConfigurationProperties</code> annotated beans.</p>

<p>I thought I might be able to call <code>TestPropertySourceUtils.addInlinedPropertiesToEnvironment(...)</code> but when I try to get an application context object the context ends up fully loading before I can even attempt to inject any properties.</p>

<p>Is there any way to do this from a <code>TestExecutionListener</code>?</p>

<p>My workaround is to set the properties via <code>System.setProperty(...)</code> but that obviously does not permit any concurrency.</p>

<p>I'm running Spring Boot 2.1.1.RELEASE.</p>
",https://stackoverflow.com/questions/53577749/how-to-add-properties-via-spring-testexecutionlistener,['spring-test'],191,FALSE,3,0
.exe Never Throws Errror,"<p>I am tackling what should be a VERY simple solution to a problem.  In short, I am calling WinSCP.com, to SFTP files as:</p>

<pre><code>WinSCP.com /nointeractiveinput /command ""open sftp://!Username!:!Password!@!Host! -hostkey=""*"""" ""put !FolderName! !EgressPath!"" ""exit"" &gt;&gt;MasterLog.txt

IF %ERRORLEVEL% NEQ 0 (
    echo ERROR: SFTP error on folder: !FolderName!&gt;&gt;MasterLog.txt
    exit
)
</code></pre>

<p>However, during integration testing, with or without passing the output to MasterLog.txt, this program literally NEVER throws an error, even dropping parameters, fake passwords. etc.</p>

<p>I feel like I am going crazy as almost all .exe when called from command line will fail occassionally and throw an error that is not ""0"", this ALWAYS returns ""0""...no matter what</p>

<p>What could be going wrong?</p>
",https://stackoverflow.com/questions/51028811/exe-never-throws-errror,"['command-line', 'errorlevel']",13,FALSE,0,0
Running integration test inside google cloud,"<p>We are trying to do integration testing for an <strong>Api</strong>. The endpoints use access-token for authentication, It is possible to add token in <strong>postman collection</strong> files and run the tests but this is not ideal as nobody wants to keep access token inside code and it has limited life or expiry. So the question, is it possible to create an <strong>environment</strong> for testing inside <strong>google project</strong> where the api is located, kind of using <strong>Google cloud secrets</strong> to be used as <strong>environment variable</strong> in <strong>postman/newman</strong>.</p>
",https://stackoverflow.com/questions/50722615/running-integration-test-inside-google-cloud,"['cloud', 'integration-testing', 'postman', 'access-token']",125,TRUE,-1,1
Executing extension before SpringExtension,"<p>I'm trying to implement integration testing in my app and have test class like that:</p>

<pre><code>@ExtendWith(value={MyDockerExtension.class})
@ExtendWith(value={SpringExtension.class})
@WebAppConfiguration
@ContextConfiguration(classes={...})
@TestInstance(TestInstance.LifeCycle.PER_CLASS)
public class TestClass{ ... }
</code></pre>

<p>Is there any way to make MyDockerExtension execute some code, before whole SpringExtension start working and generate whole Context with Configurationc classes?</p>

<p>I've heard that order in which we declare extensions is the key, but sadly MyDockerExtension that implements <code>BeforeAllCallback, AfterAllCallback</code> executes right before test method and after whole context is loaded. In that situation it's to late to start containers with docker, becuase since whole context is loaded my app already tried to connect to the container.</p>
",https://stackoverflow.com/questions/51554973/executing-extension-before-springextension,"['spring', 'docker', 'integration-testing', 'junit5', 'junit5-extension-model']",662,TRUE,3,1
Create in memory test with system.Web.Http.HttpServer,"<p>I would like to ask if it possible to wire up a full mvc/api (v5.2.3) site with the in memory HttpServer. </p>

<p>I am using owin and need to wire it up. </p>

<p>If it going to work I need to call static Startup() and Configuration(IAppBuilder app) in class Startup.cs in my integration test.</p>

<p>I read the article <a href=""https://www.strathweb.com/2012/06/asp-net-web-api-integration-testing-with-in-memory-hosting/"" rel=""nofollow noreferrer"">ASP.NET Web API integration testing with in-memory hosting</a> it gave me a deeper understanding of the HttpServer, - but as always close but no cigar.</p>

<p>Can it be done?</p>
",https://stackoverflow.com/questions/48062486/create-in-memory-test-with-system-web-http-httpserver,"['asp.net-mvc', 'integration-testing', 'httpserver']",1100,FALSE,0,0
Testing AngularJS app with C backend,"<p>I'm working on an AngularJS app and now, when it comes to testing - I'm completely confused. And newbie. The biggest problem, I guess, will be integration testing - from internet I've learned that recommanded attitude is to use some e2e tools like protractor, but I don't think that will be possible - the problem is that I can't use nodejs - app runs on server written in C. I'm guessing I'll have to treat it as black box.</p>

<p>Do you guys have any experience with such cases?</p>
",https://stackoverflow.com/questions/51947416/testing-angularjs-app-with-c-backend,"['javascript', 'angularjs', 'testing', 'integration-testing']",28,FALSE,0,0
TestServer PostAsJsonAsync returns 404,"<p>So i'm trying to do an integration test to test a fileupload. I'm using this documentation as reference : <a href=""https://learn.microsoft.com/en-us/aspnet/core/testing/integration-testing?view=aspnetcore-2.1"" rel=""nofollow noreferrer"">https://learn.microsoft.com/en-us/aspnet/core/testing/integration-testing?view=aspnetcore-2.1</a></p>

<p>I have this method :
<a href=""https://i.stack.imgur.com/7fjVs.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/7fjVs.png"" alt=""enter image description here""></a></p>

<p>the PostResponse1 and PostResponse2 gives me a 404 yet the getResponse givves me a 200 with valid data.</p>

<p>I'm trying to get an access token for further use.
Here is the method body for the Authenticate method :</p>

<pre><code> [Route(""api/[controller]/[action]"")]
public class TokenAuthController : TenantApiControllerBase
{
    [HttpPost]
    public async Task&lt;AuthenticateResultModel&gt; Authenticate([FromBody] AuthenticateModel pModel)
    {
        AbpLoginResult&lt;Tenant, User&gt; loginResult = await GetLoginResultAsync(
            pModel.UserNameOrEmailAddress,
            pModel.Password,
            GetTenancyNameOrNull()
        );

        string accessToken = CreateAccessToken(CreateJwtClaims(loginResult.Identity));

        return new AuthenticateResultModel
        {
            AccessToken = accessToken,
            EncryptedAccessToken = GetEncrpyedAccessToken(accessToken),
            ExpireInSeconds = (int)this._configuration.Expiration.TotalSeconds,
            UserId = loginResult.User.Id
        };
    }
</code></pre>

<p>why is it that the getAsync gives me a 200 yet the PostAsJsonAsync gives me a 404 ? </p>
",https://stackoverflow.com/questions/50273887/testserver-postasjsonasync-returns-404,"['asp.net', 'api', 'testing', 'asp.net-core', 'integration-testing']",300,FALSE,2,0
H2: JdbcSQLException: URL format error,"<p>I replaced a configuration which makes a connection to real database with another configuration that should make a connection to in-memory database. I want to use this configuration for integration testing. A simple test looks like this</p>

<pre class=""lang-java prettyprint-override""><code>import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class WebApplicationTests {
    @Test
    public void contextLoads() {}
}
</code></pre>

<p>New configuration in pom.xml</p>

<pre class=""lang-xml prettyprint-override""><code>&lt;profiles&gt;
    &lt;profile&gt;
        &lt;id&gt;IntegrationTest&lt;/id&gt;
        &lt;properties&gt;
            &lt;datasource.url&gt;jdbc:h2:mem:db_name_test;MODE=MSSQLServer;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS db_name_test\\;SET SCHEMA db_name_test&lt;/datasource.url&gt;
            &lt;datasource.username&gt;sa&lt;/datasource.username&gt;
            &lt;datasource.password&gt;&lt;/datasource.password&gt;
        &lt;/properties&gt;
    &lt;/profile&gt;
    &lt;!-- other profiles omitted --&gt;
&lt;/profiles&gt;

&lt;dependencies&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;com.h2database&lt;/groupId&gt;
        &lt;artifactId&gt;h2&lt;/artifactId&gt;
        &lt;version&gt;1.4.195&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;!-- some dependencies omitted --&gt;
&lt;/dependencies&gt;
</code></pre>

<p>These properties are injected in resource files and later picked up by Spring during context initialization. Data Source configuration in XML context looks like:</p>

<pre class=""lang-xml prettyprint-override""><code>&lt;bean id=""dataSource"" class=""org.apache.commons.dbcp.BasicDataSource"" destroy-method=""close""&gt;
    &lt;property name=""url"" value=""${datasource.url}""/&gt;
    &lt;property name=""username"" value=""${datasource.username}""/&gt;
    &lt;property name=""password"" value=""${datasource.password}""/&gt;
&lt;/bean&gt;
</code></pre>

<p>I use this command to build the project and perform testing:</p>

<pre class=""lang-none prettyprint-override""><code>mvn -T 1C clean integration-test -P IntegrationTest
</code></pre>

<p>The test which worked with previous configuration now throws the below exception.</p>

<p>Stacktrace</p>

<pre class=""lang-java prettyprint-override""><code>2018-03-13 13:36:04.627 ERROR 9076 --- [           main] o.s.test.context.TestContextManager      : Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@cb6c1e9] to prepare test instance [com.WebApplicationTests@3d52aca]

java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) ~[spring-test-4.3.14.RELEASE.jar:4.3.14.RELEASE]
    ... some frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'aService': Unsatisfied dependency expressed through field 'ctSecurityUtils'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ctSecurityUtils': Unsatisfied dependency expressed through field 'arService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arService': Invocation of init method failed; nested exception is org.springframework.orm.jpa.JpaSystemException: Unable to acquire JDBC Connection; nested exception is org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
    ... some frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ctSecurityUtils': Unsatisfied dependency expressed through field 'arService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arService': Invocation of init method failed; nested exception is org.springframework.orm.jpa.JpaSystemException: Unable to acquire JDBC Connection; nested exception is org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
    ... some frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arService': Invocation of init method failed; nested exception is org.springframework.orm.jpa.JpaSystemException: Unable to acquire JDBC Connection; nested exception is org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:137) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
    ... some frames omitted
Caused by: org.springframework.orm.jpa.JpaSystemException: Unable to acquire JDBC Connection; nested exception is org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:333) ~[spring-orm-4.3.14.RELEASE.jar:4.3.14.RELEASE]
    ... some frames omitted
Caused by: org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
    ... some frames omitted
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (URL format error; must be ""jdbc:h2:{ {.|mem:}[name] | [file:]fileName | {tcp|ssl}:[//]server[:port][,server2[:port]]/name }[;key=value...]"" but is ""jdbc:h2:mem:db_name_test"" [90046-196])
    at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) ~[commons-dbcp-1.4.jar:1.4]
    ... some frames omitted
Caused by: org.h2.jdbc.JdbcSQLException: URL format error; must be ""jdbc:h2:{ {.|mem:}[name] | [file:]fileName | {tcp|ssl}:[//]server[:port][,server2[:port]]/name }[;key=value...]"" but is ""jdbc:h2:mem:db_name_test"" [90046-196]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) ~[h2-1.4.196.jar:1.4.196]
    ... some frames omitted
</code></pre>

<p>How to fix it?</p>
",https://stackoverflow.com/questions/49254492/h2-jdbcsqlexception-url-format-error,"['java', 'url', 'jdbc', 'h2']",3724,TRUE,2,1
How to get code coverage report when I run tests using java language which tests Go Project code?,"<p>I have a very special requirement in integration testing in go. In the past few days I have read through many blogs but I am unable to get the solution for this problem. Please share me if you have done anything below.</p>

<p>Infra details:</p>

<ul>
<li>Having Go project up and running</li>
<li>Having my automation framework written in JAVA </li>
</ul>

<p>My Exact requirement is:</p>

<ol>
<li>I have to instrument the Go code and make the go code running </li>
<li>Execute my java automation code</li>
<li>Stop the Go code / get the code coverage report from Go</li>
</ol>

<p>Thanks in advance!!</p>
",https://stackoverflow.com/questions/53319992/how-to-get-code-coverage-report-when-i-run-tests-using-java-language-which-tests,"['go', 'code-coverage', 'test-coverage']",4624,TRUE,2,2
Flutter mocking Firestore service for testing &amp; directory structure,"<p>I am using Firestore and Redux. As such, I have a <code>firestore_service.dart</code> file that is the sole interface to Firestore and this same file updates the Redux store. For testing purposes I have created <code>firestore_service_mock.dart</code> along with a mock data file in the project test folder. My question is related to directory structuring and importing for testing purposes. </p>

<p><code>main.dart</code> is the only file that imports <code>firestore_service.dart</code>. If I have <code>firestore_service_mock.dart</code> in the project test folder, then how do I import it into <code>main.dart</code> for integration testing? Not sure I am explaining myself clearly, so I hope this makes some sense.</p>
",https://stackoverflow.com/questions/48970515/flutter-mocking-firestore-service-for-testing-directory-structure,"['integration-testing', 'google-cloud-firestore', 'flutter']",545,TRUE,1,1
"Grails Controller integration test executes actions of the parent, RestfulController class","<p>I have a weird problem with integration testing restful controllers... In the following code snippet, when I make a post request from tests, the save method of the parent, <code>RestfulController</code> class is called instead of the save method of the child class, <code>MyController</code> and because they have different signatures, this ends up resulting in a <code>UNPROCESSIBLE_ENTITY</code> response.</p>

<pre><code>class MyController extends RestfulController&lt;MyDomain&gt; {
    static responseFormats = ['json', 'xml', 'hal']

    MyController() {
        super(MyDomain)
    }


    def save(MyCommand command) {
        ...
    }
}
</code></pre>

<p>When I run the following test, the <code>save()</code> action of my controller's parent class, <code>RestfulController</code> gets executed, thus leading to <code>UNPROCESSIBLE_ENTITY</code> response, since I am using a Command object which is different from my domain class.</p>

<pre><code>void ""Test the save action correctly persists an instance""() {
        when: ""The save action is executed with valid data""

        response = restBuilder.post(resourcePath) {
            accept('application/json')
            header('Authorization', ""Bearer ${accessToken}"")
            json validJson
        }

        then: ""The response is correct""

        response.status == CREATED.value()
        response.json.id
        Vote.count() == 1
    }
</code></pre>

<p>What can I do to fix this, please?</p>
",https://stackoverflow.com/questions/49966129/grails-controller-integration-test-executes-actions-of-the-parent-restfulcontro,"['grails', 'integration-testing', 'grails-rest-api']",62,FALSE,0,1
How to setup ember-intl service in Ember integration tests?,"<p>I have just begun adding <code>ember-intl</code> into an application for which I had working tests. My acceptance tests are still working, but my integration tests on components whose templates are using <code>ember-intl</code> for string translation are failing with: </p>

<p>""No locale defined.  Unable to resolve translation:...""</p>

<p>In the <a href=""https://github.com/ember-intl/ember-intl/blob/2.x/docs/integration-testing.md"" rel=""nofollow noreferrer"">ember-intl docs there is a section on Integration Testing</a>, which seems to be out of date:</p>

<pre><code>import hbs from 'htmlbars-inline-precompile';
import wait from 'ember-test-helpers/wait';
import { moduleForComponent, test } from 'ember-qunit';

let service;

moduleForComponent('x-product', 'XProductComponent', {
  integration: true,
  setup() {
    service = this.container.lookup('service:intl');
    service.setLocale('en-us');
  }
});

test('it renders', function(assert) {
  assert.expect(1);
  this.render(hbs`{{x-product price=price deadline=deadline}}`);
  this.set('price', 1000);
  this.set('deadline', new Date());
  let output = this.$().text();
  assert.ok(output);
});

test('it translates', function(assert) {
  assert.expect(1);

  /* waits for async behavior (loading translations on app boot) to settle */
  return wait().then(() =&gt; {
    assert.equal(service.t('some.key'), 'Hello world');
  });
});
</code></pre>

<p>I've looked in the Ember docs and I can see <a href=""https://guides.emberjs.com/release/testing/testing-components/#toc_stubbing-services"" rel=""nofollow noreferrer"">how to stub a service for testing</a>, but not how to just load the service in a test and then work with it.</p>
",https://stackoverflow.com/questions/50584078/how-to-setup-ember-intl-service-in-ember-integration-tests,"['ember.js', 'integration-testing']",1141,TRUE,0,1
Integration test is not running in development environment,"<p>I am new in ruby on rails and I want to write a simple test to check the login functionality of my system. I am following this official documentation <a href=""http://guides.rubyonrails.org/testing.html#integration-testing"" rel=""nofollow noreferrer"">http://guides.rubyonrails.org/testing.html#integration-testing</a></p>

<p>I run the command  rails test:integration but this is showing this error</p>

<pre><code>rails aborted!
ActiveRecord::EnvironmentMismatchError: You are attempting to modify a database that was last run in `development` environment.
You are running in `test` environment. If you are sure you want to continue, first set the environment using:

bin/rails db:environment:set RAILS_ENV=test
</code></pre>

<p>Why I should I switch to test environment to test my application? If i switch to test environment all the configurations will be different. Is this strange that we develop in development/production mode and then test in testing mode? </p>

<p>This is my testing db</p>

<pre><code>default: &amp;default
  adapter:  postgresql
  encoding: unicode
  host:     &lt;%= ENV.fetch(""DATABASE_HOST"") { ""localhost"" } %&gt;
  username: &lt;%= ENV.fetch(""DATABASE_USER"") {""vagrant""} %&gt;
  password: &lt;%= ENV.fetch(""DATABASE_PASS"") {""vagrant""} %&gt;
  pool:     &lt;%= ENV.fetch(""RAILS_MAX_THREADS"") { 5 } %&gt;

development:
  &lt;&lt;: *default
  database: fanshub_development
  socket:   &lt;%= ENV[""DATABASE_SOCKET""] %&gt;

test:
  &lt;&lt;: *default
  database: fanshub_test
  socket:   &lt;%= ENV[""DATABASE_SOCKET""] %&gt;

production:
  &lt;&lt;: *default
  database: fanshub_production
  &lt;% if ENV[""DATABASE_URL""] %&gt;
  host:     &lt;%= ENV.fetch(""DATABASE_URL"", ""localhost"") %&gt;
  &lt;% elsif ENV[""DATABASE_SOCKET""] %&gt;
  socket:   &lt;%= ENV[""DATABASE_SOCKET""] %&gt;
  &lt;% end %&gt;
</code></pre>
",https://stackoverflow.com/questions/49209671/integration-test-is-not-running-in-development-environment,"['ruby-on-rails', 'ruby', 'integration-testing']",890,TRUE,0,2
&quot;throwing&quot; token in function name changes function behaviour,"<p>I'm creating a Spring boot application using Kotlin. This is part of a class I use for integration testing a Spring repository:</p>

<pre><code>@ExtendWith(SpringExtension::class)
@SpringBootTest
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class ImageRepositoryTest {
    @Autowired
    lateinit var imageRepository: ImageRepository

    private val image: Image

    init {
        image = Image(1, ""image.jpg"", ""/image.jpg"", ""http://test/image.jpg"")
    }


    @Test
    fun `refuses to store duplicated images throwing a DataIntegrityViolationException` () {
        imageRepository.save(image)
        assertThrows&lt;DataIntegrityViolationException&gt; {imageRepository.save(image)}
    }
}
</code></pre>

<p>This is the definition of the Image class:</p>

<pre><code>import javax.persistence.*

@Entity
@Table(name = ""image"")
data class Image(@Id @GeneratedValue(strategy = GenerationType.AUTO) var id: Int,
                 @Column(unique = true, nullable = false) val name: String,
                 @Column (unique = true, nullable= false) val path: String,
                 @Column (unique = true, nullable= false) val url: String)
</code></pre>

<p>When executed, the test fails saying that no exception has been thrown (while it should). However, if the name of the function doesn't contain the token ""throwing"", (for instance, I renamed it <code>refuses to store duplicated images raising a DataIntegrityViolationException</code> the test is successful.
It seems like the presence of that token in the name of the function prevents it from throwing exceptions. Is this an intended behaviour?</p>
",https://stackoverflow.com/questions/51306716/throwing-token-in-function-name-changes-function-behaviour,"['spring', 'exception', 'kotlin']",38,FALSE,0,1
TypeError: Method Promise.prototype.then called on incompatible receiver Proxy,"<p>to perform integration testing I used <code>jasmine</code> and <code>puppeteer</code> and since I am passing an educational course ,according to that ,I decided to use a js Proxy to encapsulate testing functionality but when I do my test I will encounter with the following error</p>

<pre><code>TypeError: Method Promise.prototype.then called on incompatible receiver [object Object] 
</code></pre>

<p>here is my CustomPage class which is going to represent a chrome tab :
const puppeteer = require('puppeteer');</p>

<pre><code>class CustomPage{
    static async build(){
        const browser =await  puppeteer.launch({headless:false});
        const page = browser.newPage();

        var customPage = new CustomPage(page);
        console.log(""harchi run mishe"")
        return new Proxy(customPage,{
            get:function(target,property){
                return (customPage[property]||page[property]||browser[property])
            }
        })
        //return proxy;
    }

    constructor(page){
        this.page = page
    }
}


module.exports=CustomPage;
</code></pre>

<p>and here is my <code>header.spec.js</code> file which is my test file.</p>

<pre><code>const Page = require('./helpers/page');
var tab;

describe('header representation',()=&gt;{
    beforeEach(async(done)=&gt;{
        tab =await Page.build();****here is the problem********
        await tab.goto('localhost:3000');
    })

    it('should show header logo',async()=&gt;{
        const text = await tab.$eval('a.brand-logo',(el)=&gt;el.innerHTML);
        expect(text).toEqual('Blogster');
        //done()
    })
})
</code></pre>

<p>I have actually convicted that my problem is with the specified line .it seems that js can't treat proxy as a Promise however I couldn't find any solution to that.</p>
",https://stackoverflow.com/questions/53872760/typeerror-method-promise-prototype-then-called-on-incompatible-receiver-proxy,"['javascript', 'testing', 'jasmine', 'integration-testing', 'puppeteer']",2400,TRUE,5,1
Spring/JUnit - Run something before ANY tests,"<p>Does Spring or the JUnit runner have something that I can use to run code before running ANY tests?</p>

<p>The closest I've found is the <code>@Rule</code> and <code>@ClassRule</code>, which work on a class level.</p>

<p>I have a Docker <code>@ClassRule</code> which hosts an empty database for empty integration testing. With the <code>@ClassRule</code>, it restarts the container every time.</p>

<p>I'd prefer instead to just start it once when starting the tests (regardless if it's all tests or just a single one), runs the tests, then kill the container.</p>

<p>I've searched around, but I haven't found anything other than the class rule. Apologizes if I'm missing something obvious.</p>
",https://stackoverflow.com/questions/48154530/spring-junit-run-something-before-any-tests,"['java', 'spring', 'junit']",2555,TRUE,2,2
Is a mock MongoRepository saving objects?,"<p>I am using SpringBoot 1.5.9 and try to do Integration testing. Weirdly a MongoRepository.save() method updates the object when called on mock MongoRepository. </p>

<p>I have a Counter Class</p>

<pre><code>public class Counter {
     public String id;
     public int seq;

     public void increaseSeq() {
        this.seq += 1;
     }
}
</code></pre>

<p>And his repository</p>

<pre><code>public interface CounterRepository extends MongoRepository&lt;Counter, String&gt;{
    Counter findById(String id);
    List&lt;Counter&gt; findAll();
}
</code></pre>

<p>And his service</p>

<pre><code>@Service
public class CounterService {
    @Autowired private CounterRepository counterRepository;


    public Counter findCounter(String id) {
        return counterRepository.findById(id);
    }

    public int getSeqAndIncrease(String id) {
        Counter counter = findCounter(id);
        if (counter == null) {
            return -1;
         }

        counter.increaseSeq();

        counterRepository.save(counter);

        return counter.getSeq();
    }
}
</code></pre>

<p>Now, when I do system integration and try to mock the counterRepository, it happens something that I don't expect. The counterRepository.findById() returns a Counter object where the 'seq' field is increased. Why? Does the counterRepository.save() affect the result in any way (the counterRepository is mocked, hence I suppose that save() should not have any effect)?</p>

<pre><code>@RunWith(SpringRunner.class)
@SpringBootTest
public class FlowServiceTest {
    @MockBean private CounterRepository counterRepository;
    @Autowired private CounterService counterService;

    @Before
    public void setUp() {  
     Mockito.when(counterRepository.save(any(Counter.class))).then(arg -&gt; arg.getArgumentAt(0, Counter.class));
     Mockito.when(counterRepository.findById(""flow"")).thenReturn(new Counter(""flow"", 10));
    }

    @Test
    public void testSavingInDatabase() {
        System.out.println(counterRepository.findById(""flow""));

        counterService.getSeqAndIncreaseSafe(""flow"");
        System.out.println(counterRepository.findById(""flow""));

        counterService.getSeqAndIncreaseSafe(""flow"");
        System.out.println(counterRepository.findById(""flow""));
    }
}
</code></pre>

<p>It prints ""10 11 12"". Why doesn't it print '10 10 10'?</p>
",https://stackoverflow.com/questions/48901208/is-a-mock-mongorepository-saving-objects,"['spring', 'spring-mvc', 'spring-boot', 'spring-data', 'spring-boot-test']",2987,FALSE,0,2
Hibernate ManyToMany and Transactional annotation,"<p>I try to test my @Repository layer using jUnit and integration testing. In my entity classes I use @ManyToMany bidirectional annotation. My test class I have annotated with @Transactional. When I executing persist method on the parent side of relationship the User object and Role are inserted to databse but there is no relations in join table. When I move @Transactional annotation to @Repository class everything works ok. Maybe someone can exaplain me what is the reason why it is no working when @Transactional annotation is on test class?</p>

<p>User entity:</p>

<pre><code>@Table(name = ""users"")
@Entity
public class User extends BaseEntity  {

    ...

    @ManyToMany(fetch = FetchType.EAGER,cascade = CascadeType.ALL)
    @JoinTable(
        name = ""users_roles"", 
        joinColumns = { @JoinColumn(name = ""user_id"") }, 
        inverseJoinColumns = { @JoinColumn(name = ""role_id"") }
    )
    private Set&lt;Role&gt; roles;

    .. getters and setters 

    public void addRole(Role role) {
        this.getRoles().add(role);
        role.getUsers().add(this);
    }

    public Set&lt;Role&gt; getRoles() {
        if (this.roles == null) {
            this.roles = new HashSet&lt;&gt;();
        }
        return this.roles;
    }

    public void setRoles(Set&lt;Role&gt; roles) {
        this.roles = roles;
    }
}
</code></pre>

<p>Role entity</p>

<pre><code>@Table(name = ""roles"")
@Entity
public class Role extends BaseEntity {

    public enum UserRole {
        ADMIN, USER
    }

    @Enumerated(EnumType.STRING)
    @Column(name=""role"")
    private UserRole role;

    @ManyToMany(mappedBy = ""roles"", fetch = FetchType.EAGER,cascade = CascadeType.ALL)
    private Set&lt;User&gt; users;

    ... getters and setters
}
</code></pre>

<p>Test class:</p>

<pre><code>@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {MysqlPersistanceConfig.class})
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Transactional
public class UserRepositoryIT {

    @Autowired
    private UserRepository userRepository;

    @Test
    public void stage10_saveOneUserAndCheckIfWasSavedTest() {
        User user = new User();
        user.setName(""admin"");
        user.setPassword(""root"");

        Role role1 = new Role(UserRole.USER);
        Role role2 = new Role(UserRole.ADMIN);

        user.addRole(role1);
        user.addRole(role2);

        Assert.assertTrue(role1.getUsers().size() == 1);
        Assert.assertTrue(role2.getUsers().size() == 1);
        Assert.assertTrue(user.getRoles().size() == 2);

        userRepository.save(user);

        Assert.assertEquals(user, userRepository.find(1));
        Assert.assertEquals(user, userRepository.findByName(""admin""));
        Assert.assertEquals(2, userRepository.findByName(""admin"").getRoles().size());
    }
}
</code></pre>

<p>DAO layer:</p>

<pre><code>@Repository
//@Transactional
public class UserRepositoryImpl implements UserRepository {

    @PersistenceContext
    private EntityManager manager;

    @Override
    public void save(User user) {
        if(user.isNew()) {
            manager.persist(user);
        } else {
            manager.merge(user);
        }
    }

    @Override
    public User find(int id) {
        return manager.find(User.class, id);
    }

    @Override
    public User findByName(String name) {
        String queryString = ""SELECT u FROM User u WHERE u.name = :name"";
        Query query = manager.createQuery(queryString);

        query.setParameter(""name"", name);

        return (User) query.getSingleResult();
    }
}
</code></pre>
",https://stackoverflow.com/questions/49265496/hibernate-manytomany-and-transactional-annotation,"['java', 'spring', 'hibernate', 'many-to-many', 'transactional']",576,TRUE,0,1
Use Spring Data repositories to fill in test data,"<p>I'd like to ask whether it is alright to use apps repositories(Spring Data based) to fill in testing data. I know I can use sql file with data, but sometimes I need something more dynamical. I find writing sql or datasets definitions cumbersome(and hard to maintain in case of schema change). Is there anything wrong with using app repositories? There are all basic CRUD operations already there. Note we are talking especially about integration testing.</p>

<p>I feel it is kind of weird to use part of app to test itself. Maybe I can create another set of repositories to be used in test contexts.</p>
",https://stackoverflow.com/questions/52867491/use-spring-data-repositories-to-fill-in-test-data,"['java', 'spring-data-jpa', 'integration-testing', 'test-data']",424,TRUE,2,2
PHP Is there an equivalent to npm link for composer?,"<p>When I am developing a JavaScript module, I can use <a href=""https://docs.npmjs.com/cli/link"" rel=""noreferrer"">npm link</a> to install my local development version in local projects that use the module as a dependency. This is a great workflow.</p>

<p>It's not developing in place, which I think is a less good than TDD, but its a way easier way to do integration testing and manual QA, I think.</p>

<p>In Composer, I can, if possible, force a package to install using git, so then I can develop in place. Nice, but not great.</p>

<p>Short version of question: Can I tell composer to temporarily install a dependency from a git repo/ set of files in my local file system and control the link from the composer CLI?</p>
",https://stackoverflow.com/questions/50765513/php-is-there-an-equivalent-to-npm-link-for-composer,"['php', 'npm', 'composer-php', 'dependency-management', 'npm-link']",2438,TRUE,6,2
Can Cypress test if a control is Pristine?,"<p>I am working on an Angular 4 app and we're using Cypress for front-end/integration testing.
On one of our forms we have a cancel button which clears all inputs on a child form and resets the form.
I am wondering is there any way for Cypress to check if the form or a control is pristine, or do I need to check that the contents of the inputs are all cleared? (I know how to do the latter, but would rather be able to check using Pristine than needing to iterate through all controls).</p>

<p>Here is what I am currently doing:</p>

<pre><code>cy.get('[data-test=cancelButton]').click();
cy.get('[data-test=referenceField').should('be.empty');
cy.get('[data-test=referenceField').should('have.attr', 'placeholder', 'Numbered list number');
</code></pre>

<p>I would like to just do something like</p>

<pre><code>cy.get('[data-test=cancelButton]').click();
cy.get('[data-test=referenceField').should('be.pristine');
</code></pre>
",https://stackoverflow.com/questions/51521710/can-cypress-test-if-a-control-is-pristine,"['angular', 'typescript', 'cypress']",498,TRUE,1,1
Laravel / PHPUnit: Asserting sameness of two models,"<p>When integration testing (using a database) in Laravel. What is the best way to assert that two instances of the same Eloquent model are the same?</p>
<h3>AssertEquals <code>$model $model</code></h3>
<p>Simply using <code>-&gt;assertEquals($modelOne, $modelTwo);</code> wont work as even if they <strong>are</strong> the same PHPUnit checks class properties such as <code>wasRecentlyCreated</code>  and sometimes model <code>id</code>s can be a string or an integer.</p>
<h3>AssertEquals <code>$model-&gt;id $model-&gt;id</code></h3>
<p>The problem here is model one may be an instance of another model e.g:</p>
<p><code>AssertEquals(Person::find(1)-&gt;id, Animal::find(1)-&gt;id);</code> returns true.</p>
<h3>AssertEquals <code>$model-&gt;toArray() $model-&gt;toArray()</code></h3>
<p>The issue here is properties are not always cast as the same type, Im not 100% sure why but there are times a models properties will be an <code>int</code> and other times a number <code>string</code></p>
<p><code>AssertEquals($address-&gt;toArray(), $user-&gt;address-&gt;toArray())</code></p>
<pre><code>[ postcode =&gt; 2454 ]
[ postcode =&gt; &quot;2454&quot; ]
</code></pre>
<p><strong>How to assert in a simple, clean and repeatable manner two Eloquent models are the same database record?</strong></p>
",https://stackoverflow.com/questions/49416444/laravel-phpunit-asserting-sameness-of-two-models,"['php', 'laravel', 'testing', 'types', 'phpunit']",7405,TRUE,10,1
Spring boot cucumber TestExecutionListener before database initalization,"<p>I want to create integration test with docker before cucumber test start. Inspired by: <a href=""http://tech.asimio.net/2016/08/04/Integration-Testing-using-Spring-Boot-Postgres-and-Docker.html"" rel=""nofollow noreferrer"">http://tech.asimio.net/2016/08/04/Integration-Testing-using-Spring-Boot-Postgres-and-Docker.html</a></p>

<p>But in my case the TestExecutionListener is not started before database initialization. I use Flyway for database migrations and it seems it tries to initialize first. For this a database connection required, which is not available, due the TestExecutionListener not being executed.</p>

<p>These are my classes:</p>

<pre><code>@RunWith(Cucumber.class)
@CucumberOptions(
        plugin = {""json:target/integration-cucumber.json""},
        features = ""src/test/resources""
)
public class CucumberIntegration {
}
</code></pre>

<p>And my test class which I will be extended by the cucumber steps:</p>

<pre><code>@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
@SpringBootConfiguration
@ContextConfiguration
@TestPropertySource(locations=""classpath:application.properties"")
@TestExecutionListeners({
        DockerizedTestExecutionListener.class,
        DependencyInjectionTestExecutionListener.class,
        DirtiesContextTestExecutionListener.class,
        TransactionalTestExecutionListener.class
})
public class SpringIntegrationTest {
}
</code></pre>

<p>When I change <code>@SpringBootTest(classes = Application.class)</code> to <code>@SpringBootTest</code> I see <code>DockerizedTestExecutionListener</code> being executed. Only it fails because it misses configuration from <code>Application.class</code>.</p>

<p>Anyone idea how to this with or without TestExecutionListener?</p>
",https://stackoverflow.com/questions/48789428/spring-boot-cucumber-testexecutionlistener-before-database-initalization,"['java', 'spring', 'spring-boot', 'cucumber-jvm']",919,FALSE,0,1
TestHost and DependencyInjection on Services,"<p>So i'm trying to find out how to implement dependency injection on the project for testing. </p>

<p>Currently I'm using the <code>TestHost</code> but the problem is I don't really understand how <code>TestHost</code> should help me with DI on the service level because all examples I was looking at (<a href=""https://www.meziantou.net/2017/08/21/testing-an-asp-net-core-application-using-testserver"" rel=""nofollow noreferrer"">here</a>, <a href=""https://learn.microsoft.com/en-us/dotnet/standard/microservices-architecture/multi-container-microservice-net-applications/test-aspnet-core-services-web-apps"" rel=""nofollow noreferrer"">here</a>, <a href=""https://andrewlock.net/configuring-environment-specific-services-in-asp-net-core/"" rel=""nofollow noreferrer"">here</a> and <a href=""https://andrewlock.net/configuring-environment-specific-services-in-asp-net-core-part-2/"" rel=""nofollow noreferrer"">here</a>) didn't tell me something more clear than just some examples of code for Integration Testing on Controller level while I'm looking for services and possibility to inject all dependencies without any problems.</p>

<p>I've created the new Environment for Test project and I tried to implement DI via <code>TestHost</code> on the test method just like in examples:</p>

<pre><code>var someClass = new SomeClassService(IRepository, IRepository, IRepository);
var builder = new WebHostBuilder()
    .UseEnvironment(""Testing"")
    .UseStartup&lt;TestStartup&gt;();
</code></pre>
",https://stackoverflow.com/questions/53266145/testhost-and-dependencyinjection-on-services,"['c#', 'asp.net', 'testing', 'dependency-injection', 'integration']",67,FALSE,0,0
CakePHP3: Mock methods in integration tests?,"<p>I'm new to unit / integration testing and I want to do an integration test of my controller which looks simplified like this:</p>

<pre><code>// ItemsController.php
public function edit() {

    // some edited item
    $itemEntity

    // some keywords
    $keywordEntities = [keyword1, keyword2, ...]

    // save item entity
    if (!$this-&gt;Items-&gt;save($itemEntity)) {
        // do some error handling
    }

    // add/replace item's keywords 
    if (!$this-&gt;Items-&gt;Keywords-&gt;replaceLinks($itemEntity, $keywordEntities)) {
       // do some error handling
    }
}
</code></pre>

<p>I have the models <em>Items</em> and <em>Keywords</em> where Items belongsToMany Keywords. I want to test the error handling parts of the controller. So I have to mock the <strong>save()</strong> and <strong>replaceLinks()</strong> methods that they will return false.</p>

<p>My integration test looks like this:</p>

<pre><code>// ItemsControllerTest.php
public function testEdit() {

    // mock save method
    $model = $this-&gt;getMockForModel('Items', ['save']);
    $model-&gt;expects($this-&gt;any())-&gt;method('save')-&gt;will($this-&gt;returnValue(false));

    // call the edit method of the controller and do some assertions...

}
</code></pre>

<p>This is working fine for the save() method. But it is not working for the replaceLinks() method. Obviously because it is not part of the model.</p>

<p>I've also tried something like this:</p>

<pre><code>$method = $this-&gt;getMockBuilder(BelongsToMany::class)
    -&gt;setConstructorArgs([
        'Keywords', [
            'foreignKey' =&gt; 'item_id',
            'targetForeignKey' =&gt; 'keyword_id',
            'joinTable' =&gt; 'items_keywords'
        ]
    ])
    -&gt;setMethods(['replaceLinks'])
    -&gt;getMock();

$method-&gt;expects($this-&gt;any())-&gt;method('replaceLinks')-&gt;will($this-&gt;returnValue(false));
</code></pre>

<p>But this is also not working. Any hints for mocking the <strong>replaceLinks()</strong> method?</p>
",https://stackoverflow.com/questions/52607172/cakephp3-mock-methods-in-integration-tests,"['testing', 'cakephp', 'cakephp-3.0']",287,TRUE,0,1
Using dependency injection to replace JWT Bearer Options in ASP.NET Core,"<p>In the web API, I'm securing with Jwt Auth, I have the following <code>ConfigureServices</code> <code>Startup.cs</code>:</p>

<pre><code>public void ConfigureServices(IServiceCollection services)
{
    services.AddDbContext&lt;ApplicationDbContext&gt;(options =&gt; options.UseSqlServer(this.Configuration.GetConnectionString(""DefaultConnection"")));
    // Some additional application dependencies here with AddTransient()...
    services.AddMvc();
    services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
        .AddJwtBearer(options =&gt;
        {
           options.Authority = ""xxxxx"";
           options.RequireHttpsMetadata = false;
           options.Audience = ""xxxxx"";
           options.BackchannelHttpHandler = BackChannelHandler;
        });
}
</code></pre>

<p>Here, <code>BackChannelHandler</code> is a public property of the <code>Startup.cs</code>:</p>

<pre><code>public static HttpMessageHandler BackChannelHandler { get; set; }
</code></pre>

<p>The reason why I'm using this property is that when I'm doing integration testing using xUnit, I'm using in-memory <code>TestServer</code> from <code>Microsoft.AspNetCore.TestHost</code>. So, I need to register backchannel handler in <code>TestFixture</code> class like</p>

<pre><code>testIdentityServer = new TestServer(identityServerBuilder);
My.Project.Startup.BackChannelHandler = testIdentityServer.CreateHandler();
testApiServer = new TestServer(apiServerBuilder);
</code></pre>

<p>While this is working fine, I would like to override either the <code>services.AddAuthentication()</code> or <code>AddJwtBearer()</code> in the DI container, so I can inject the authentication middleware configuration for testing purposes instead of using a public static property just like how I would do with any other dependency. When I try to do this using:</p>

<pre><code>services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
    .AddJwtBearer(options =&gt;
    {
       options.Authority = ""xxxxx"";
       options.RequireHttpsMetadata = false;
       options.Audience = ""xxxxx"";
       options.BackchannelHttpHandler = testIdentityServer.CreateHandler();
    });
</code></pre>

<p>in <code>TestFixture.cs</code> I get the error: authentication scheme with ""Bearer token"" already exists.</p>

<p>How can I do this with correctly ASP.NET Core?</p>
",https://stackoverflow.com/questions/51586562/using-dependency-injection-to-replace-jwt-bearer-options-in-asp-net-core,"['c#', 'dependency-injection', 'integration-testing', 'asp.net-core-2.0', 'identityserver4']",4103,TRUE,8,1
Handshake failure with mockwebserver using self signed certificate,"<p>I am looking to write integration testing of OkHttpClient with a mockwebserver with ssl using an android app. I was able to use HeldCertificate and HandshakeCertificates to achieve this, but I am interested in using self signed certs. While trying with self signed cert, I am getting a handshake failure. Here are the details to reproduce this.</p>

<p>a. Created self signed certificate using this command</p>

<p><code>
openssl req -x509 -out localhost.crt -keyout localhost.key   -newkey rsa:2048 -nodes -sha256   -subj '/CN=localhost' -extensions EXT -config &lt;( \
   printf ""[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth"")
</code></p>

<p>b. Converted to der for android.
openssl x509 -in localhost.crt -outform der -out localhost.der.crt</p>

<p>c. Fetched the SSLSocketFactory using the code given here: <a href=""https://gist.github.com/erickok/7692592"" rel=""nofollow noreferrer"">https://gist.github.com/erickok/7692592</a> to pass it to mockWebserver.useHttps() and OkHttpClientBuilder..sslSocketFactory(). </p>

<p>Encountering handshake failure when trying to send and receive a very simple request. </p>

<p><code>
I/MockWebServer(16935): MockWebServer[38515] connection from null failed: javax.net.ssl.SSLHandshakeException: Handshake failed
I/System.out(16935): TEMP: 7. Exception thrown javax.net.ssl.SSLProtocolException: SSL handshake terminated: ssl=0xeef2cd80: Failure in SSL library, usually a protocol error
I/System.out(16935): error:100c5410:SSL routines:ssl3_read_bytes:SSLV3_ALERT_HANDSHAKE_FAILURE (external/boringssl/src/ssl/s3_pkt.c:972 0xee9c4b80:0x00000001)
I/System.out(16935): error:100c009f:SSL routines:ssl3_get_server_hello:HANDSHAKE_FAILURE_ON_CLIENT_HELLO (external/boringssl/src/ssl/s3_clnt.c:771 0xea1a6827:0x00000000) Handshake failed
W/System.err(16935): javax.net.ssl.SSLHandshakeException: Handshake failed
W/System.err(16935):    at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:441)
W/System.err(16935):    at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:337)
W/System.err(16935):    at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:297)
W/System.err(16935):    at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:178)
W/System.err(16935):    at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:272)
W/System.err(16935):    at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
W/System.err(16935):    at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
W/System.err(16935):    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
W/System.err(16935):    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
W/System.err(16935):    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
W/System.err(16935):    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
W/System.err(16935):    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
W/System.err(16935):    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
W/System.err(16935):    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
W/System.err(16935):    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
W/System.err(16935):    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
W/System.err(16935):    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
W/System.err(16935):    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
W/System.err(16935):    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
W/System.err(16935):    at okhttp3.RealCall.execute(RealCall.java:77)
W/System.err(16935):    at com.xyz.okhttp3_abc.sample.test.SampleUiTest.setup(SampleUiTest.java:180)
W/System.err(16935):    at java.lang.reflect.Method.invoke(Native Method)
W/System.err(16935):    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
W/System.err(16935):    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
W/System.err(16935):    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
W/System.err(16935):    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
W/System.err(16935):    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
W/System.err(16935):    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
W/System.err(16935):    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
W/System.err(16935):    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
W/System.err(16935):    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
W/System.err(16935):    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
W/System.err(16935):    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
W/System.err(16935):    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
W/System.err(16935):    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
W/System.err(16935):    at org.junit.runners.Suite.runChild(Suite.java:128)
W/System.err(16935):    at org.junit.runners.Suite.runChild(Suite.java:27)
W/System.err(16935):    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
W/System.err(16935):    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
W/System.err(16935):    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
W/System.err(16935):    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
W/System.err(16935):    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
W/System.err(16935):    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
W/System.err(16935):    at org.junit.runners.Suite.runChild(Suite.java:128)
W/System.err(16935):    at org.junit.runners.Suite.runChild(Suite.java:27)
W/System.err(16935):    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
W/System.err(16935):    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
W/System.err(16935):    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
W/System.err(16935):    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
W/System.err(16935):    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
W/System.err(16935):    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
W/System.err(16935):    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
W/System.err(16935):    at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
W/System.err(16935):    at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
W/System.err(16935):    at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:384)
W/System.err(16935):    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1959)
W/System.err(16935): Caused by: javax.net.ssl.SSLProtocolException: SSL handshake terminated: ssl=0xeef2cd80: Failure in SSL library, usually a protocol error
W/System.err(16935): error:100c5410:SSL routines:ssl3_read_bytes:SSLV3_ALERT_HANDSHAKE_FAILURE (external/boringssl/src/ssl/s3_pkt.c:972 0xee9c4b80:0x00000001)
W/System.err(16935): error:100c009f:SSL routines:ssl3_get_server_hello:HANDSHAKE_FAILURE_ON_CLIENT_HELLO (external/boringssl/src/ssl/s3_clnt.c:771 0xea1a6827:0x00000000)
W/System.err(16935):    at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
W/System.err(16935):    at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:353)
W/System.err(16935):    ... 55 more
I/TestRunner(16935): failed: simpleTest[0](com.xyz.okhttp3_abc.sample.test.SampleUiTest)
I/TestRunner(16935): failed: simpleTest[0](com.xyz.okhttp3_abc.sample.test.SampleUiTest)
I/TestRunner(16935): ----- begin exception -----
I/TestRunner(16935): javax.net.ssl.SSLHandshakeException: Handshake failed
I/TestRunner(16935):    at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:441)
I/TestRunner(16935):    at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:337)
I/TestRunner(16935):    at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:297)
I/TestRunner(16935):    at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:178)
I/TestRunner(16935):    at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:272)
I/TestRunner(16935):    at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
I/TestRunner(16935):    at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
I/TestRunner(16935):    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
I/TestRunner(16935):    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
I/TestRunner(16935):    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
I/TestRunner(16935):    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
I/TestRunner(16935):    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
I/TestRunner(16935):    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
I/TestRunner(16935):    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
I/TestRunner(16935):    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
I/TestRunner(16935):    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
I/TestRunner(16935):    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
I/TestRunner(16935):    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
I/TestRunner(16935):    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
I/TestRunner(16935):    at okhttp3.RealCall.execute(RealCall.java:77)
I/TestRunner(16935):    at com.xyz.okhttp3_abc.sample.test.SampleUiTest.setup(SampleUiTest.java:180)
I/TestRunner(16935):    at java.lang.reflect.Method.invoke(Native Method)
I/TestRunner(16935):    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
I/TestRunner(16935):    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
I/TestRunner(16935):    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
I/TestRunner(16935):    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
I/TestRunner(16935):    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
I/TestRunner(16935):    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
I/TestRunner(16935):    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
I/TestRunner(16935):    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
I/TestRunner(16935):    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
I/TestRunner(16935):    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
I/TestRunner(16935):    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
I/TestRunner(16935):    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
I/TestRunner(16935):    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
I/TestRunner(16935):    at org.junit.runners.Suite.runChild(Suite.java:128)
I/TestRunner(16935):    at org.junit.runners.Suite.runChild(Suite.java:27)
I/TestRunner(16935):    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
I/TestRunner(16935):    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
I/TestRunner(16935):    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
I/TestRunner(16935):    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
I/TestRunner(16935):    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
I/TestRunner(16935):    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
I/TestRunner(16935):    at org.junit.runners.Suite.runChild(Suite.java:128)
I/TestRunner(16935):    at org.junit.runners.Suite.runChild(Suite.java:27)
I/TestRunner(16935):    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
I/TestRunner(16935):    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
I/TestRunner(16935):    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
I/TestRunner(16935):    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
I/TestRunner(16935):    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
I/TestRunner(16935):    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
I/TestRunner(16935):    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
I/TestRunner(16935):    at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
I/TestRunner(16935):    at android.support.test.internal.runner.TestExecutor.execute(TestExecutor
I/TestRunner(16935): ----- end exception -----
I/TestRunner(16935): finished: simpleTest[0](com.xyz.okhttp3_abc.sample.test.SampleUiTest)
I/MonitoringInstr(16935): Activities that are still in CREATED to STOPPED: 0
</code></p>
",https://stackoverflow.com/questions/51885796/handshake-failure-with-mockwebserver-using-self-signed-certificate,"['android', 'ssl', 'self-signed', 'okhttp', 'mockwebserver']",1418,FALSE,3,0
I&#39;m falling in overtesting feature,"<p>I'm fresh in the world of unit testing / integration testing. And I have read that, to write good unit tests for methods and classes, you must put yourself in the context that you don't know much about the method implementation, and focus on the method interface and logic</p>

<blockquote>
  <p>for example methode <code>add</code> take 2 params and return the sum of its</p>
</blockquote>

<p>So here is a real life example of a method that I had to write tests for:</p>

<pre><code>  matchLeague(summoner: SummonerTeammate): boolean {

    // check that maximum difference between summoners tiers is one tier
    if(Math.abs(this.summoner_league_info.tier - summoner.summoner_league_info.tier) &gt; 1) {
      return false
    }

    return true;
  }
</code></pre>

<p>And here are the tests that I have written:</p>

<pre><code>describe('match league algorithme', () =&gt; {

    function matchingHelper(tier1, tier2, excp) {
      let sum1: SummonerTeammate = new SummonerTeammate({
        summoner_league_info: {
          tier: tier1,
        }
      })

      let sum2: SummonerTeammate = new SummonerTeammate({
        summoner_league_info: {
          tier: tier2,
        }
      });

      expect(sum1.matchLeague(sum2)).toBe(excp)
    }

    test('should return true if players are in same tier', () =&gt; {
      matchingHelper(1, 1, true)
    })

    test('should return true if player1 is 1 tier below player 2 tier', () =&gt; {
      matchingHelper(1, 2, true)
    })

    test('should return true if player1 is 1 tier above player 2 tier', () =&gt; {
      matchingHelper(2, 1, true)
    })

    test('should return false if player 1 is more than 1 tier above player 2', () =&gt; {
      matchingHelper(3, 1, false)
      matchingHelper(7, 1, false)
      matchingHelper(6, 1, false)
    })

    test('should return false if player 1 is more than 1 tier below player 2', () =&gt; {
      matchingHelper(4, 6, false)
      matchingHelper(2, 6, false)
      matchingHelper(1, 6, false)
    })
  })
</code></pre>

<p>So, what I want to know, is that if my test suite is good for this methode, or I'm testing too much or too little case.</p>
",https://stackoverflow.com/questions/50204072/im-falling-in-overtesting-feature,"['javascript', 'unit-testing', 'typescript']",45,FALSE,2,0
The TFS 2017 update3 Release definition fails when used VsTest - testAssemblies task?,"<p>I am using VsTest - testAssemblies task in my release definition to perform integration testing for our app tier code but the release definition fails at the beggining itself, if <strong>VsTest - testAssemblies task</strong> is used in it.</p>

<p>It gives this error in the summary of the Release definition - ""<strong>No agent found in pool POCGen-Dev which satisfies the specified demands: Agent.Name -equals CID21 vstest Agent.Version -gtVersion 2.103.0</strong> ""</p>

<p>The Release definition works fine if i remove the VsTest - testAssemblies task from it, but when i used\add it in Release definition it fails.</p>

<p>I tried googling but no help!! 
Can anyone please let me know what should i check or do in this case?
<a href=""https://i.stack.imgur.com/aibbV.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/aibbV.png"" alt=""enter image description here""></a></p>

<p>Screenshot of Capabilites of Release Agent</p>

<p><a href=""https://i.stack.imgur.com/oRSz7.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/oRSz7.png"" alt=""enter image description here""></a></p>
",https://stackoverflow.com/questions/52968758/the-tfs-2017-update3-release-definition-fails-when-used-vstest-testassemblies,"['azure-devops', 'azure-pipelines-release-pipeline', 'vstest']",117,TRUE,1,1
Spring Boot Integrating Testing: connection pool leaking,"<p>I have a spring boot application (1.5) that uses @Repos, @PersistenceContext and Connection Pooling (C3PO with mssql-jdb; 6.1.0.jre8) that connects to an Azure SQL Database. However, we are hitting connection errors when running our test suite. When doing netstat while running the integration tests, I'm seeing the ESTABLISHED connections expand without bound.  The number of connections hits ~250 connections and then I start seeing Connection Pool exceptions and everything eventually dies.</p>

<p>My question is what' s the proper way to handle this situation?  Is there a way to turn off connection pooling when doing integration testing or do I need to manually deactivate connection poolings at the end of a test? </p>
",https://stackoverflow.com/questions/49944446/spring-boot-integrating-testing-connection-pool-leaking,"['spring', 'integration-testing', 'c3p0']",285,FALSE,1,0
Rails: Cucumber and Application Controller Methods,"<p>I am doing integration testing using Cucumber. In my <code>ApplicationController</code>, I have a method called <code>current_user</code> that provides the current user object. I use this object to add items to a redis database:</p>

<pre><code>$redis.sadd(""cart#current_user.id}"", [1,5,2])
</code></pre>

<p>In my Cucumber steps I test this functionality:</p>

<pre><code>Then /^the redis database should have ""(.+)"" item ids/ do |count|
  expect($redis.smembers(""cart#{current_user.id}"").count).to eq count.to_i
end
</code></pre>

<p>However, it is my understanding that Cucumber does not have access to controller methods, even if they are under <code>ApplicationController</code>, and therefore I cannot user the <code>current_user</code> method the way I would in my controllers. </p>

<p>What I am doing now is since I am testing features, there is only one user in the database so the current_user.id will always be 1, but if I start adding more users this may not work nicely. </p>

<p>Is there a workaround for this? </p>
",https://stackoverflow.com/questions/49122703/rails-cucumber-and-application-controller-methods,"['ruby-on-rails', 'ruby', 'rspec', 'cucumber']",228,TRUE,1,2
Running a jar as docker image and using this jar in other java application,"<p>I have a jar that do some business functionality and developed as a standalone component. Now I want to use it as a Microservice hosted as docker image. I was able to create a docker image by following the tutorial as:
<a href=""https://dzone.com/articles/run-simple-jar-application-in-docker-container-1"" rel=""nofollow noreferrer"">https://dzone.com/articles/run-simple-jar-application-in-docker-container-1</a></p>

<p>Now I have two problems:</p>

<ol>
<li>How to call the methods of the classes in this Jar in other java applications</li>
<li>how to do the integration testing?</li>
</ol>

<p>I am asking this as I need to take a decision if I should convert this JAR to a REST based application or it can be used as a Microservice in its actual (jar) based packaging.</p>

<p>Thanks</p>
",https://stackoverflow.com/questions/51035215/running-a-jar-as-docker-image-and-using-this-jar-in-other-java-application,"['java', 'docker', 'jar', 'microservices']",171,FALSE,0,1
Integration tests when WebConfig is dependency,"<p>I've written a good number of unit tests for a new feature I'm implementing and now I'm getting around to writing integration tests, only, I'm now questioning the justification for them in this case.</p>

<p>The feature includes creating an MVC action filter attribute. My unit tests check the paths of logic within the attribute and also check that they're applied to the controller actions we expect.</p>

<p>The feature is driven by the WebConfig, which decides whether an organisation is enabled or not.</p>

<p>I could use the <code>ConfigurationManager</code> to set the value before each test is run, but this seems like a test smell to me, or is this common when integration testing when a config file is a dependency?</p>
",https://stackoverflow.com/questions/49945204/integration-tests-when-webconfig-is-dependency,"['.net', 'testing', 'automated-tests', 'integration-testing']",29,FALSE,0,0
Intercept capybara chrome headless visits,"<p>We use Capybara along with Chrome Headless for integration testing. I'd like to write a linter, that checks some metrics on the HTML structure everytime chrome navigates to another page. Then I'd raise an error when something is against our linter.</p>

<p>We have some tests without javascript, and monkey patching rack-test works so far:</p>

<pre><code>Capybara::RackTest::Browser.class_eval do
  alias_method :process_orig, :process
  def process *args
    response = process_orig *args
    # do some linting
    response
  end
end
</code></pre>

<p>But I haven't found a way inside Capybara and/or Chrome Headless where I could intercept a response, and check the body of the page.</p>

<p>Is it possible to trigger a hook, when a page changes? Or is there some kind of API Chrome provides where I could get the body of every request? Or would a proxy be a feasible solution?</p>
",https://stackoverflow.com/questions/51327361/intercept-capybara-chrome-headless-visits,"['ruby', 'rspec', 'capybara', 'google-chrome-headless', 'rack-test']",404,TRUE,0,2
Adding integration tests to Kotlin project using the Kotlin Gradle DSL,"<p>I would like to add an additional ""source set"" to a Kotlin project that will contain integration tests. I have seen a few posts that talk about doing it for either a vanilla Java project or for Kotlin but using Groovy rather than the Kotlin Gradle DSL.</p>

<p><strong>In summary, using the Kotlin Gradle DSL:</strong></p>

<ul>
<li><strong>how to add an additional ""source set"" that can contain Kotlin code, Java code &amp; resources for the purpose of separating integration tests from regular unit tests?</strong></li>
<li><strong>how to add an additional task and configuration to run the integration tests separately from unit tests?</strong></li>
</ul>

<p>I would expect the directory structure to look something like:</p>

<pre><code>src
   main
      java
      kotlin
      resources
   test
      java
      kotlin
      resources
   integration
      java
      kotlin
      resources
</code></pre>

<p>Related:</p>

<ul>
<li><p><a href=""https://ryanharrison.co.uk/2018/07/25/kotlin-add-integration-test-module.html"" rel=""noreferrer"">https://ryanharrison.co.uk/2018/07/25/kotlin-add-integration-test-module.html</a></p></li>
<li><p><a href=""https://www.petrikainulainen.net/programming/gradle/getting-started-with-gradle-integration-testing/"" rel=""noreferrer"">https://www.petrikainulainen.net/programming/gradle/getting-started-with-gradle-integration-testing/</a></p></li>
<li><p><a href=""https://stackoverflow.com/questions/11581419/how-do-i-add-a-new-sourceset-to-gradle"">How do I add a new sourceset to Gradle?</a></p></li>
</ul>

<p>Thanks</p>
",https://stackoverflow.com/questions/52074532/adding-integration-tests-to-kotlin-project-using-the-kotlin-gradle-dsl,"['java', 'gradle', 'kotlin', 'gradle-kotlin-dsl']",2844,TRUE,11,2
asp.net core Integration test for database,"<p>I am trying to setup integration testing of the database in an asp.netcore project. I am using code first approach to create the database.<br>
For the testing iam using the nudget packages XUnit, FluentAssertions and NUnitestApadter3.
When i run the test for the first-time the test passes.</p>

<pre><code>[Collection(""Integration test collection"")]
public class BookServiceTest : IntegrationTestBase
{
    [Fact]
    public void CanCreateUser()
    {
        using (var context = GivenBPDContext())
        {
            var Book = new BookService(context);

            Data.Database.Entities.Book book = Book.AddNewBook(""test"");
            context.SaveChanges();

            book.Id.Should().NotBe(0);
            book.Name.Should().Be(""test"");
        }
    }
}

public class IntegrationTestBase
{
    protected static BPDContext GivenBPDContext()
    {

        var context = new BPDContext(new DbContextOptionsBuilder().Options);

        return context;
    }
    // i tried dropping the database here and it do not work
}
</code></pre>

<p>A very basic logic test </p>

<pre><code>public class BookService
{
    private BPDContext _context;

    public BookService(BPDContext context)
    {
        _context = context;
    }

    public Book AddNewBook(string name)
    {
        var book = _context.Books
            .FirstOrDefault(x =&gt; x.Name == name);

        if (book == null)
        {
            book = _context.Books.Add(new Data.Database.Entities.Book
            {
                Name = name,
            }).Entity;
        }

        return book;
    }
}
</code></pre>

<p>The second time i run the test and change a value being tested it fails. I need a way of dropping the database after each test and then running the 
migrations to get the database up to the correct version.</p>

<p>Below is how i setup up the database.
startup.cs</p>

<pre><code>public void ConfigureServices(IServiceCollection services)
{
    services.AddMvc();
    services.AddTransient&lt;IBPDRepository, BPDRepository&gt;();
    services.AddDbContext&lt;BPDContext&gt;();
}

public class BPDContext:DbContext
{
    public DbSet&lt;Entities.Book&gt; Books { get; set; }
    public DbSet&lt;Entities.User&gt; User { get; set; }
    public DbSet&lt;Entities.Reviewer&gt; Reviewer { get; set; }

    public BPDContext(DbContextOptions options):base(options)
    {

    }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        //maybe put something in if its in testing mode
        optionsBuilder.UseSqlServer(""Server = (localdb)\\mssqllocaldb;Database = BookProjectDatabase;Trusted_Connection = True; "", options =&gt; options.MaxBatchSize(30));
        optionsBuilder.EnableSensitiveDataLogging();
    }

}
</code></pre>

<p>In summary I need to delete the database before each test run, then updated the database with the migrations and finally perform the units .</p>
",https://stackoverflow.com/questions/50255145/asp-net-core-integration-test-for-database,"['c#', 'database', 'integration-testing']",3039,TRUE,1,3
Moq and file/data saving in C#,"<p>Ok, I am working on some unit testing, and my understanding is (based on ""The Art of Unit Testing"" by Roy Osherove) that if you're hitting a DB or actually <em>saving</em> a file, you're integration testing, not unit testing.</p>

<p>Given that, I have the following (yes, I know this violates SRP, but it illustrates my point):</p>

<pre><code>public class PrimeChecker : IPrimeChecker
{
    public bool IsPrime(int num)
    {
        if (num &lt; 2)
        {
            return false;
        }

        if (num &gt; 2 &amp;&amp; num % 2 == 0)
        {
            return false;
        }

        if (num % 2 != 0)
        {
            for (int i = 3; (i * i) &lt;= num; i += 2)
            {
                if (num % i == 0)
                {
                    return false;
                }
            }
        }

        return true;
    }

    public bool Save()
    {
        return true;
    }
}
</code></pre>

<p>Note the the Save() method is simply a stub right now.</p>

<p>I'm trying to use Moq to simulate saving. So my test looks like this:</p>

<pre><code>[Test]
    public void Save_WhenCalled_ExecutesSave()
    {
        var mock = new Mock&lt;IPrimeChecker&gt;();

        mock.Setup(x =&gt; x.Save());

        IPrimeChecker checker = mock.Object;
        checker.Save();

        mock.Verify(x =&gt; x.Save(), Times.Once);
    }
</code></pre>

<p>So if I had a fully-functioning Save() method in my class, is this the correct way to mock functionality? Because as I previously stated, my understanding is that for unit tests, I'm not supposed to actually write a file/save to a DB.</p>

<p>If this isn't correct, what <em>should</em> I be doing?</p>
",https://stackoverflow.com/questions/48228016/moq-and-file-data-saving-in-c,"['c#', 'unit-testing', 'moq']",2868,TRUE,5,1
Evaluating boolean expression stored in string with Roslyn,"<p>Currently I'm doing some integration testing for an app and such cases are stored in a json file, <strong>the assert part of the unit test is also stored in that json</strong>, so I need to parse that string to boolean or something.</p>

<p>I've tried with Roslyn but I can't make it work, it is throwing this exception:</p>

<blockquote>
  <p>Microsoft.CodeAnalysis.Scripting.CompilationErrorException: (1,1): error CS0103: The name 'entry' does not exist in the current context</p>
</blockquote>

<p>The json file with the case looks like this:</p>

<pre><code>  ""entries"": [
    {
      ""name"": ""SayHello"",
      ""request"": {
        ""text"": ""Hello"",
        ""id"": ""61hacck8j6jg""
      },
      ""response"": {
        ""text"": ""Hello"",
        ""id"": ""47me557ikbf7""
      },
      ""assert"": ""Entry.Request.Text == Entry.Response.Text""
    }
  ]
</code></pre>

<p>Tried with something like this: </p>

<pre><code>object result = await CSharpScript.EvaluateAsync(""entry.Request.Text == entry.Response.Text"");
</code></pre>

<p>Tried with lowercase, uppercase, same style as the class created, still not working.</p>

<p>Solution source code for this is <a href=""https://github.com/emimontesdeoca/integration-test-directline-bot-framework"" rel=""nofollow noreferrer"">here</a>, maybe you can get more information there.</p>

<p><strong>Edit:</strong> the file where the code explained above is <a href=""https://github.com/emimontesdeoca/integration-test-directline-bot-framework/blob/master/src/IntegrationTestBotFramework/IntegrationTest.cs"" rel=""nofollow noreferrer"">here</a></p>
",https://stackoverflow.com/questions/49777845/evaluating-boolean-expression-stored-in-string-with-roslyn,"['c#', 'roslyn', 'roslyn-code-analysis']",568,TRUE,0,1
How to mock nested dependency for integration tests,"<p>I'd like to create an integration test for my server. Unfortunately, there are many error cases which I can't cover as it depends on the failure of some dependency deep in my project.</p>

<p>To explain the issue a little bit easier, consider this project:</p>

<p><strong>main:</strong></p>

<pre><code>const dep = require('./dep');

module.exports = () =&gt; {
    return dep();
}
</code></pre>

<p><strong>dependency:</strong></p>

<pre><code>const uuid = require('uuid/v4');

module.exports = () =&gt; {
    return uuid();
}
</code></pre>

<p><strong>test:</strong></p>

<pre><code>const t = require('tap');

const subject = require('./subject');

t.test('should return 12345', t =&gt; {
  // mock uuid/v4 module to return 12345

  const result = subject();

  t.equal(result, '12345');
  t.end();
});
</code></pre>

<p><strong>This is a 1-level deep dependency situation but consider <code>dependency</code> to be like 5-levels deeper.</strong></p>

<p>So I'm coming here with few questions:</p>

<ol>
<li>How can I achieve mocking something <strong>easily</strong> really deep in the project?</li>
<li>Maybe I should ignore integration test cases which I can't cover and just rely on unit tests?</li>
</ol>

<p><strong>Important note:</strong></p>

<p>I've tried numerous mocking libraries (<code>mock-require</code>, <code>proxyquire</code>, <code>rewire</code>, <code>testdouble</code>, <code>mockery</code>) already but none of them were created thinking of integration testing (they rather focus on unit tests).</p>

<p>Would love to hear your answers!</p>
",https://stackoverflow.com/questions/51988688/how-to-mock-nested-dependency-for-integration-tests,"['javascript', 'node.js', 'testing', 'mocking', 'integration-testing']",302,FALSE,4,0
Is there some kind of persistent local storage in aws sagemaker model training?,"<p>I did some experimentation with aws sagemaker, and the download time of large data sets from S3 is very problematic, especially when the model is still in development, and you want some kind of initial feedback relatively fast</p>

<p>Is there some kind of local storage or other way to speed things up?</p>

<p><strong>EDIT</strong>
I refer to the batch training service, that allows you to submit a job as a docker container.</p>

<p>While this service is intended for already validated jobs that typically run for a long time (which makes the download time less significant) there's still a need for quick feedback</p>

<ol>
<li><p>There's no other way to do the ""integration"" testing of your job with the sagemaker infrastructure (configuration files, data files, etc.)</p></li>
<li><p>When experimenting with different variations to the model, it's important to be able to get initial feedback relatively fast</p></li>
</ol>
",https://stackoverflow.com/questions/48319893/is-there-some-kind-of-persistent-local-storage-in-aws-sagemaker-model-training,['amazon-sagemaker'],6284,TRUE,6,2
Integrated Unit Testing is not running in ASP.NET core MVC/Web API,"<p>I am developing a web API using ASP.Net core. I am doing integrated testing to my project. I am following this link, <a href=""https://koukia.ca/integration-testing-in-asp-net-core-2-0-51d14ede3968"" rel=""nofollow noreferrer"">https://koukia.ca/integration-testing-in-asp-net-core-2-0-51d14ede3968</a>. This is my code.</p>
<p>I have the controller to be tested in the thegoodyard.api project.</p>
<pre><code>namespace thegoodyard.api.Controllers
{
   [Produces(&quot;application/json&quot;)]
   [Route(&quot;api/category&quot;)]
   public class CategoryController: Controller
   {
      [HttpGet(&quot;details/{id}&quot;)]
      public string GetCategory(int id = 0)
      {
         return &quot;This is the message: &quot; + id.ToString();
      }
   }
}
</code></pre>
<p>I added a new unit test project called thegoodyard.tests to the solution. I added a TestServerFixture class with the following definition</p>
<pre><code>namespace thegoodyard.tests
{
    public class TestServerFixture : IDisposable
    {
      private readonly TestServer _testServer;
      public HttpClient Client { get; }

      public TestServerFixture()
      {
         var builder = new WebHostBuilder()
                .UseContentRoot(GetContentRootPath())
                .UseEnvironment(&quot;Development&quot;)
                .UseStartup&lt;Startup&gt;();  // Uses Start up class from your API Host project to configure the test server

         _testServer = new TestServer(builder);
         Client = _testServer.CreateClient();
      }

      private string GetContentRootPath()
      {
         var testProjectPath = PlatformServices.Default.Application.ApplicationBasePath;
         var relativePathToHostProject = @&quot;..\..\..\..\..\..\thegoodyard.api&quot;;
         return Path.Combine(testProjectPath, relativePathToHostProject);
      }

      public void Dispose()
      {
         Client.Dispose();
         _testServer.Dispose();
      }
   }
}
</code></pre>
<p>Then again in the test project, I created a new class called, CategoryControllerTests with the following definition.</p>
<pre><code>namespace thegoodyard.tests
{
    public class CategoryControllerTests: IClassFixture&lt;TestServerFixture&gt;
   {
      private readonly TestServerFixture _fixture;

      public CategoryControllerTests(TestServerFixture fixture)
      {
         _fixture = fixture;
      }

      [Fact]
      public async Task GetCategoryDetai()
      {
         var response = await _fixture.Client.GetAsync(&quot;api/category/details/3&quot;);

         response.EnsureSuccessStatusCode();

         var responseString = await response.Content.ReadAsStringAsync();

         bool containMessage = false; //responseString.Contains(&quot;This is the message: 3&quot;); - I commented on purpose to make the test fails.
         Assert.True(containMessage);
      }
   }
}
</code></pre>
<p>Then I right on the test method and clicked run tests in the option to run the test. But none of the tests was run. This is the output.
<a href=""https://i.stack.imgur.com/JR150.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/JR150.png"" alt=""enter image description here"" /></a></p>
<p>What is missing in my code? How can I get my integrated test running?</p>
",https://stackoverflow.com/questions/52356948/integrated-unit-testing-is-not-running-in-asp-net-core-mvc-web-api,"['unit-testing', 'asp.net-core', '.net-core']",2324,TRUE,1,3
How to make Cucumber features run in an Android project as local unit tests?,"<p>I have an Android project written in Java that I'm working on in Android Studio.</p>

<p>I'd like to use Cucumber for integration testing of some internal components (note: I know this is not the BDD way, nonetheless useful to me). I want the tests to run as <a href=""https://developer.android.com/studio/test/command-line"" rel=""nofollow noreferrer"">local unit tests</a> (without Instrumentation) using <code>gradlew test</code> because the components under test do not interact with the Android SDK.</p>

<p><strong>My problem is that the Cucumber features are not recognized by Gradle and do not run when I run <code>gradlew test</code>.</strong></p>

<p>Here's how I set it up so far:</p>

<ol>
<li><p>Added these dependencies to my app's build.gradle:</p>

<pre><code>testImplementation 'io.cucumber:cucumber-java:3.0.2'
testImplementation 'io.cucumber:cucumber-junit:3.0.2'
testImplementation 'io.cucumber:cucumber-jvm:3.0.2'
</code></pre></li>
<li><p>Also there, I added the path to where I've put my Feature file:</p>

<pre><code>android {
    ...
    sourceSets {
        test {
            assets.srcDirs = ['src/test/java/integrationTest/assets']
        }
    }
}
</code></pre>

<p>This is based on this folder structure:</p>

<p><a href=""https://i.stack.imgur.com/5R3RM.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/5R3RM.png"" alt=""enter image description here""></a></p></li>
<li><p>Added a class for the steps (<code>Steps1.java</code>) as can be seen above.</p></li>
</ol>

<p>What am I missing here?</p>
",https://stackoverflow.com/questions/52348197/how-to-make-cucumber-features-run-in-an-android-project-as-local-unit-tests,"['java', 'android', 'android-studio', 'cucumber', 'cucumber-jvm']",2554,TRUE,1,2
"For Java testing, should I mock client or mock the server","<p>In the client-server architecture, what should be the best approach when one should mock the client and when one should mock the server. I understand that unit tests should only test given class, with every dependent object mocked, while integration tests should test a feature as a whole. When it comes to the API calls, I am puzzled should I mock the client that I use for api calls or should I use some server mocking framework and let the real client call the mock server.</p>

<p>I have a situation where I should (it is not mandatory) test if I hit the proper API url, with proper method and with certain values passed in query parameters or in request body. With client mocking, I can simply ""verify"" if given parameters (path, method, request body) are passed and consider test successful. If I am to mock the server, then I need to create a little bit of processing on mock server to check if path, method and request body are correctly passed and return a value. In this case, server response is the only thing that I can use to measure if test is successful (send 500 if required data is not received).</p>

<p>By your experience, what is the proper way to test calls in client-server architecture for integration testing? If we go by the book, then server mocking should be used, but is that practical in the above mentioned case? For unit testing it is clear that mocks should be used. </p>

<p><strong>Update:</strong> To avoid confusion: I am making a client that depends on the publicly available service which I cannot control. So, I am testing if the client is working properly and focus is on the client. Question is related should I (in integration-tests) mock the client object that is responsible for remote connections(In my case WSClient from Play framework), or should I use some server mock (like okhttp mock web server).</p>

<p><strong>Another update:</strong> Most people suggest that simple rule of the thumb should be followed: if these are the unit tests then mock the client and if these are the integration tests then use mock server. Now, I am curious about this situation: I have a class A that has dependency on class B and class B has a client object that is tasked with remote calls. If I was to write unit test for class A, I should mock the class B and that is fine. However, if I am doing integration testing for class A, is it acceptable to mock client object in class B and ""verify"" if proper parameters are passed to it (path, method and request body), or, for the sake of completeness, I should run the mock server even if mocking the client object is easier. In this case, I will not test for timeouts and low level network errors. Or the whole point of integration testing, in this case, should be to test network connectivity as well.</p>
",https://stackoverflow.com/questions/52678580/for-java-testing-should-i-mock-client-or-mock-the-server,"['java', 'unit-testing', 'mocking', 'integration-testing']",1861,TRUE,3,1
Msbuild ignoring build errors,"<h2>Context</h2>

<p>I have a task integration testing and code coverage which I execute in my jenkins pipeline.</p>

<p>The tools used is <strong>dotcover</strong> and <strong>Nunit</strong>.</p>

<p>Nunit is executed throught dotcover during the integration test build when the configuration is <em>Integration</em>.</p>

<h2>Problem</h2>

<p>When I execute the configuration <em>Integration</em> in <strong>visual studio</strong> with some tests in error, then the build failed, everything are ok, but when the same configuration are executed with <strong>msbuild</strong>, it doesn't return any error code then jenkins pipelin doesn't fail.</p>

<p>The situation put us in delicate way because we can't trust our build pipeline anymore.</p>

<p>I looking for a solution on web for some days and I still on the same point, it's why I asking for your help here.</p>

<p>Thank you for helping.</p>

<h2>Files</h2>

<h3>jenkinsfile</h3>

<pre><code>node('BUILD_PROJECT') {
    stage ('Checkout')
    {
        checkout scm
    }

    stage ('Build')
    {
        bat '""C:/Program Files (x86)/NuGet/nuget.exe"" restore -NonInteractive MySolution.sln'
        bat ""\""C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/15.0/Bin/MSBuild.exe\"" /p:Configuration=Release;AssemblyVersion=0.1.0.${env.BUILD_NUMBER} /maxcpucount:8 MySolution.sln""
    }

    stage ('Integration')
    {
        bat ""\""C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/15.0/Bin/MSBuild.exe\"" /p:Configuration=Integration /maxcpucount:8 MySolution.sln""
    }

    stage ('Publish Coverage')
    {
         publishHTML target: [
            allowMissing: false,
            alwaysLinkToLastBuild: false,
            keepAll: true,
            reportDir: 'Solution/IntegrationProject/bin/Integration/TestResult',
            reportFiles: 'ProjectCoverageReport.html',
            reportName: 'Project Coverage Report'
          ]
    }

    stage ('Setup')
    {
    bat ""\""C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/15.0/Bin/MSBuild.exe\"" /p:Configuration=Setup;Platform=x86;AssemblyVersion=0.1.0.${env.BUILD_NUMBER} /maxcpucount:8 MySolution.sln""
    }

    stage ('Archive')
    {
        archiveArtifacts artifacts: 'Solution/SetupProject/bin/x86/Setup/MySetup.exe'
    }
}
</code></pre>

<h3>In IntegrationProject.csproj</h3>

<pre><code>&lt;Target Name=""CoverageReport"" AfterTargets=""CopySqlFiles"" Condition=""$(Configuration) == Integration""&gt;
    &lt;Exec Command=""..\packages\JetBrains.dotCover.CommandLineTools.2018.1.3\tools\dotCover.exe analyse /TargetExecutable=..\packages\NUnit.ConsoleRunner.3.8.0\tools\nunit3-console.exe /ReturnTargetExitCode /TargetArguments=&amp;quot;$(TargetPath)&amp;quot; /Filters=-:nunit.framework;-:IntegrationProjectTest;-:type=MyNamespace.View.*;-:type=*Test /TargetWorkingDir=$(TargetDir) /Output=$(TargetDir)\TestResult\MyCoverageReport.html /ReportType=HTML"" /&gt;
&lt;/Target&gt;
</code></pre>
",https://stackoverflow.com/questions/53409914/msbuild-ignoring-build-errors,"['msbuild', 'nunit', 'jenkins-pipeline', 'msbuild-task', 'dotcover']",1518,TRUE,0,1
What groovy cmd can I use for workstation cygwin and bash outside Jenkins?,"<p>I've got a CD pipeline running on Jenkins with some decryption code that uses <code>base64</code> and <code>gpg2</code>. </p>

<p>I set up the pipeline so that the scripts grab and decrypt the correct passwords from git using the Jenkins shell command like this:</p>

<pre><code>def plainText = sh(script: """"""#!/bin/sh -e
        echo ""$encrypted"" | 
        base64 -d -w 0  | 
        gpg2 --batch --decrypt --passphrase $pw """""",
    returnStdout: true
    )
println(""$key=$plaintext"")
</code></pre>

<p>The pipeline works great and now I'm looking at writing a script for our dev workstations using <code>maven-groovy-plugin</code> to do the same decryption locally to allow devs to run servers on workstations. </p>

<p>My second requirement is that I can run my maven groovy plugin on Jenkins to set up the integration testing.</p>

<p>So I'm looking for a solution that I can use locally and on the build server. If necessary, I could make the script switch on the OS and execute something like this:</p>

<pre><code>def cmd = [ 'sh', '-c',
        """"""echo ""$encrypted"" | 
           base64 -d -w 0  | 
           gpg2 --batch --decrypt --passphrase $encryptionKey """"""]
cmd.execute().with {
    def output = new StringWriter()
    def error = new StringWriter()
    //wait for process ended and catch stderr and stdout.
    it.waitForProcessOutput(output, error)
    println ""error=$error""
    println ""output=$output""
    println ""code=${it.exitValue()}""
}
</code></pre>

<p>but I'm not sure how to tweak the <code>cmd</code> to execute with <code>cygwin</code>.</p>
",https://stackoverflow.com/questions/52970348/what-groovy-cmd-can-i-use-for-workstation-cygwin-and-bash-outside-jenkins,"['bash', 'jenkins', 'groovy', 'cygwin']",181,TRUE,0,1
"In Visual Studio native unit test, is it possible to couple unit test to a project?","<p>I have a solution, with three projects</p>

<pre><code>Solution
-Project 1
-Project 2
-Project 3
</code></pre>

<p>Recently wanted to implement a unit test (or integration test) to make sure everything still works, and I have experience with CppUTest, but wanted to see if anything VS has to offer might be ""better"" integrated for this purpose.</p>

<p>So I followed a guide and it led me to another project.</p>

<p>-Unit test project (aka project 4), which is only a class from the looks of it.</p>

<pre><code>Solution
-Project 1
-Project 2
-Project 3
-Project 4 (Unit test, testing Project 1)
</code></pre>

<p>So I'm wondering what's a good practice to maintain unit/integration testing environment?</p>

<p>It could be... </p>

<p>One unit test project, multiple unit tests classes, one for each project</p>

<pre><code>Solution
-Project 1
-Project 2
-Project 3
-Project 4 (Unit test, testing Project 1, 2 and 3)
</code></pre>

<p>A Unit test project per working project
One unit test project, multiple unit tests classes, one for each project</p>

<pre><code>Solution
-Project 1
-Project 2
-Project 3
-Project 4 (Unit test, testing Project 1)
-Project 5 (Unit test, testing Project 2)
-Project 6 (Unit test, testing Project 3)
</code></pre>

<p>Just apply unit test class to existing projects (not sure if it's possible)</p>

<pre><code>Solution
-Project 1
 -Code
 -Unit Test
-Project 2
 -Code
 -Unit Test
-Project 3
 -Code
 -Unit Test
</code></pre>

<p>Is the third option possible?</p>
",https://stackoverflow.com/questions/51000950/in-visual-studio-native-unit-test-is-it-possible-to-couple-unit-test-to-a-proje,"['c++', 'visual-studio', 'unit-testing', 'project']",142,TRUE,2,1
Angular 4: Is it possible to do Isolated Unit Tests with HttpClient?,"<p>I thought I'd follow the <a href=""https://angular.io/guide/testing#services"" rel=""nofollow noreferrer"">Angular guide for testing services</a>, but this is a new project without tests, and we just switched to using the newer HttpClient, and every example I've seen with that uses all the TestBed boilerplate, which I think is giving me issues in getting my tests running. </p>

<p>Is there any way to write isolated unit tests of services that use HttpClient?</p>

<p>The second part I'm wondering about is best practices. I'm still fairly new to unit/integration testing, and in the examples I've seen of HttpClient, they all use the HttpTestingController to return a mocked result. For my app, it's important that the API returns what the app expects, so shouldn't I test against the real service instead of pretending it comes back as expected? If not, then what's the value of writing tests for services?</p>
",https://stackoverflow.com/questions/48632335/angular-4-is-it-possible-to-do-isolated-unit-tests-with-httpclient,"['angular', 'unit-testing', 'angular-services']",543,TRUE,1,1
Moq - Call original Method implementation but change one of the input Parameters,"<p>I'm using Moq in some Integration testing (updating an existing test script and code that is not my own) and I'm testing a BuinessService that has an email Interface injected into it which sends emails. </p>

<pre><code>public interface IEmailService
{
    void CreateMailItem(string To, string Subject, string Body);
    string GetEmailAddress(string staffmember);
}
</code></pre>

<p>Originally I just Moq'd the <strong>IEmailService</strong> interface and that worked fine but because of the way the code is implemented I need to call the default interface implementation i.e.<strong>EmailService</strong> to test. I know I shouldn't.</p>

<p>I know I can moq the method like below, but what I want to do is have the code call the original implementation <strong>EmailService.CreateMailItem</strong>  and only change the single parameter so that emails are sent to a test account rather than the real live account.</p>

<pre><code>var emailMock = new Mock&lt;EmailService&gt;() { CallBase = true };
emailMock.Setup(x =&gt; x.CreateMailItem(""test@test.com"", It.IsAny&lt;string&gt;(), It.IsAny&lt;string&gt;()));
email = emailMock.Object;
</code></pre>

<p>Can I use Moq to call the original CreateMailItem method but change the 'To' parameter to my test email account and keep the other parameters as they were.?</p>
",https://stackoverflow.com/questions/51781643/moq-call-original-method-implementation-but-change-one-of-the-input-parameters,"['c#', 'moq']",4563,TRUE,1,2
How to write unit and/or integration tests for an angular app that uses PouchDB,"<p>I am working with a large AngularJS + PouchDB codebase. We are using Protractor for end-to-end testing, but we found ourselves relying too much on end-to-end tests. These are slow and often fail intermittently.</p>

<p>We would like to migrate as much of our testing to unit tests and/or integration tests. We have a working karma-jasmine setup that we use to test some code that doesn't interact with the database. We would like to use Karma to test code that does interact with the database but are not sure of the best way to do this.</p>

<p>Here is one example:</p>

<pre><code>""use strict"";

var FooService;

describe('The FooService', function () {
  beforeEach(function () {
    angular.mock.module('myApp');
  });

  beforeEach(angular.mock.inject(function (_FooService_) {
     FooService = _FooService_;
  }));

  it('should be able to return all bars', function() {
    let bars = FooService.getBars();
  });
});
</code></pre>

<p>This fails because the <code>FooService.getBars()</code> method calls PouchDB which has not been initialized.</p>

<p>Do you have a similar codebase and use unit and/or integration testing? If so, how did you address this problem?</p>
",https://stackoverflow.com/questions/49435227/how-to-write-unit-and-or-integration-tests-for-an-angular-app-that-uses-pouchdb,"['angularjs', 'unit-testing', 'integration-testing', 'karma-jasmine', 'pouchdb']",469,TRUE,1,1
How can I restore a bacpac file to SQL Server linux docker container?,"<p>I am trying to setup an integration testing environment for Docker. We need to restore a bacpac to our <code>mssql-server-linux:latest</code> image so we can run tests based on the dataset.</p>

<p>My compose file looks like:</p>

<pre><code>version: '3'

services:
    projectweb:
        image: projectweb
        build:
            context: .
            dockerfile: Project\Dockerfile
        depends_on:
            - db
    db:
        image: ""microsoft/mssql-server-linux""
        environment:
            SA_PASSWORD: ""MyVerySecurePassword""
            ACCEPT_EULA: ""Y""        
        volumes:
            - ./database:/tmp
</code></pre>

<p>I don't need the changes to the database to be persisted past the life of the container. I just need to script getting the data into it. I don't have a lot of experience with docker or SQL Server for Linux. I assume I need to wait for the container to be initilizsed and DB setup and started, then execute a script that reads the database bacpac from tmp folder. As far as I understand I should use sqlpackage but this doesn't <a href=""https://github.com/Microsoft/mssql-docker/issues/135"" rel=""nofollow noreferrer"">appear to be in the container</a>? Do I need another container with this SSDT/sqlpackage in it? Can I install splpackage into the container?</p>

<p>What is the best way to do import bacpac data? </p>
",https://stackoverflow.com/questions/48402525/how-can-i-restore-a-bacpac-file-to-sql-server-linux-docker-container,"['sql-server', 'linux', 'docker', 'docker-compose', 'sql-server-linux']",2715,TRUE,5,1
Automate RabbitMQ consumer testing,"<p>I have a .net micro-service receiving messages using RabbitMQ client, I need to test the following:</p>

<p>1- consumer is successfully connected to rabbitMq host.</p>

<p>2- consumer is listening to queue.</p>

<p>3- consumer is receiving messages successfully.</p>

<p>To achieve the above, I have created a sample application that sends messages and I am debugging consumer to be sure that it is receiving messages.</p>

<p>How can I automate this test? hence include it in my micro-service CI.</p>

<p>I am thinking to include my sample app in my CI so I can fire a message then run a consumer unit test that waits a specific time then passes if the message received, but this seems like a wrong practice to me because the test will not start until a few seconds the message is fired.</p>

<p>Another way I am thinking of is firing the sample application from the unit test itself, but if the sample app fails to work that would make it the service fault.</p>

<p>Is there any best practices for integration testing of micro-services connecting through RabbitMQ?</p>
",https://stackoverflow.com/questions/50176793/automate-rabbitmq-consumer-testing,"['rabbitmq', 'integration-testing', 'microservices']",26590,TRUE,17,2
Running Kestrel for testing without using the TestServer included in Microsoft.AspNetCore.TestHost,"<p>I'm using SoapCore for creating a WCF-ish kind of application using asp.net core 2.</p>

<p>This works fine for me so for but I've somewhat hit a brickwall when it comes to integration testing my endpoints. </p>

<p>Since SoapCore is a middleware and has no relation to any api controllers I'm not able to use an HttpClient for testing the endpoints, hence the TestServer is of no use to me.</p>

<p>My question is how do I run kestrel side by side with my integration test without using the TestServer, or is there a way to utilize the TestServer in this case?</p>

<p>I don't think any code here might be of any use but what I got so far is as follows.</p>

<p>Startup.cs</p>

<pre><code>public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddTransient&lt;IPaymentService&gt;(service =&gt; new Services.PaymentService());
        services.AddMvc();
    }

    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }

        app.UseSoapEndpoint&lt;IPaymentService&gt;(""/PaymentService.svc"", new BasicHttpBinding());
        app.UseMvc();
    }
}
</code></pre>

<p>PaymentService</p>

<pre><code>[ServiceContract]
public interface IPaymentService
{
    [OperationContract]
    string ReadPaymentFiles(string caller);
}

 public class PaymentService : IPaymentService
{
    public string ReadPaymentFiles(string caller)
    {
        return caller;
    }
}
</code></pre>

<p>One of my tests:</p>

<pre><code>public void Should_Get_Soap_Response_From_PaymentService()
    {
        var testServerFixture = new TestServerFixture();
        var binding = new BasicHttpBinding();
        var endpoint = new EndpointAddress(new Uri(""http://localhost:5000/PaymentService.svc""));
        var channelFactory = new ChannelFactory&lt;IPaymentService&gt;(binding, endpoint);

        var serviceClient = channelFactory.CreateChannel();
        var response = serviceClient.ReadPaymentFiles(""Ping"");
        channelFactory.Close();
    }
</code></pre>

<p>The test does'nt do anything right now since it is not calling any live endpoint, which is my problem...</p>
",https://stackoverflow.com/questions/50578907/running-kestrel-for-testing-without-using-the-testserver-included-in-microsoft-a,"['c#', 'testing', 'asp.net-core', 'asp.net-core-2.0', 'kestrel-http-server']",3200,TRUE,2,1
JUnit wait before proceeding,"<p>I am relying on some third party API to perform some action, namely delete a user eg. <code>user.delete()</code>. Unfortunately this is a void return and doesn't give me anything like a <code>CompletableFuture</code> back.</p>

<p>This is causing me some problems in my integration testing as I wish to create a user in a number of tests and then delete it once the test is complete ready for the next one. The test won't run if the delete task has not been completed by the third party.</p>

<p>So I can think of two solutions in my test code</p>

<pre><code>Thread.sleep(1000);
</code></pre>

<p>Yuck quite brittle I have no idea how long it will take. Or block until I can be sure the user no longer exists (ResourceException thrown when user doesn't exist)</p>

<pre><code>private void blockUntilUserRemoved() {
    try {
        do {
            servicesClient.getUser(""donald.duck@disney.com"");
        } while (true);
    } catch (ResourceException e) {
        return;
    }
}
</code></pre>

<p>Which will work but feels wrong using exceptions to control the logic like this. Question is does it matter in test code?</p>
",https://stackoverflow.com/questions/51650123/junit-wait-before-proceeding,"['junit', 'java-8']",167,TRUE,2,1
Deploying a TopShelf windows service with Octopus Deploy fails consistently every second time,"<p>My setup is TeamCity -> Octopus Deploy and I have a .Net solution with a WebAPI and a windows service, the latter using TopShelf.</p>

<p>When I build I automatically deploy to a CI environment and do integration testing towards the CI env.</p>

<p>I use the custom OD steps for Uninstalling Topshelf Service and Installing Topshelf Service respectively.</p>

<p>The entire build fails however, when the integration tests do not succeed -- and this happends every second time, consistently, without any changes to code. Root cause being that the service can't be started. Every second time it can and all is good, everything is awesome!</p>

<p>I have found a work-around by inserting a Wait step of 30s between uninstalling and installing. Then it succeeds every time.</p>

<p>I should really like to not have a fixed delay in my deployment process -- when can I do?!</p>

<p>As always -- all comments welcome :)</p>
",https://stackoverflow.com/questions/50293365/deploying-a-topshelf-windows-service-with-octopus-deploy-fails-consistently-ever,"['.net', 'octopus-deploy', 'topshelf']",496,FALSE,0,0
Validate request payloads and responses against a given OpenApi/Swagger specification,"<p>We have an HTTP API which is written with the <a href=""http://www.hug.rest/"" rel=""nofollow noreferrer"">hug framework for Python</a> but this is not set in stone and could be replaced with something else in the future.</p>

<p>Next to it, we have manually written an <a href=""https://github.com/OAI/OpenAPI-Specification"" rel=""nofollow noreferrer"">OpenApi/Swagger 2.0 specification file</a> in YAML for that API in order to provide interactive documentation. However, both are not connected to each other by <a href=""https://swagger.io/open-source-integrations/"" rel=""nofollow noreferrer"">any of the tooling</a> from the Swagger ecosystem - when we make changes in the API, we make the same changes in the specification and vice versa (which is not ideal but we might improve on this later).</p>

<p>Now, for the sake of integration testing, we would like to take a few static requests and their payloads (JSON and multipart/form-data) as well es responses (JSON) and validate if they fit the models from our specification file.</p>

<p>What could be an easy way to achieve this? I am open to any technology or programming language as long as complexity stays reasonable.</p>
",https://stackoverflow.com/questions/48338422/validate-request-payloads-and-responses-against-a-given-openapi-swagger-specific,"['json', 'validation', 'swagger', 'openapi']",2977,TRUE,4,1
ASP.Net Core React spa integration test,"<p>Asp.Net Core integration testing seems pretty simple but for the life of me I can't test the starter app with my react dev server.  It runs fine from a browser so I assume node, npm and react are set up correctly but not under xUnit.  It fails with the following exception:</p>

<p>System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: Failed to start 'npm'. To resolve this:.</p>

<p>[1] Ensure that 'npm' is installed and can be found in one of the PATH directories.
    Current PATH enviroment variable is: {PATH}</p>

<p>Make sure the executable is in one of those directories, or update your PATH.</p>

<p>[2] See the InnerException for further details of the cause. ---> System.ComponentModel.Win32Exception: The directory name is invalid
...</p>

<p>I assume this is because it can't find the content root of my spa so I have tried adding to my web host builder with no luck:</p>

<pre><code>.UseSolutionRelativeContentRoot( ""Solution Relative Path to My App"" ) );
</code></pre>

<p>This is my test class:</p>

<pre><code>public class SampleDataControllerTest
{

    private readonly TestServer server;
    private readonly HttpClient client;

    public SampleDataControllerTest()
    {
        server = new TestServer( WebHost.CreateDefaultBuilder()
            .UseStartup&lt;Startup&gt;()
            .UseSolutionRelativeContentRoot( ""Solution Relative Path to My App"" ) );
            .UseEnvironment( ""Development"" );
        client = server.CreateClient();
    }

    [Fact]
    public async Task RootTest()
    {
        HttpResponseMessage page = await client.GetAsync( ""/"" );
        Assert.NotNull( page );
        Assert.Equal( HttpStatusCode.OK, page.StatusCode );
    }
</code></pre>

<p>What am I missing?</p>
",https://stackoverflow.com/questions/52960326/asp-net-core-react-spa-integration-test,"['reactjs', 'asp.net-core', 'integration-testing', 'single-page-application', 'xunit']",768,TRUE,3,1
Unit Testing Ajax calls,"<p>I need some advice on unit testing. I am using mocha and sinon.</p>

<p>I have an httpService module that deals with all the ajax requests (written by me). The file being tested requires the httpService module.</p>

<p>I am unit testing a function that makes a call to a private function in the same file which in turn calls the httpService.get()</p>

<p>What is the best way to unit test this?</p>

<p>The options I have come up with:</p>

<p>1) I could use the sinon FakeXMLHttpRequest to fake the Ajax response. However because the ajax request is being made from the httpService module I am now testing the functionality of the httpService module. Is this not integration testing?</p>

<p>2) I could require the httpService module into my unit test file and stub the httpService.get() function. Is requiring a module into my unit test acceptable practice even if it is to just stub function?</p>

<p>Nothing else is exposed from the file being tested.</p>

<p>Any other options?</p>

<p>Thanks in advance!</p>
",https://stackoverflow.com/questions/49005614/unit-testing-ajax-calls,"['javascript', 'unit-testing', 'mocha.js', 'sinon']",791,TRUE,0,1
Mocking OmniAuth authentication in feature test. ActionController::RoutingError: uninitialized constant Auth,"<p>I'm currently trying to integrate the Spotify web API into my Ruby on Rails app. Currently I am trying to use Capybara to guide my feature test through the login procedure. My test currently looks like this:</p>

<pre><code>require 'rails_helper'

feature 'visiting homepage' do
  it 'Allows the user to log on with Spotify' do
    visit('/')
    click_on('Sign in with Spotify')
    # expect(page).to have_content(""Type in an artist, genre or mood and we'll do the rest"")
  end
end
</code></pre>

<p>Realizing that I needed to mock the authentication flow of omniauth, I followed the advice of this tutorial (<a href=""https://github.com/omniauth/omniauth/wiki/Integration-Testing"" rel=""nofollow noreferrer"">https://github.com/omniauth/omniauth/wiki/Integration-Testing</a>), which suggested that I add <code>OmniAuth.config.test_mode = true</code> to my test, so that ""all requests to OmniAuth will be short circuited to use the mock authentication hash as described below. A request to /auth/provider will redirect immediately to /auth/provider/callback."" So I put that line in <code>rails_helper.rb</code></p>

<pre><code>require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort(""The Rails environment is running in production mode!"") if Rails.env.production?
require 'rspec/rails'
require 'capybara/rspec'
require 'capybara/rails'

OmniAuth.config.test_mode = true

OmniAuth.config.mock_auth[:spotify] = OmniAuth::AuthHash.new({
  :provider =&gt; 'spotify',
  :uid =&gt; '123545'
})
</code></pre>

<p>Then, I added the redirect route to the settings on the Spotify Web API applications dashboard, as well as included the below in <code>config/routes.rb</code></p>

<pre><code>  get '/auth/spotify/callback'
</code></pre>

<p>However, after having done all this, I get the following error:</p>

<pre><code>Failures:

  1) visiting homepage Allows the user to log on with Spotify
     Failure/Error: click_on('Sign in with Spotify')

     ActionController::RoutingError:
       uninitialized constant Auth
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/omniauth-1.8.1/lib/omniauth/strategy.rb:415:in `call_app!'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/omniauth-1.8.1/lib/omniauth/strategy.rb:302:in `mock_callback_call'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/omniauth-1.8.1/lib/omniauth/strategy.rb:270:in `mock_call!'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/omniauth-1.8.1/lib/omniauth/strategy.rb:185:in `call!'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/omniauth-1.8.1/lib/omniauth/strategy.rb:168:in `call'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/omniauth-1.8.1/lib/omniauth/builder.rb:63:in `call'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/rack-2.0.4/lib/rack/etag.rb:25:in `call'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/rack-2.0.4/lib/rack/conditional_get.rb:25:in `call'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/rack-2.0.4/lib/rack/head.rb:12:in `call'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/rack-2.0.4/lib/rack/session/abstract/id.rb:232:in `context'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/rack-2.0.4/lib/rack/session/abstract/id.rb:226:in `call'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/railties-5.1.6/lib/rails/rack/logger.rb:36:in `call_app'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/railties-5.1.6/lib/rails/rack/logger.rb:24:in `block in call'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/railties-5.1.6/lib/rails/rack/logger.rb:24:in `call'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/rack-2.0.4/lib/rack/method_override.rb:22:in `call'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/rack-2.0.4/lib/rack/runtime.rb:22:in `call'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/rack-2.0.4/lib/rack/sendfile.rb:111:in `call'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/railties-5.1.6/lib/rails/engine.rb:522:in `call'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/rack-2.0.4/lib/rack/urlmap.rb:68:in `block in call'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/rack-2.0.4/lib/rack/urlmap.rb:53:in `each'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/rack-2.0.4/lib/rack/urlmap.rb:53:in `call'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/rack-test-1.0.0/lib/rack/mock_session.rb:29:in `request'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/rack-test-1.0.0/lib/rack/test.rb:259:in `process_request'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/rack-test-1.0.0/lib/rack/test.rb:129:in `custom_request'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/rack-test-1.0.0/lib/rack/test.rb:58:in `get'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/capybara-2.18.0/lib/capybara/rack_test/browser.rb:69:in `process'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/capybara-2.18.0/lib/capybara/rack_test/browser.rb:44:in `block in process_and_follow_redirects'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/capybara-2.18.0/lib/capybara/rack_test/browser.rb:43:in `times'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/capybara-2.18.0/lib/capybara/rack_test/browser.rb:43:in `process_and_follow_redirects'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/capybara-2.18.0/lib/capybara/rack_test/browser.rb:37:in `follow'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/capybara-2.18.0/lib/capybara/rack_test/node.rb:60:in `click'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/capybara-2.18.0/lib/capybara/node/element.rb:143:in `block in click'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/capybara-2.18.0/lib/capybara/node/base.rb:85:in `synchronize'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/capybara-2.18.0/lib/capybara/node/element.rb:143:in `click'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/capybara-2.18.0/lib/capybara/node/actions.rb:25:in `click_link_or_button'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/capybara-2.18.0/lib/capybara/session.rb:808:in `block (2 levels) in &lt;class:Session&gt;'
     # /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/capybara-2.18.0/lib/capybara/dsl.rb:50:in `block (2 levels) in &lt;module:DSL&gt;'
     # ./spec/features/visiting_homepage_spec.rb:6:in `block (2 levels) in &lt;top (required)&gt;'
     # ------------------
     # --- Caused by: ---
     # NameError:
     #   uninitialized constant Auth
     #   /Users/lw9905/.rvm/gems/ruby-2.5.0/gems/omniauth-1.8.1/lib/omniauth/strategy.rb:415:in `call_app!'

Finished in 0.21256 seconds (files took 5.88 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/features/visiting_homepage_spec.rb:4 # visiting homepage Allows the user to log on with Spotify
</code></pre>

<p>I've tried to read and understand the code in omniauth's <code>strategy.rb</code>, however, I can't find the undefined <code>Auth</code> variable the error is mentions.</p>
",https://stackoverflow.com/questions/49619202/mocking-omniauth-authentication-in-feature-test-actioncontrollerroutingerror,"['ruby-on-rails', 'capybara', 'spotify']",183,FALSE,0,0
Appsflyer integration - out of store apk with React Native,"<p>I am trying with Appsflyer out of store apk integration with React Native, I have followed below mentioned steps -</p>
<ul>
<li>Added app on Appsflyer account with com.reactnativetest package and 9apps_int as channel name.</li>
<li>Integrated react-native-appsflyer SDK in my React Native App, following the react-native-appsflyer documentation.</li>
<li>Have added initSDK with debug mode true and trackEvent Method in the code.</li>
<li>Have debug the app on phone, and I got the success response from initSDK and trackEvent.</li>
</ul>
<p>Now when I look at the Appsflyer dashboard, it gives me &quot;0&quot; Organic &amp; Non-Organic Install and there is no event also tracked in the dashboard.</p>
<p>I have also done the testing with AppsFlyer Integration Testing App, by whitelisting my device and testing the app again, but same result.</p>
<p>Please help me where I am wrong in this?</p>
<p>Do I need to upload the app on any store except play store/App store before testing, can't I test the app installs in debug mode?</p>
<p>Please help.</p>
<p>Thanks.</p>
",https://stackoverflow.com/questions/49667222/appsflyer-integration-out-of-store-apk-with-react-native,"['react-native', 'appsflyer', 'appsflyer-android-sdk']",979,FALSE,0,1
Modularizing Spring Integration Gateways,"<p>In attempting to modularize Spring Integration flows, I've started using a pattern where I put inbound and outbound gateways in separate classes, then import them where necessary to build flows.  As an example, here is a minimal integration testing showing a rough approach:</p>

<pre><code>@RunWith(SpringRunner.class)
@SpringBootTest(classes = { SampleIntegrationFlowTest.class })
@SpringIntegrationTest
@EnableIntegration
public class SampleIntegrationFlowTest {

    @Autowired
    private InboundGateways inboundGateways;

    @Autowired
    private OutboundGateways outboundGateways;

    @Test
    public void testFlow1() {
        StandardIntegrationFlow flow = IntegrationFlows
            .from(inboundGateways.createAccount())
            .transform(new JsonToXmlTransformer())
            .handle(outboundGateways.soapAccount())
            .transform(new XmlToJsonTransformer())
            .get();

        flow.start();
    }

    @Test
    public void testFlow2() {
        StandardIntegrationFlow flow = IntegrationFlows
            .from(inboundGateways.searchAccount())
            .transform(new JsonToXmlTransformer())
            .handle(outboundGateways.soapAccount())
            .transform(new XmlToJsonTransformer())
            .get();

        flow.start();
    }

    @Configuration
    static class InboundGateways {

        @Gateway
        public MessagingGatewaySupport createAccount() {
            return WebFlux.inboundGateway(""/accounts"")
                .requestMapping(mapping -&gt; mapping
                    .consumes(""application/json"")
                    .produces(""application/json"")
                    .methods(HttpMethod.POST))
                .get();
        }

        @Gateway
        public MessagingGatewaySupport searchAccount() {
            return WebFlux.inboundGateway(""/accounts"")
                .requestMapping(mapping -&gt; mapping
                    .produces(""application/json"")
                    .methods(HttpMethod.GET))
                .headerExpression(""name"", ""#requestParams.name"")
                .get();
        }

    }

    @Configuration
    static class OutboundGateways {

        @Gateway
        public MessageHandler soapAccount() {
            return new SimpleWebServiceOutboundGateway(""http://example.com/accounts"");
        }

    }
}
</code></pre>

<p>I structure it this way so that I can:</p>

<ol>
<li>Group inbound gateways together so that I can generate the InboundGateways class from a Swagger contract.</li>
<li>Be able to reuse the outbound gateway from multiple flows (several inbound rest endpoints route to the same outbound soap endpoint).</li>
</ol>

<p>Questions:</p>

<ol>
<li>Are there any downsides to the way I've structured this?  Any ways to improve it, given the goals noted above?</li>
<li>Is there an opportunity to ""model"" the inbound gateways as interfaces annotated with @MessagingGateway/@Gateway so that I can interact with them like a normal pojo?  This could be useful when integrating into existing code or via integration tests.  If there is a way, I can't figure out how to do something like Webflux.inboundGateway(
</ol>
",https://stackoverflow.com/questions/52502640/modularizing-spring-integration-gateways,"['spring-integration', 'spring-integration-dsl']",363,FALSE,0,1
Creating test for an asynchronous method,"<p>So I have been developing some codes using AWS Lambda with NodeJS 6.10. Because of my lack of knowledge in integration testing (don't worry, the unit tests are done), I didn't test my code. Of course, I missed a bug that caused two sleepless nights. It keeps running even after I put in this</p>

<pre><code>return workerCallback(err);
</code></pre>

<p>I thought it would stop the function from running other codes past the if clause because I returned it. Anyway, I was able to fix my issue by adding a return just after the asynchronous function </p>

<pre><code>SQSService.deleteMessage
</code></pre>

<p>is called. The rest of the codes did not run and the lambda function ran and ended as expected.</p>

<p>Here are now the code that works as expected.</p>

<pre><code>function myFoo(currentRequest,event, workCallback){

    var current_ts = moment();
    var req_ts = moment(currentRequest.request_timestamp);

    if (req_ts.diff(current_ts, 'minutes') &gt; 5) {
    SQSService.deleteMessage(event.ReceiptHandle, function(err, data){
        if (err) {
            return workerCallback(err);
        } else {
            return workerCallback(null, ""Request stale! Deleting from queue..."");
        }
    }); //end of SQS Service
        return; //This line... this line!
    }

    /* Codes below will execute because the code above is asynchronous
       but it should not as the asynchronous code above is a terminator function 
    from a business logic point of view
    */

    //more codes that will run should currentRequest.request_timestamp is 5 minutes past

 }
</code></pre>

<p>Can someone please guide me on how to test this code or create a test that would at least prevent me from doing the same mistake again? I'd like to avoid these mistakes from happening again by testing. Thanks!</p>
",https://stackoverflow.com/questions/50129922/creating-test-for-an-asynchronous-method,"['javascript', 'node.js', 'callback', 'aws-lambda']",44,TRUE,0,1
"How to test .NET Standard 2 library with either NUnit, xUnit or MSTest from either Rider or VS 2017?","<p>I have a project where I use <a href=""https://github.com/Azure/azure-functions-durable-extension"" rel=""noreferrer"">Azure Durable Functions</a>, and they are available only on .NET Standard 2. So, it defines which class library can be used in testing projects. But, I cannot put together a library where either xUnit, NUnit or MSTest is used in unit/integration testing.</p>

<p>Adding NUnit to a project where .NET Standard 2 is class library fails with the following error:</p>

<blockquote>
  <p>INFO: Restoring packages for
  C:\VSTS\github.com\netstandardXunitMsTestNunit\src\Netstandard2xUnitMsTestnUnit\nunit\nunit.csproj...
  DEBUG: Restoring packages for .NETStandard,Version=v2.0... DEBUG:
  Resolving conflicts for .NETStandard,Version=v2.0... ERROR: Cycle
  detected.    nunit -> NUnit (>= 3.9.0). DEBUG: Checking compatibility
  of packages on .NETStandard,Version=v2.0. DEBUG: Checking
  compatibility for nunit 1.0.0 with .NETStandard,Version=v2.0.</p>
</blockquote>

<p>The error is the same for xUnit (just the error message talks about xUnit cycle).</p>

<p>Both error can be reproduced in Rider and Visual Studio 2017 Enterprise too. I tried it again after I cleaned nuget cache. The result is the same.</p>

<p>In case of MsTest, possible to add ms test libraries, but test discovery does not work neither Rider and nor Visual Studio.</p>

<p><strong>Is it even possible unit test a .NET Standard 2 library?</strong></p>

<p>Is there anything I can do beside waiting for these projects to pick up .NET Standard 2 stuff?</p>

<blockquote>
  <p>I created a small sample project, can be found here: <a href=""https://github.com/SayusiAndo/netstandard2xunitresharper"" rel=""noreferrer"">https://github.com/SayusiAndo/netstandard2xunitresharper</a></p>
</blockquote>
",https://stackoverflow.com/questions/48885428/how-to-test-net-standard-2-library-with-either-nunit-xunit-or-mstest-from-eith,"['c#', '.net', 'unit-testing', 'azure-functions', '.net-standard']",18712,TRUE,28,4
pytest - simulate network failure,"<p>I am attempting an integration test using pytest for my application developed in python3.7 and asyncio. The application is supposed to connect to a remote server and if the network fails, my application should detect this and attempt to reconnect at a specified interval. Typically, in my integration test, I have my remote server already running and listening on a TCP port. My application should connect to that port and I will check that the connection was successful. Then I need to simulate a network outage in which application looses connection to the server and test the behaviour of the application while the network is not operational and then I need to bring the network back online and confirm that the app will properly reconnect and perform it's tasks. For the purposes of my integration testing all this stuff is running on my localhost.</p>

<p>Does pytest already have something for this usecase or should I build some sort of proxy server myself? How would I go about doing this?</p>
",https://stackoverflow.com/questions/53131726/pytest-simulate-network-failure,"['python', 'tcp', 'pytest']",1231,TRUE,1,2
Using a HSQLDB in in-memory mode for testing with maven,"<p><strong>The Situation:</strong></p>

<p>Currently we use a HSQLDB in server mode for integration testing. We are using a self-made maven plugin which initialized the Database to our testing needs (creating schemas, migrate with flyway scripts etc..).</p>

<p>Now to speed up the integration tests i'd like to use HSQL in in-memory mode instead.</p>

<p><strong>The Problem:</strong></p>

<p>When i change the connection urls so that they use the HSQLDB in in-memory mode the initialization runs fine as well as the connection from the integration tests. But the data and the schemas that has been initialized is not available in the integration tests.</p>

<p>The reason is that when the maven plugin is done initializing the database it seems like the jvm used for that is shut down and the connection from the integration test creates <strong>a vanilla empty HSQLDB</strong> in-memory.</p>

<p><strong>The Question:</strong></p>

<p>Is there a way to tell a maven plugin to run in the same JVM or process or whatever is needed so that the plugin and the integration tests will share the same memory and therefor use the same hsqldb ?</p>
",https://stackoverflow.com/questions/49812798/using-a-hsqldb-in-in-memory-mode-for-testing-with-maven,"['maven', 'maven-2', 'maven-plugin', 'hsqldb']",178,FALSE,1,1
Component integration test with jasmine spy returning Subscribable,"<p>I'm trying to do component integration testing (i.e. including the Angular lifecycle events), but I'm having a hard time mocking a service with Jasmine, one that exposes a <code>Subscribable</code>.</p>

<p>To reproduce my scenario:</p>

<ol>
<li><code>ng new ng-comp-tests</code></li>
<li><code>ng generate component my-screen</code></li>
<li><code>ng generate service crud</code></li>
<li><code>ng generate class item</code></li>
</ol>

<p>Update the class to this:</p>

<pre class=""lang-typescript prettyprint-override""><code>export class Item {
  constructor(public name: string) { }
}
</code></pre>

<p>Then make the service look like this:</p>

<pre class=""lang-typescript prettyprint-override""><code>export class CrudService {
  private thing = new Subject&lt;Item&gt;();

  constructor() {
    setInterval(() =&gt; { this.thing.next(new Item('Thing ' + Math.random())); }, 1000);
  }

  getThingObservable() {
    return this.thing.asObservable();
  }
}
</code></pre>

<p>Change the component to be like this (and include it as the main thing in the app component):</p>

<pre class=""lang-html prettyprint-override""><code>&lt;p *ngIf=""!!thing""&gt;{{thing.name}}&lt;/p&gt;
</code></pre>

<pre class=""lang-typescript prettyprint-override""><code>export class MyScreenComponent implements OnInit, OnDestroy {
  public thing: Item;
  private thingSubscription: Subscription;

  constructor(private service: CrudService) { }

  ngOnInit() {
    this.thingSubscription = this.service
      .getThingObservable()
      .subscribe(t =&gt; { this.thing = t; });
  }

  ngOnDestroy(): void {
    this.thingSubscription.unsubscribe();
  }
}
</code></pre>

<p>And finally, change the spec to be this:</p>

<pre class=""lang-typescript prettyprint-override""><code>describe('MyScreenComponent', () =&gt; {
  let component: MyScreenComponent;
  let fixture: ComponentFixture&lt;MyScreenComponent&gt;;

  beforeEach(async(() =&gt; {
    const serviceSpy = jasmine.createSpyObj('CrudService', {
      getThingObservable: () =&gt; new Subject&lt;Item&gt;().asObservable()
    });

    TestBed.configureTestingModule({
      declarations: [ MyScreenComponent ],
      providers: [ { provide: CrudService, useValue: serviceSpy } ]
    })
    .compileComponents();
  }));

  beforeEach(() =&gt; {
    fixture = TestBed.createComponent(MyScreenComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () =&gt; {
    expect(component).toBeTruthy();
  });
});
</code></pre>

<p>This will give an exception for the test:</p>

<blockquote>
  <p>MyScreenComponent should create<br>
  <code>[object ErrorEvent] thrown</code></p>
</blockquote>

<p>The exception isn't really helpful, and the console from Chrome isn't either, because it shows this abbreviated log:</p>

<ul>
<li>""Failed to load ng:///DynamicTestModule/...ngfactory.js: Cross origin requests...""</li>
<li>""Failed to load ng:///DynamicTestModule/...ngfactory.js: Cross origin requests...""</li>
<li>""Uncaught DOMException: Failed to execute 'send'....""</li>
<li>""Error during cleanup of component ... Cannot read property 'unsubscribe' of undefined...""</li>
</ul>

<p>The <a href=""https://stackoverflow.com/a/44186041/419956"">top answer for a related question</a> suggests I forgot to do <code>fixture.detectChanges()</code> (which prevents <code>ngOnInit</code> from firing), but as you can see I do have that in my code.</p>

<p>There must be something else wrong here, but what?</p>
",https://stackoverflow.com/questions/50189904/component-integration-test-with-jasmine-spy-returning-subscribable,"['angular', 'jasmine']",882,TRUE,0,1
Not able to access in-memory mongodb using NoSqlUnit,"<p>I have an arquillian component test where I am wanting to use an in-memory MongoDB (Fongo) database using NoSqlUnit. I am using a @Producer to define my DataStoreConnection and I am using Eclipse MicroProfile on Java SE 8. </p>

<p>The issue is that after initiating the in-memory DB, I am not able to access it programmatically in my code when doing my endpoint tests.</p>

<p>I have a DataStoreConnectionProducer as such:</p>

<pre><code>import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;


@ApplicationScoped
public class DataStoreConnectionProducer {
    private MongoClient mongoClient;

    private static final Config config = ConfigProvider.getConfig();

    @Produces
    public MongoDatabase createMongoClient(){
        final String DB_PATH    = config.getValue( ""mongodb.path"", String.class );
        final int DB_PORT       = config.getValue( ""mongodb.port"", Integer.class );
        final String DB_NAME    = config.getValue( ""mongodb.dbname"", String.class );

        if( DB_NAME.equals( ""test"" ) )
            return new MongoClient().getDatabase(DB_NAME);
        else
            return new MongoClient( DB_PATH, DB_PORT ).getDatabase( DB_NAME );

    }
}
</code></pre>

<p>My GreetingDAO is injecting the MongoDatabase using</p>

<pre><code>@Inject MongoDatabase mongoDatabase;
</code></pre>

<p>My Resource looks as such:</p>

<pre><code>@Path( ""/greetings"" )
public class HelloResource {

    @Inject
    private GreetingDAO greetingDAO;

    @Inject
    private GreetingService greetingService;

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response getGreeting (){
        return Response.ok(greetingDAO.findAll(), MediaType.APPLICATION_JSON).build();
    }

    @GET
    @Path( ""{id}"" )
    @Produces( MediaType.APPLICATION_JSON )
    public Response getGreetingById( @PathParam( ""id"" ) String greetingId ){
        try {
            return Response.ok( greetingDAO.findByID( greetingId.toLowerCase() ), MediaType.APPLICATION_JSON ).build();
        }catch ( NoSuchElementException ex ){
            ex.printStackTrace();
            return Response.status( 404 ).build();
        }
    }
</code></pre>

<p>Finally my Arquillian test:</p>

<pre><code>    @RunWith( Arquillian.class )
    @RunAsClient
    public class HelloResourceTest extends AbstractTest{

        private static final String DB_NAME     = ""test"";

        @ClassRule
        public static final InMemoryMongoDb inMemoryMongoDb =
                newInMemoryMongoDbRule().targetPath( ""localhost"" ).build();
        @Rule
        public MongoDbRule embeddedMongoDbRule = newMongoDbRule()
                .defaultEmbeddedMongoDb(DB_NAME);

        @Inject MongoClient mongoClient;

        @Deployment
        public static WebArchive createDeployment () {
            WebArchive war = createBasicDeployment()
                    .addClasses(
                        HelloResource.class,
                        GreetingDAO.class,
                        GreetingService.class,
                        Greeting.class,
                        DAO.class,
                        DataStoreConnectionProducer.class
                    );
            System.out.println( war.toString(true) );
            return war;
        }

        private MongoDatabase getFongoDataBase(){
            return mongoClient.getDatabase( DB_NAME );
        }
</code></pre>

<p>This is pretty much where I start getting confused.. Knowing that Fongo is a in-memory DB, surely there is no remote way to access it? Rather, I would surely have to supply that to my DataStoreConnectionProducer or somehow inject it to my GreetingDAO so that the FongoDB is used rather than the @Producer trying to connect to my managed MongoDB.</p>

<p>A question you might ask: Why not use a Managed MongoDB? 
<strong>Answer</strong>: Because I wish to do component based tests, rather than Integration testing.</p>
",https://stackoverflow.com/questions/51702584/not-able-to-access-in-memory-mongodb-using-nosqlunit,"['mongodb', 'junit', 'nosql', 'jboss-arquillian', 'microprofile']",192,TRUE,0,1
In Memory database vs Moqing framework in .NET Core,"<p>we are going to implement TDD approach in our next project. So I have been studying Unit Testing with NUnit in ASP.NET Core. As I am new I am confused about few things. So I would like to share these questions with you for making decisions based on the expert opinions. </p>

<ol>
<li>What are the Pros and Cons of Mocking database and In-Memory database? </li>
<li>In which situation, we should use Mocking and in what situation we should go with InMemory database provider?</li>
<li>Which is the better approach, using InMemory or using Mocking?</li>
<li>Can we implement both approaches together in the same project?</li>
<li>For integration testing, should we use mocking or In Memory?</li>
<li>Is it a better approach to use the In-Memory database in Unit Testing?</li>
<li>While testing Business Layer, should we use Mocking or In-Memory database?</li>
<li>While testing MVC Controller, should we use Mocking or In-Memory database?</li>
</ol>

<p>Please help me to find the answers to these questions. It might be that, some questions are similar, however, I don't want to remove them for having a better understanding from you guys. Thanks.</p>
",https://stackoverflow.com/questions/50154414/in-memory-database-vs-moqing-framework-in-net-core,"['unit-testing', 'asp.net-core-mvc', 'tdd', 'moq', 'in-memory-database']",2827,TRUE,4,1
Clickatell tells that SMS a successfully sent to gateway but messages are not delivered,"<p>I'm trying to establish SMS sending with Node.js via Clickatell.</p>

<p>I've already tried the way described here: <a href=""https://www.clickatell.com/developers/api-documentation/nodejs/"" rel=""nofollow noreferrer"">https://www.clickatell.com/developers/api-documentation/nodejs/</a></p>

<p>And both REST and HTTP requests from here (topics ""How do I test my HTTP integration?"" and ""How do I test my REST API integration?""): <a href=""https://www.clickatell.com/faqs/product-specific-faqs/platform/integration-testing/"" rel=""nofollow noreferrer"">https://www.clickatell.com/faqs/product-specific-faqs/platform/integration-testing/</a></p>

<p>In ""SMS integration"" area for both HTTP and REST APIs delivery type been set to: ""Time critical delivery"".</p>

<p>And i'm sending messages to number, that is in ""test phones"" list.</p>

<p>All the messages, I've sent to the server, are visible in ""Reporting"" area. But all them are stuck in ""Delivered_to_gateway"" status.</p>

<p>What i'm doing wrong?</p>

<p><strong>UPD</strong>:</p>

<p>So, first message is finaly delivered to cell phone. After almost one and half hour of waiting.</p>

<p>I've also tried to send message to another phone with another cell operator (""Mobile network: Beeline (KB Impuls, VimpelCom)""), and it delivered in a minute or two.</p>

<p>So, <strong>detailing my question</strong>: it seems Clickatell have some kind of problems with delivering messages to ""Mobile network: MTS (Sistema, Prim Telefon)"". Can it be fixed somehow?</p>
",https://stackoverflow.com/questions/49915102/clickatell-tells-that-sms-a-successfully-sent-to-gateway-but-messages-are-not-de,['clickatell'],852,FALSE,3,0
Generate swagger/openapi docs from Mocha/Chai test suite,"<p>I want to use <a href=""https://swagger.io/docs/specification/about/"" rel=""nofollow noreferrer"">Swagger/OpenAPI</a> to standardize documentation efforts. Most of the API's are built with NodeJS and I do integration testing with Mocha &amp; Chai which helps tremendously with quickly making sure the API isn't broken after making changes. From what I understand, using Swagger won't replace my integration test but will make it easy for developers to know how to consume my API. If I can tie my documentation efforts into my test suite, it would make on-going documentation maintenance easier. When i add or modify test, I could update API documents in the same place.</p>

<p>What I was thinking about doing is using <a href=""https://github.com/yui/yuidoc"" rel=""nofollow noreferrer"">YUIDoc</a> or <a href=""http://usejsdoc.org/about-getting-started.html"" rel=""nofollow noreferrer"">JSDoc</a> which generates API documentation from comments in source. But neither conform to OpenAPI spec. Then I found <a href=""https://github.com/Surnet/swagger-jsdoc"" rel=""nofollow noreferrer"">Swagger-JSdoc</a> and figured I could just put all the comments in my test suite code since I'm already there specifying what to test in the endpoints.</p>

<p>Is there another way/workflow that might be more efficient for new or existing projects? How can I bring my documentation efforts closer to my test suite to improve on-going documentation maintenance?</p>
",https://stackoverflow.com/questions/52149944/generate-swagger-openapi-docs-from-mocha-chai-test-suite,"['node.js', 'tdd', 'swagger', 'openapi']",1064,FALSE,1,1
Issues with google REST api: enum keys returns spurious values,"<p>Im trying to write some code to rotate service account keys for integration testing. To this end I have a function that gets all the keys for a test account using the REST api. This involves sending a <strong>GET</strong> request to</p>
<p><code>https://iam.googleapis.com/v1/projects/&quot; + projectName + &quot;/serviceAccounts/&quot; + accountEmail + &quot;/keys&quot;</code></p>
<p>The result(s) of this are a JSON string with an array of Map that have</p>
<ul>
<li>keyName (project/account/keyId)</li>
<li>validAfterTime</li>
<li>validBeforeTime</li>
<li>keyAlgorithm</li>
</ul>
<p>the 'before' and 'after' times are Zulu values that seem to indicate valid times for said key.</p>
<p>This is all well and good.. except.. that with every call I seem to get 2 or more entries that are either expired or not valid yet, have a 2 day valid span and don't appear in the google console. Trying to delete one of these returns a</p>
<blockquote>
<p>&quot;code&quot;: 400,    &quot;message&quot;: &quot;Request contains an invalid argument.&quot;</p>
</blockquote>
<p>What are these entries? Why are they showing up in this list?</p>
<hr />
<h3>Edit -</h3>
<p>if someone from google happens to wander by this post - there is a doc bug on <a href=""https://cloud.google.com/iam/docs/creating-managing-service-account-keys"" rel=""nofollow noreferrer"">this</a> page. The URL for 'listing service keys' should be a <strong>GET</strong> request and not a <strong>POST</strong> as it currently shows.</p>
",https://stackoverflow.com/questions/48342368/issues-with-google-rest-api-enum-keys-returns-spurious-values,"['rest', 'google-cloud-platform']",62,FALSE,1,0
Hartl Sample App Failure in integration test for assert_select a[href=?],"<p>I have been working through the Hartl sample app course, and while I have had issues here and there, I have always been able to find answers, or identify the kink in my code by comparing with the tutorial git. However this time I am at a loss and am hoping someone in the community can figure out where I may have gone wrong.</p>

<p>I am getting the following minitest error:</p>

<pre><code>    Minitest::Assertion: Expected at least 1 element matching ""a[href=""/users/14035331""]"", found 0..
    Expected 0 to be &gt;= 1.
    test/integration/users_index_test.rb:15:in `block (2 levels) in &lt;class:UsersIndexTest&gt;'
    test/integration/users_index_test.rb:14:in `block in &lt;class:UsersIndexTest&gt;'
</code></pre>

<p>Here is the code for the test which is exactly as it appears in the tutorial:</p>

<pre><code>    require 'test_helper'

    class UsersIndexTest &lt; ActionDispatch::IntegrationTest

      def setup
       @user = users(:james)
      end

      test ""index including pagination"" do
        log_in_as(@user)
        get users_path
        assert_template 'users/index'
        assert_select 'div.pagination'
        User.paginate(page: 1).each do |user|
           assert_select 'a[href=?]', user_path(user), text: user.name
        end
      end
    end
</code></pre>

<p>User 14035331 is the ID of the first record in the test.db. Possible issues I can think of but haven't been successful in identifying - User is not on Page 1 (this shouldn't be since it is the first ID record); the test is looking for the NAME field but getting the ID field.</p>

<p>I did find a similar question on here, but it doesn't address this problem. You can see the thread here: <a href=""https://stackoverflow.com/questions/35007124/got-failure-in-integration-testing-of-rails"">Got failure in integration testing of rails</a></p>

<p>That user is a bit further along, and I really hate to refractor and push forward when my test suite isn't passing.</p>
",https://stackoverflow.com/questions/48569385/hartl-sample-app-failure-in-integration-test-for-assert-select-ahref,['ruby-on-rails'],40,FALSE,0,1
Teradata &amp; Continuous Integration,"<p>Status quo:
We are developing a project at the client side. There's an existing Teradata appliance on the DEV side and one on the production side.
On the DEV side there is more than one supplier and every supplier has its own sub-database. The DBAs are not granted with direct permissions but call macros to create users and databases, grant rights etc. But no SYSDBA permissions on Teradata.
On the PRD side these macros don't exist. Every statement has to be run as is and has to be run automatically (packaged via RPM).
Therefore it is currently impossible to do a complete packaging and integration testing.</p>

<p>We have a Jenkins running which is doing several other tasks. The system is virtual, we're root and we already have an established packaging process.</p>

<p>What we need/ideas: an image of a plain Teradata database we can connect to (remote is ok) and run our DDL scripts.
The idea is to start some kind of image (Docker, VMWare, VirtualBox) which provides a small Teradata installation, we run our DDLs and throw the result away at the end.</p>

<p>Best case would be Docker in this case, but I'm open for ideas. Is there some kind of trial Teradata (v15) which can be used in this case?</p>
",https://stackoverflow.com/questions/48217655/teradata-continuous-integration,"['docker', 'jenkins', 'continuous-integration', 'teradata']",888,TRUE,4,1
Testing forked redux-sagas with redux-saga-test-plan,"<p>I am trying to test my redux-sagas with the redux-saga-test-plan library to make things easier. All tests are run in a JEST environment.</p>

<p>To help me structure my tests on a forked saga I followed the documentation here: <a href=""https://github.com/jfairbank/redux-saga-test-plan/blob/master/docs/integration-testing/forked-sagas.md"" rel=""nofollow noreferrer"">https://github.com/jfairbank/redux-saga-test-plan/blob/master/docs/integration-testing/forked-sagas.md</a></p>

<p>But when I try to run the test i get this error:</p>

<pre><code>TypeError: Cannot read property 'name' of undefined

  12 |   .put(setMenu(menuList))
  13 |   .dispatch('SET_MENU_REQUEST', menuList)
&gt; 14 |   .run()
  15 | })
  16 |
</code></pre>

<p><strong>My test (updated):</strong></p>

<pre><code>import { expectSaga } from 'redux-saga-test-plan'
import { call, put, takeLatest, takeEvery } from ""redux-saga/effects"";
import menuSaga from '../../sagas/MenuSaga'
import { applyMenu } from '../../sagas/MenuSaga'
import { menuList } from '../../stubs/menuList'
import { setMenu } from '../../reducers/menuReducer'

it(""Sets a new menu"", () =&gt; {

  return expectSaga(applyMenu)
  .put(setMenu(menuList))
  .dispatch('SET_MENU_REQUEST', menuList)
  .run()
})
</code></pre>

<p><strong>update:</strong>
I found some <a href=""http://redux-saga-test-plan.jeremyfairbank.com/unit-testing/saga-helpers.html"" rel=""nofollow noreferrer"">documentation</a> on how to utilize effect-helpers (takeEvery, takeLatest) and tried that too, but to no effect, it just causes a new error.</p>

<p>test with effect-helper:</p>

<pre><code>it(""Sets a new menu"", () =&gt; {

  return expectSaga(menuSaga)
  .next()
  .put(setMenu(menuList))
  .takeEvery('SET_MENU_REQUEST', applyMenu)
  .finish()
  .isDone()
})
</code></pre>

<p>The error it throws:</p>

<pre><code> TypeError: (0 , _reduxSagaTestPlan.expectSaga)(...).next is not a function

      10 |
      11 |   return expectSaga(menuSaga)
    &gt; 12 |   .next()
      13 |   .put(setMenu(menuList))
      14 |   .takeEvery('SET_MENU_REQUEST', applyMenu)
      15 |   .finish()
</code></pre>

<p><strong>The saga I am trying to test:</strong></p>

<pre><code>import {fork, put, select, call} from 'redux-saga/effects'
import {takeEvery, takeLatest} from 'redux-saga'
import { handleRequest } from './serverSaga'
import { setMenu } from '../reducers/menuReducer'


const POST_MENU_REQUEST = 'POST_MENU_REQUEST'
const GET_MENU_REQUEST = 'GET_MENU_REQUEST'
const SET_MENU_REQUEST = 'SET_MENU_REQUEST'

export function setMenuRequest(menu) {return {type: SET_MENU_REQUEST, menu}}
export function postMenuRequest(data) {return {type: POST_MENU_REQUEST, data}}
export function getMenuRequest() {return {type: GET_MENU_REQUEST}}


export function* applyMenu(menu) {
  yield put(setMenu(menu))
}


function* postNewMenu(data){
  yield call(handleRequest, '/admin/menu' ,'POST', data)
}


function* getMenu(){ 
  let response = yield call(handleRequest, ""/admin/menu"", ""GET"")

  if(response){
    yield put(setMenu(response))
  }
}

export default function* menuSaga(){
  yield [
    fork(function*() {
      yield takeEvery(POST_MENU_REQUEST, postNewMenu)
    }),
    fork(function*() {
      yield takeEvery(GET_MENU_REQUEST, getMenu)
    }),
    fork(function*(){
      yield takeEvery(SET_MENU_REQUEST, applyMenu)
    })
  ]
}
</code></pre>

<p>As you can see I have tried to export the generator-function that I want to test, even though I don't think this is optimal since the test shouldn't require me to change my code just to test it, so I'm probably missing something. </p>

<p>The stub menuList has a structure like this:</p>

<pre><code>Date: '', 
Id: '', 
ClosingTime: '',
MenuItems: [],
</code></pre>

<p>It's proving to be not-so-straigthforward to test my sagas since they are all structured like this one (forked) and there doesn't seem to be a lot of documentation as to how to test them properly.</p>
",https://stackoverflow.com/questions/49427575/testing-forked-redux-sagas-with-redux-saga-test-plan,"['reactjs', 'redux', 'jestjs', 'redux-saga']",2576,TRUE,4,2
Create pre-populated docker images,"<p>We're heavily using docker for integration testing and to reduce the setup times for the test environment, we'd like to create images that already contain test data to a certain extend.</p>

<p>For some services we rely on public docker images, that define volumes where data is stored.</p>

<p>I've observed, that docker does not persist data that is stored in these volume mounts (defined by the base image) during build. There are also questions around this issue like <a href=""https://stackoverflow.com/questions/43038467/docker-volume-content-does-not-persist"">this</a>, <a href=""https://stackoverflow.com/questions/26315680/how-to-undeclare-volumes-in-docker-image"">this</a> or <a href=""https://github.com/moby/moby/issues/3639"" rel=""nofollow noreferrer"">this issue</a>.</p>

<p>Now given that it's the way how docker works, I wonder what would be a good approach to work around this issue?</p>

<p><a href=""https://stackoverflow.com/questions/46648697/in-docker-can-i-publish-a-volumes-with-initial-data"">This question</a> here describes, how I could pre-populate a volume with data from the image - which is kind of the opposite of what I'd like to achieve.</p>

<p>Currently I'm setting up the images and move the pre-populated data from the volume mount to another directory at the end of the build. And on container start I link every subfolder back into the volume mounts. But this is kind of ugly as I have to link every subfolder seperately, because the parent folder is the volume mount and can not be linked.</p>

<p>Are there better ways? Is there even an ""official"" docker way to achive this?</p>
",https://stackoverflow.com/questions/50036591/create-pre-populated-docker-images,"['docker', 'integration-testing', 'docker-volume']",351,FALSE,2,2
How to authenticate to the &#39;/dev&#39; URL of a google apps script web app,"<p>I am having difficulty with a RESTful <code>GET</code> after  <a href=""https://developers.google.com/apps-script/guides/web#deploying_a_script_as_a_web_app"" rel=""nofollow noreferrer"">Deploying a script as a web app</a></p>
<p>The documentation at that link says:</p>
<blockquote>
<p>Once you click Deploy, you'll see a new dialog with a message indicating that your project has been successfully deployed as a web app.</p>
<p>This dialog provides two important URLs for your app:</p>
</blockquote>
<ol>
<li><em>... concerns the <code>exec</code> URL ...</em>  I am able to use this form without problem, having selected, <strong>Execute the app as:</strong> <code>Me</code> and <strong>Who has access to the app:</strong> <code>Anyone,even anonymous</code></li>
</ol>
<blockquote>
<ol start=""2"">
<li>The second is the link labeled latest code and ends in /dev. This URL can only be accessed by users who have edit access to the script. This instance of the app always runs the most recently saved code — not necessarily a formal version — and is intended for quick testing during development.</li>
</ol>
</blockquote>
<p>To use that second link (from Postman or Wget, etc) I expected to need to use basic auth like ...</p>
<p><code>https://aladdin:sesame@script.google.com/macros/s/AKfyuglyuglyuglyS6i-g/dev</code></p>
<p>... but Google just returns a log in page.</p>
<p>If it is possible to do this, how do I do it?</p>
<p><em>Update:</em></p>
<p>I should perhaps mention I want this just to avoid repeatedly &quot;publishing&quot; new version, new version, new version, etc, during a brief phase of integration testing -- which is why I haven't researched OAuth for this purpose, as @tehhowch rightly suggested.</p>
",https://stackoverflow.com/questions/50141702/how-to-authenticate-to-the-dev-url-of-a-google-apps-script-web-app,"['google-apps-script', 'web-applications', 'basic-authentication']",412,FALSE,2,0
Groovy/Grails Proliferation of &quot;\&quot; escape character in a string,"<p>This is a rather odd issue. I'm integration testing a Grails service and the associated domain class. One property of that domain class is a <code>String</code> that holds a JSON. The database field is <code>json</code> too and there's a custom Hibernate value type that performs the necessary conversion. It's already been working for years in production in another domain class.</p>

<pre><code>class MyDomain {
    String data
    static mapping = {
        data type: StringJsonUserType
    }
}
</code></pre>

<p>So far so good. In my test I mock an input object to my service method that ultimately will contain and return the desired JSON string.</p>

<pre><code>private MockedClass mockClass() {
    // JsonRepresentable declares asJson() method.
    def data = GroovyMock(JsonRepresentable)
    data.asJson() &gt;&gt; ""{\""content\"":\""irrelevant\""}""

    def mockClass = GroovyMock(MockedClass)
    mockClass.getData() &gt;&gt; data

    return mockClass
}
</code></pre>

<p>The service method (simplified):</p>

<pre><code>void persist(MockedClass mock) {
    String string = mock.data.asJson()
    def domain = new MyDomain(data: mock.data.asJson())
    domain.save()
}
</code></pre>

<p>When I step into this code with the debugger I can immediately see that the string has turned from <code>{""content"":""irrelevant""}</code> in the <code>string</code> variable to <code>""{\""content\"":\""irrelevant\""}""</code> in the <code>domain</code> variable.</p>

<p>It's only logical now, that in my test a comparison of the saved domain class string does not match the mocked input. </p>

<p>This is how <code>MyDomain.data</code> data looks when it's read from the database:</p>

<p><code>""\""\\\""{\\\\\\\""content\\\\\\\"":\\\\\\\""irrelevant\\\\\\\""}\\\""\""""</code></p>

<p>This is the same string parsed with <code>new JsonSlurper().parseText(MyDomain.data)</code>:</p>

<p><code>""\""{\\\""content\\\"":\\\""irrelevant\\\""}\""""</code></p>

<p>Here's the mocked string parsed with JsonSlurper (as above):</p>

<p><code>[content:irrelevant]</code></p>

<p>Obviously the last example is what I expect. Can anybody tell me why Groovy/Grails adds a bulk load of crappy \\ to my simple and properly escaped string? I could even try a Groovy string <code>'{""content"":""irrelevant""}'</code> but that doesn't make the slightest difference.</p>
",https://stackoverflow.com/questions/52552276/groovy-grails-proliferation-of-escape-character-in-a-string,"['testing', 'grails', 'groovy']",687,TRUE,1,1
How do you know whether to automate testing or use manual?,"<p>I've made a login screen and menu for a Doctors management system. User logs in and is sent to main menu, depending on role type they have different controls on each sub menu. </p>

<p>It all works well and now its time to test.</p>

<p>I've never done automated testing - unit, integration or end to end. </p>

<p>As I understand, it's best to seperate business logic from presentation logic and only unit test the business logic?</p>

<p>With that in mind button visibility and messageboxes are presenation logic, right? and are best suited to a manual test plan in which I'll validate the functionality? Is that right?</p>

<p>I'm sure I should unit test if login is succeccful? however, isn't the method dependent on a database? so is that then integration testing? </p>

<p>here's my code </p>

<p><strong>Login form</strong></p>

<pre><code> private void btnLogin_Click(object sender, EventArgs e)
    {


        //Try and open a connection with database and run the code
        try
        {

            //Create new instance of sql connection, pass in the connection string for BayOneSurgerySystem.mdf to connect to database.
            SqlConnection conn = new SqlConnection(@""Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\davie\Documents\UniWork\Software Engineering\BayOneSurgerySystem1.0\Database\BayOneSystem.mdf;Integrated Security=True;Connect Timeout=30"");

            //Create new instance of SQlCommand and pass in a query to be called to retrieve table data for username and passwords aswell as the connection object.
            SqlCommand cmd = new SqlCommand(""SELECT * FROM Users WHERE Username = @username and Password = @password"", conn);
            //This passes user input into @username and @password
            cmd.Parameters.AddWithValue(""@username"", txtBoxUsername.Text);
            cmd.Parameters.AddWithValue(""@password"", txtBoxPassword.Text);

            //Open connection with database
            conn.Open();

            //Create new instance of dataSet to hold the data retrieved from sql query
            DataSet ds = new DataSet();
            //Create new instance of DataAdpater to retrieve the data pass in Sql command
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            //using DataAdapter fill in dataSet wiht data if user input and stored data matches
            da.Fill(ds);

            //Close the connection now data table is filled with username and password
            conn.Close();

            //declare bool, true if there is a match with database and user input
            bool loginSuccess = (ds.Tables[0].Rows.Count == 1);


            //if login success is true then open menu
            if (loginSuccess)
            {
                /*Change state of enum RoleTypes based on result from dataSet Role_ID column.
                 In UserRole table records are as follows: 
                 Role_ID 1 = PracticeManager
                 2 = Doctor
                 3 = Receptionist*/

                //Print role_ID to console to check that is been set.
                Console.WriteLine(ds.Tables[0].Rows[0][""Role_ID""]);

                try
                {
                    //Condition for the switch statement is: check Role_ID from UserRoles table
                    switch (ds.Tables[0].Rows[0][""Role_ID""])
                    {
                        //if the case is that Role_ID for the user logged in is 1 then run the function etc.
                        case 1:
                            {
                                Roles.Role = Roles.RoleType.practiceManager;
                                Console.WriteLine(""Role type changed to "" + Roles.Role);
                            }
                            break;
                        case 2:
                            {
                                Roles.Role = Roles.RoleType.doctor;
                                Console.WriteLine(""Role type changed to "" + Roles.Role);
                            }
                            break;
                        case 3:
                            {
                                Roles.Role = Roles.RoleType.receptionist;
                                Console.WriteLine(""Role type changed to "" + Roles.Role);
                            }
                            break;
                        default:
                            break;

                    }
                }//Switch condition cannot be reached then catch exception and print to console.
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }


                Console.WriteLine(""Logged in."");
                FrmMenu menu = new FrmMenu();
                menu.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show(""Invalid username or password."", ""Error!"", MessageBoxButtons.RetryCancel);
                Console.WriteLine(""Not logged in"");
            }


        }

        //If connection cant be opened diplsay error message and catch exception and print to console
        catch (Exception ex)
        {
            Console.WriteLine(ex);
            MessageBox.Show(""Sorry can't connect"");
        }



    }

}
</code></pre>

<p>}</p>

<p><strong>Role class</strong></p>

<pre><code> public static class Roles
{
    /*The RoleType enum is declared here and changed in form login. RoleType is the condition for button visibility
    I.e if roletype is doctor, show doctor buttons*/
    public static RoleType Role;
    public enum RoleType
    {
        practiceManager,
        doctor,
        receptionist

    }


}
</code></pre>

<p><strong>Patient form</strong></p>

<pre><code>//if this is clicked, display yesNo messagebox. If yes, logout.
    private void btnLogout_Click(object sender, EventArgs e)
    {
        if (MessageBox.Show(""Are you sure?"", ""Exit"", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
        {
            FrmLogin logout = new FrmLogin();
            logout.Show();
            this.Close();
        }
    }

    private void FrmPatients_Load(object sender, EventArgs e)
    {

        /*Buttons are visible depending on access level. Permissions are as follows:
         * Practice Manager - Patient Records
           Doctor - Register Patient, Patient notes
           Receptionist - New Patient, Register Patient*/
        if (Roles.Role == Roles.RoleType.practiceManager)
        {
            this.btnNewPatient.Visible = false;
            this.btnNotes.Visible = false;
            this.btnSignIn.Visible = false;

        }

        else if (Roles.Role == Roles.RoleType.doctor)
        {
            this.btnNewPatient.Visible = false;
        }
        else
        {
            this.btnNotes.Visible = false;
        }

    }

    //if this is clicked return to main menu
    private void pcBxBack_Click(object sender, EventArgs e)
    {
        FrmMenu menu = new FrmMenu();
        this.Close();
        menu.Show();
    }
}
</code></pre>

<p>}</p>

<p><strong>Test class</strong></p>

<pre><code> [TestClass]

     public class LoginTests
     {
       [TestMethod]
         public void Constuctor_NormalData_Login_Is_Successful()
         {

            //Arrange
            //Act
            //Assert
          }


        [TestMethod]
        public void Constructor_RoleTypeEnum_RoleType_Changes()
        {
           //Arrange
           //Act
           //Assert

         }


       }
</code></pre>

<p>Any advice on what you would use automated testing for?</p>

<p>I've got a manual table with 21 tests validating all messageboxes, button click events and button visibility. </p>

<p>For an A I really need some automated testing. As you can see I've got template for testing role type enum and login succesful, those are the only 2 obvious methods to test that I can see. </p>

<p>Thanks in advance!</p>
",https://stackoverflow.com/questions/53657417/how-do-you-know-whether-to-automate-testing-or-use-manual,"['c#', 'winforms', 'automated-tests']",70,TRUE,1,1
Using only php to decrypt zend-crypt hybrid,"<p>I'm developing an API that to return sensitive data will require a sort of handshake, which will return a public key for the client to encrypt the information before sending it to the API.</p>

<p>For the API I am using expressive zend and to perform the handshake, I am using the zend-crypt module, more specifically Hybrid encryption.</p>

<p>the workflow is more or less the following:</p>

<p>The client application sends a public key to the api.
The API uses this public key to encrypt, using hybrid encryption, the public key provided by the server.
The public key of the encrypted server is returned to the client
The client must decrypt the key to be able to use it for cryptography of sensitive data.</p>

<p>Below is the source code that performs public key cryptography:</p>

<pre><code>$publicKeyStr = $request-&gt;getHeader('hello');

try {
    $publicKey = new \Zend\Crypt\PublicKey\Rsa\PublicKey(base64_decode($publicKeyStr[0]));

    $b64Key = base64_encode($this-&gt;crypto-&gt;getPublicKey());

    $hybridCrypt = new \Zend\Crypt\Hybrid();

    $serverPk = $hybridCrypt-&gt;encrypt($b64Key, $publicKey);   

    return new \Zend\Diactoros\Response\JsonResponse(array('hello'=&gt;$serverPk));
} catch (\Zend\Crypt\PublicKey\Rsa\Exception\RuntimeException $ex) {
    return new \Zend\Diactoros\Response\EmptyResponse(\Fig\Http\Message\StatusCodeInterface::STATUS_UNAUTHORIZED);
}
</code></pre>

<p>My question is this:
How do I decrypt this public key on a client that does not use the framework, pure PHP only, for example?</p>

<p>Since this API can be used for mobile application development or desktop software, I need to understand the logic to decrypt to be able to perform tests on different platforms.</p>

<p>I am currently performing integration testing of this middleware using Codeception, and the test code is this:</p>

<pre><code>public function testPublicKeyAccess(ApiTester $I)
{
    $I-&gt;wantTo('Test if API return a valid public key');

    $I-&gt;am('Client');
    $I-&gt;amBearerAuthenticated($this-&gt;token);
    $I-&gt;haveHttpHeader('hello', base64_encode($this-&gt;publicKey));
    $I-&gt;sendGET('/handshake');


    $I-&gt;seeResponseCodeIs(200);
    $I-&gt;seeResponseContainsJson();

    $response = json_decode($I-&gt;grabResponse());

    list($encryptedKeys, $msg) = explode(';', $response-&gt;hello);
    $keysArr = explode(':', $encryptedKeys);
    $encryptedKey = base64_decode($keysArr[1]);

    // Decrypt $envKey, this works

    $envKey = '';
    openssl_private_decrypt($encryptedKey, $envKey,  $this-&gt;privateKey, OPENSSL_PKCS1_OAEP_PADDING);

    // Decrypt public key, this don't works
    $cipher = 'aes-256-cbc';
    $hmacSize = 46;
    $hmac = mb_substr($msg, 0, $hmacSize, '8bit');

    $ivSize = 32; //openssl_cipher_iv_length($cipher);
    $iv = mb_substr($msg, $hmacSize, $ivSize, '8bit'); // 64

    $cipherText = base64_decode(mb_substr($msg, $hmacSize+$ivSize, null, '8bit'));

    $serverKey = '';

    codecept_debug(var_dump($ivSize));

    openssl_open($cipherText, $serverKey, $envKey, $this-&gt;privateKey, $cipher, $ivSize);
    codecept_debug(var_dump($cipherText));
    codecept_debug(var_dump($serverKey));

    $I-&gt;assertRegExp('/-----BEGIN PUBLIC KEY-----(.*)-----END PUBLIC KEY-----/s', $serverKey);
}
</code></pre>
",https://stackoverflow.com/questions/53381513/using-only-php-to-decrypt-zend-crypt-hybrid,"['php', 'encryption', 'zend-framework', 'openssl', 'mezzio']",316,FALSE,0,0
Ember &amp; Cypress | Integration test failing likely due to lack of store context,"<p>I am working with Ember.js on the frontend and using Cypress.io for integration testing. I have a ""Order Status"" button that upon click is supposed to use data within the store to access the specific order and navigate to the Order Status page. </p>

<p>However within the test, upon click from the modal, the Order Status page cannot load and my test throws <a href=""https://i.stack.imgur.com/JQqoh.png"" rel=""nofollow noreferrer"">this error</a>:</p>

<blockquote>
  <p>TypeError: Cannot read property ‘_internalModel’ of null</p>
</blockquote>

<p>...in the console, which I think likely has to do with that route's model not finding the order from within the store and loading.</p>

<p>In the Cypress test, I've created the necessary routes to pass in session data, but am struggling to understand if the lack of store data is throwing this error, and how to fix it. It is important to note that this whole flow works 100% on its own - I'm just trying to get test coverage.</p>

<p>I'll attach snippets from the relevant files / functions below -- please do let me know if more information is needed. I really suspect that Cypress cannot access the Ember store, but after much research and experimenting, I'm not exactly sure what the issue is.</p>

<p><strong>order-status.js</strong> - model function from route</p>

<pre><code>async model({ order_id: orderId }) {
    let cachedOrder = this.get('store').peekRecord('order', orderId);
    return cachedOrder
      ? cachedOrder
      : await this.get('store').findRecord('order', orderId);
  },
</code></pre>

<p><strong>modal.hbs</strong> - where we navigate from current page to order-status route</p>

<pre><code>&lt;fieldset&gt;
  &lt;span class=""modal-text""&gt;See order status&lt;/span&gt;
  &lt;div class=""inline-button-wrap""&gt;
    &lt;button 
      {{action 'decline'}} 
      class=""close-btn button-hollow-green""&gt;
        Close
    &lt;/button&gt;
    &lt;button 
      {{action 'accept'}} 
      class=""order-status-btn""&gt;
       Order Status
     &lt;/button&gt;
  &lt;/div&gt;
&lt;/fieldset&gt;
</code></pre>

<p><strong>test.js</strong> - test that simulates clicking order status button above</p>

<pre><code>it('order status btn navigates to order status page', () =&gt; {
  cy.server();
  cy.route('GET', '/api/session', sessionResponse);
  cy.route('GET', `/api/orders/*`, order);
  cy.visit('/');
  cy.get('.delivery-card .button-cta').click(); //opens modal 
  cy.get('#modal .order-status-btn').click(); //navigates to order-status
});
</code></pre>

<p>Thanks so much for your help.</p>
",https://stackoverflow.com/questions/53422339/ember-cypress-integration-test-failing-likely-due-to-lack-of-store-context,"['ember.js', 'integration-testing', 'cypress']",1260,FALSE,2,1
NUnit Integration Tests on Web API - how to create/destroy integration test db,"<p>I'm implementing <code>NUnit Integration Tests</code> of our controller REST endpoints in a <code>.NET Web API 2</code> project. We use an <code>Entity Framework</code> <code>code-first from database</code> approach to create our controllers and models.</p>

<p>I've got the <code>myProjectIntegrationTests</code> project set up, with <code>NUnit</code> installed and a reference to <code>myProject</code>.</p>

<p>From my research, the next step is to create a <code>TestSetup</code> script which, on each test, creates an <code>Integration Tests Database</code> in a <code>LocalDb</code>. This allows us to integration test our API calls without affecting the master <code>dev database</code>.</p>

<p><strong>This <code>TestSetup</code> script should do several things each time a test runs:</strong><br>
- check if a connection is currently open in <code>Integration Test Db</code> - if so, close it.<br>
- check if an existing <code>Integration Test db</code> exists - if so, tear it down.<br>
- run a migration from my master <code>dev database</code> to my <code>Integration Test Db</code> to load it with real data.<br>
- create a new instance of <code>Integration Test Db</code><br>
- integration tests run...<br>
- close <code>Integration Test Db</code> connections<br>
- teardown <code>Integration Test Db</code>  </p>

<p>Creating this <code>TestSetup</code> class is what's giving me trouble. I've found tutorials on how to do this for .NET MVC, .NET Core and also Entity Framework - but none of these seem to be utilizing just <code>.Net Web API</code>, so some of the libraries and code being referenced isn't working for me. <strong>Can someone provide an example script or tutorial link that might work in <code>.NET Web API 2</code>?</strong></p>

<p><br/></p>

<p>Here's an example of someone doing this for EntityFramework, using I believe <code>.Net Core</code>. This is part of a great PluralSight tutorial on integration testing in Entity Framework by Michael Perry, found <a href=""https://app.pluralsight.com/library/courses/entity-framework-applications-integration-testing/table-of-contents"" rel=""nofollow noreferrer"">here</a>:  </p>

<pre><code>using Globalmantics.DAL;
using Globalmantics.DAL.Migrations;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Data.E  ntity;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Reflection;

namespace Globalmantics.IntegrationTests
{
    [SetUpFixture]
    public class TestSetup
    {
        [OneTimeSetUp]
        public void SetUpDatabase()
        {
            DestroyDatabase();
            CreateDatabase();
        }

        [OneTimeTearDown]
        public void TearDownDatabase()
        {
            DestroyDatabase();
        }

        private static void CreateDatabase()
        {
            ExecuteSqlCommand(Master, $@""
                CREATE DATABASE [Globalmantics]
                ON (NAME = 'Globalmantics',
                FILENAME = '{Filename}')"");

            var migration = new MigrateDatabaseToLatestVersion&lt;
                GlobalmanticsContext, GlobalmanticsConfiguration&gt;();
            migration.InitializeDatabase(new GlobalmanticsContext());
        }

        private static void DestroyDatabase()
        {
            var fileNames = ExecuteSqlQuery(Master, @""
                SELECT [physical_name] FROM [sys].[master_files]
                WHERE [database_id] = DB_ID('Globalmantics')"",
                row =&gt; (string)row[""physical_name""]);

            if (fileNames.Any())
            {
                ExecuteSqlCommand(Master, @""
                    ALTER DATABASE [Globalmantics] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
                    EXEC sp_detach_db 'Globalmantics'"");

                fileNames.ForEach(File.Delete);
            }
        }

        private static void ExecuteSqlCommand(
            SqlConnectionStringBuilder connectionStringBuilder,
            string commandText)
        {
            using (var connection = new SqlConnection(connectionStringBuilder.ConnectionString))
            {
                connection.Open();
                using (var command = connection.CreateCommand())
                {
                    command.CommandText = commandText;
                    command.ExecuteNonQuery();
                }
            }
        }

        private static List&lt;T&gt; ExecuteSqlQuery&lt;T&gt;(
            SqlConnectionStringBuilder connectionStringBuilder,
            string queryText,
            Func&lt;SqlDataReader, T&gt; read)
        {
            var result = new List&lt;T&gt;();
            using (var connection = new SqlConnection(connectionStringBuilder.ConnectionString))
            {
                connection.Open();
                using (var command = connection.CreateCommand())
                {
                    command.CommandText = queryText;
                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            result.Add(read(reader));
                        }
                    }
                }
            }
            return result;
        }

        private static SqlConnectionStringBuilder Master =&gt;
            new SqlConnectionStringBuilder
            {
                DataSource = @""(LocalDB)\MSSQLLocalDB"",
                InitialCatalog = ""master"",
                IntegratedSecurity = true
            };

        private static string Filename =&gt; Path.Combine(
            Path.GetDirectoryName(
                Assembly.GetExecutingAssembly().Location),
            ""Globalmantics.mdf"");
    }
}
</code></pre>

<p>And here's an older example of someone doing this for <code>.Net MVC</code>:</p>

<pre><code>using System;
using System.Data.Entity;
using NUnit.Framework;

namespace BankingSite.IntegrationTests
{
    [SetUpFixture]
    public class TestFixtureLifecycle
    {
        public TestFixtureLifecycle()
        {
            EnsureDataDirectoryConnectionStringPlaceholderIsSet();

            EnsureNoExistingDatabaseFiles();
        }

        private static void EnsureDataDirectoryConnectionStringPlaceholderIsSet()
        {
            // When not running inside MVC application the |DataDirectory| placeholder 
            // is null in a connection string, e.g AttachDBFilename=|DataDirectory|\TestBankingSiteDb.mdf

            AppDomain.CurrentDomain.SetData(""DataDirectory"", NUnit.Framework.TestContext.CurrentContext.TestDirectory);
        }

        private void EnsureNoExistingDatabaseFiles()
        {
            const string connectionString = ""name=DefaultConnection"";

            if (Database.Exists(connectionString))
            {                
                Database.Delete(connectionString);    
            }           
        }
    }
}
</code></pre>
",https://stackoverflow.com/questions/52936781/nunit-integration-tests-on-web-api-how-to-create-destroy-integration-test-db,"['sql-server', 'unit-testing', 'asp.net-web-api', 'nunit', 'integration-testing']",1648,TRUE,0,2
"Adding role to user, getting a SQL timeout","<p>In my application (MVC/WebAPI, using Owin) I've setup integration testing using a localDB. In one of my tests I seem to be able to query data from the UserManager, but I can't update any data.</p>

<p><strong>ApplicationUserManager setup:</strong></p>

<pre><code>public class ApplicationUserManager : UserManager&lt;ApplicationUser&gt;
{
    public ApplicationUserManager(IUserStore&lt;ApplicationUser&gt; store) : base(store)
    {
        UserValidator = new UserValidator&lt;ApplicationUser&gt;(this)
        {
            AllowOnlyAlphanumericUserNames = false,
            RequireUniqueEmail = true
        };

        PasswordValidator = new PasswordValidator
        {
            RequiredLength = 6,
            RequireNonLetterOrDigit = true,
            RequireDigit = true,
            RequireLowercase = true,
            RequireUppercase = true,
        };

        UserLockoutEnabledByDefault = true;
        DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5);
        MaxFailedAccessAttemptsBeforeLockout = 5;
    }
}
</code></pre>

<p><strong>Unity Setup:</strong></p>

<pre><code>container
    .RegisterType&lt;DbContext, ApplicationDbContext&gt;()
    .RegisterType&lt;IUserStore&lt;ApplicationUser&gt;, UserStore&lt;ApplicationUser&gt;&gt;()
    .RegisterType&lt;IAuthenticationManager&gt;(new InjectionFactory(o =&gt; HttpContext.Current.GetOwinContext().Authentication))
    .RegisterType&lt;IRoleStore&lt;IdentityRole, string&gt;, RoleStore&lt;IdentityRole, string, IdentityUserRole&gt;&gt;()
    .RegisterType&lt;ApplicationUserManager&gt;()
    .RegisterType&lt;ApplicationSignInManager&gt;()
    .RegisterType&lt;ApplicationRoleManager&gt;()
</code></pre>

<p><strong>Code being tested:</strong></p>

<pre><code>//Working
var user = await _applicationUserManager.FindByIdAsync(userId);
//SQL timeout
identityResult = await _applicationUserManager.AddToRoleAsync(user.Id, Roles.User);
</code></pre>

<p>I've tried other updates (like updating the username), but none of it seems to be working. When I call the same functionality while using the website (or in an API call using Postman) everything is working just fine.</p>

<p>Any suggestions?</p>

<p><strong>Update 1:</strong></p>

<p>When I raise my sql timeout setting to 180 seconds, I'm able to get past the first usermanager update (after waiting about 60 seconds). Any following call to the database fails with a provider failed on open. </p>

<p><strong>Update 2:</strong></p>

<p>I've tested localdb performance in the same method:</p>

<pre><code>for (int i = 0; i &lt; 1000; i++)
{
    _test.LogError(new System.Exception(), Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
}
</code></pre>

<p>This operation (1000 inserts with varying data) takes about 1 second to complete.</p>

<p><strong>Update 3:</strong></p>

<p>When I pause the test after updating the user, I can't reach the database in SSMS anymore. It seems to be in a locked state.</p>

<p><strong>Update 4:</strong></p>

<p>For testing purposes I've written the update code in the usermanager myself. I'm not getting a timeout anymore, but the it seems to keep a connection or transaction open. While running the following code I can't seem to select anything from the user table in SSMS anymore.</p>

<pre><code>var userToUpgrade = _context.Users.Single(user =&gt; user.Id == userId);

foreach (var role in userToUpgrade.Roles.ToList())
{
    userToUpgrade.Roles.Remove(role);
}

userToUpgrade.Roles.Add(new IdentityUserRole
{
    UserId = userId,
    RoleId = _context.Roles.Single(role =&gt; role.Name == Roles.TestUser).Id
});

_context.Entry(userToUpgrade).State = EntityState.Modified;
_context.SaveChanges();
</code></pre>
",https://stackoverflow.com/questions/48103814/adding-role-to-user-getting-a-sql-timeout,"['c#', 'asp.net-web-api', 'integration-testing', 'owin', 'localdb']",206,TRUE,0,1
In the TDD how do you write tests for code that inherently have side effects?,"<p>If a function's side effects are inherent within the design how do I develop such a function?</p>

<p>For instance if I wanted to implement a function like http.get( ""url"" ), and I stubbed the side effects as a service with dependency injection it would look like:</p>

<pre><code>var http = {
  ""get"": function( url, service ) {
    return promise(function( resolve ) {
      service( url ).then(function( Response ) {
        resolve( Response );
      });
    });
  }
}
</code></pre>

<p>...but I would then need to implement the service which is identical to the original http.get(url) and therefore would have the same side effects and therefore put me in a development loop. Do I have to mock a server to test such a function and if so what part of the TDD development cycle does that fall under? Is it integration testing, or is it still unit testing?</p>

<p>Another example would be a model for a database. If I'm developing code that works with a database, I'll design an interface, abstract a model implementing that interface, and pass it into my code using dependency injection. As long as my model implements the interface I can use any database and easily stub it's state and responses to implement TDD for other functions which interact with a database. What about that model though? It's going to interact with a database- it seems like that side effect is inherent within the design, and abstracting it away puts me into a development loop when I go to implement that abstraction. How do I implement the model's methods without being able to abstract them away?</p>
",https://stackoverflow.com/questions/49418491/in-the-tdd-how-do-you-write-tests-for-code-that-inherently-have-side-effects,"['tdd', 'side-effects']",1249,TRUE,6,2
Create temporary tables in read only transaction - MYSQL 5.7,"<p>I am currently assisting with integration testing for migrating an application that currently runs against a mysql 5.5 DB to mysql 5.7. We have run into issues related to functionality that was optimised in mysql 5.5 to run about 30% faster by having certain parts be encapsulated in a read only transaction now throwing the below error:</p>

<blockquote>
  <p>Error Code: 1792 Cannot execute statement in a READ ONLY transaction.</p>
</blockquote>

<p>I have scoured the internet and havent found any solutions. I know there is a related limitation added in mysql 5.6 <a href=""https://dev.mysql.com/doc/refman/5.6/en/commit.html"" rel=""nofollow noreferrer"">documentation</a> that mentions:</p>

<blockquote>
  <p>""In read-only mode, it remains possible to change tables created with
  the TEMPORARY keyword using DML statements. Changes made with DDL
  statements are not permitted, just as with permanent tables.""</p>
</blockquote>

<p>This presents a major limitation to us as some of these read only transactions call stored procedures that create temporary tables and it is not feasible for us to rewrite the application as this read only optimisation is widespread.</p>

<p>Essentially we are hoping to find a work around or a configuration we can tweak to allow the below example to not give a read only error.</p>

<pre><code>START TRANSACTION READ only;
CREATE TEMPORARY TABLE IF NOT EXISTS table1 (account_id INT(10) UNSIGNED);
ROLLBACK;
</code></pre>

<p>Creating the table beforehand is not an option, mysql server session variables below if required. Any help would be much appreciated!</p>

<p>Session Variables:</p>

<pre><code>Variable_name   Value
auto_increment_increment    1
auto_increment_offset   1
autocommit  ON
automatic_sp_privileges ON
avoid_temporal_upgrade  OFF
back_log    80
basedir C:\\Program Files\\MySQL\\MySQL Server 5.7\\
big_tables  OFF
bind_address    *
binlog_cache_size   32768
binlog_checksum CRC32
binlog_direct_non_transactional_updates OFF
binlog_error_action ABORT_SERVER
binlog_format   ROW
binlog_group_commit_sync_delay  0
binlog_group_commit_sync_no_delay_count 0
binlog_gtid_simple_recovery ON
binlog_max_flush_queue_time 0
binlog_order_commits    ON
binlog_row_image    FULL
binlog_rows_query_log_events    OFF
binlog_stmt_cache_size  32768
binlog_transaction_dependency_history_size  25000
binlog_transaction_dependency_tracking  COMMIT_ORDER
block_encryption_mode   aes-128-ecb
bulk_insert_buffer_size 8388608
character_set_client    utf8
character_set_connection    utf8
character_set_database  utf8
character_set_filesystem    binary
character_set_results   utf8
character_set_server    utf8
character_set_system    utf8
character_sets_dir  C:\\Program Files\\MySQL\\MySQL Server 5.7\\share\\charsets\\
check_proxy_users   OFF
collation_connection    utf8_general_ci
collation_database  utf8_general_ci
collation_server    utf8_general_ci
completion_type NO_CHAIN
concurrent_insert   AUTO
connect_timeout 10
core_file   OFF
datadir C:\\ProgramData\\MySQL\\MySQL Server 5.7\\Data\\
date_format %Y-%m-%d
datetime_format %Y-%m-%d %H:%i:%s
default_authentication_plugin   mysql_native_password
default_password_lifetime   0
default_storage_engine  InnoDB
default_tmp_storage_engine  InnoDB
default_week_format 0
delay_key_write ON
delayed_insert_limit    100
delayed_insert_timeout  300
delayed_queue_size  1000
disabled_storage_engines    
disconnect_on_expired_password  ON
div_precision_increment 4
end_markers_in_json OFF
enforce_gtid_consistency    OFF
eq_range_index_dive_limit   200
error_count 0
event_scheduler OFF
expire_logs_days    0
explicit_defaults_for_timestamp OFF
external_user   
flush   OFF
flush_time  0
foreign_key_checks  ON
ft_boolean_syntax   ""+ -&gt;&lt;()~*:""""""""&amp;|""
ft_max_word_len 84
ft_min_word_len 4
ft_query_expansion_limit    20
ft_stopword_file    (built-in)
general_log OFF
general_log_file    DESKTOP-11VS9FN.log
group_concat_max_len    1024
gtid_executed_compression_period    1000
gtid_mode   OFF
gtid_next   AUTOMATIC
gtid_owned  
gtid_purged 
have_compress   YES
have_crypt  NO
have_dynamic_loading    YES
have_geometry   YES
have_openssl    DISABLED
have_profiling  YES
have_query_cache    YES
have_rtree_keys YES
have_ssl    DISABLED
have_statement_timeout  YES
have_symlink    YES
host_cache_size 279
hostname    BLUEOA-LP005
identity    0
ignore_builtin_innodb   OFF
ignore_db_dirs  
init_connect    
init_file   
init_slave  
innodb_adaptive_flushing    ON
innodb_adaptive_flushing_lwm    10
innodb_adaptive_hash_index  ON
innodb_adaptive_hash_index_parts    8
innodb_adaptive_max_sleep_delay 150000
innodb_api_bk_commit_interval   5
innodb_api_disable_rowlock  OFF
innodb_api_enable_binlog    OFF
innodb_api_enable_mdl   OFF
innodb_api_trx_level    0
innodb_autoextend_increment 64
innodb_autoinc_lock_mode    1
innodb_buffer_pool_chunk_size   8388608
innodb_buffer_pool_dump_at_shutdown ON
innodb_buffer_pool_dump_now OFF
innodb_buffer_pool_dump_pct 25
innodb_buffer_pool_filename ib_buffer_pool
innodb_buffer_pool_instances    1
innodb_buffer_pool_load_abort   OFF
innodb_buffer_pool_load_at_startup  ON
innodb_buffer_pool_load_now OFF
innodb_buffer_pool_size 8388608
innodb_change_buffer_max_size   25
innodb_change_buffering all
innodb_checksum_algorithm   crc32
innodb_checksums    ON
innodb_cmp_per_index_enabled    OFF
innodb_commit_concurrency   0
innodb_compression_failure_threshold_pct    5
innodb_compression_level    6
innodb_compression_pad_pct_max  50
innodb_concurrency_tickets  5000
innodb_data_file_path   ibdata1:12M:autoextend
innodb_data_home_dir    
innodb_deadlock_detect  ON
innodb_default_row_format   dynamic
innodb_disable_sort_file_cache  OFF
innodb_doublewrite  ON
innodb_fast_shutdown    1
innodb_file_format  Barracuda
innodb_file_format_check    ON
innodb_file_format_max  Barracuda
innodb_file_per_table   ON
innodb_fill_factor  100
innodb_flush_log_at_timeout 1
innodb_flush_log_at_trx_commit  1
innodb_flush_method 
innodb_flush_neighbors  1
innodb_flush_sync   ON
innodb_flushing_avg_loops   30
innodb_force_load_corrupted OFF
innodb_force_recovery   0
innodb_ft_aux_table 
innodb_ft_cache_size    8000000
innodb_ft_enable_diag_print OFF
innodb_ft_enable_stopword   ON
innodb_ft_max_token_size    84
innodb_ft_min_token_size    3
innodb_ft_num_word_optimize 2000
innodb_ft_result_cache_limit    2000000000
innodb_ft_server_stopword_table 
innodb_ft_sort_pll_degree   2
innodb_ft_total_cache_size  640000000
innodb_ft_user_stopword_table   
innodb_io_capacity  200
innodb_io_capacity_max  2000
innodb_large_prefix ON
innodb_lock_wait_timeout    50
innodb_locks_unsafe_for_binlog  OFF
innodb_log_buffer_size  1048576
innodb_log_checksums    ON
innodb_log_compressed_pages ON
innodb_log_file_size    50331648
innodb_log_files_in_group   2
innodb_log_group_home_dir   .\\
innodb_log_write_ahead_size 8192
innodb_lru_scan_depth   1024
innodb_max_dirty_pages_pct  75
innodb_max_dirty_pages_pct_lwm  0
innodb_max_purge_lag    0
innodb_max_purge_lag_delay  0
innodb_max_undo_log_size    1073741824
innodb_monitor_disable  
innodb_monitor_enable   
innodb_monitor_reset    
innodb_monitor_reset_all    
innodb_old_blocks_pct   37
innodb_old_blocks_time  1000
innodb_online_alter_log_max_size    134217728
innodb_open_files   300
innodb_optimize_fulltext_only   OFF
innodb_page_cleaners    1
innodb_page_size    16384
innodb_print_all_deadlocks  OFF
innodb_purge_batch_size 300
innodb_purge_rseg_truncate_frequency    128
innodb_purge_threads    4
innodb_random_read_ahead    OFF
innodb_read_ahead_threshold 56
innodb_read_io_threads  4
innodb_read_only    OFF
innodb_replication_delay    0
innodb_rollback_on_timeout  OFF
innodb_rollback_segments    128
innodb_sort_buffer_size 1048576
innodb_spin_wait_delay  6
innodb_stats_auto_recalc    ON
innodb_stats_include_delete_marked  OFF
innodb_stats_method nulls_equal
innodb_stats_on_metadata    OFF
innodb_stats_persistent ON
innodb_stats_persistent_sample_pages    20
innodb_stats_sample_pages   8
innodb_stats_transient_sample_pages 8
innodb_status_output    OFF
innodb_status_output_locks  OFF
innodb_strict_mode  OFF
innodb_support_xa   ON
innodb_sync_array_size  1
innodb_sync_spin_loops  30
innodb_table_locks  ON
innodb_temp_data_file_path  ibtmp1:12M:autoextend
innodb_thread_concurrency   9
innodb_thread_sleep_delay   0
innodb_tmpdir   
innodb_undo_directory   .\\
innodb_undo_log_truncate    OFF
innodb_undo_logs    128
innodb_undo_tablespaces 0
innodb_use_native_aio   ON
innodb_version  5.7.22
innodb_write_io_threads 4
insert_id   0
interactive_timeout 28800
internal_tmp_disk_storage_engine    InnoDB
join_buffer_size    262144
keep_files_on_create    OFF
key_buffer_size 8388608
key_cache_age_threshold 300
key_cache_block_size    1024
key_cache_division_limit    100
keyring_operations  ON
large_files_support ON
large_page_size 0
large_pages OFF
last_insert_id  0
lc_messages en_US
lc_messages_dir C:\\Program Files\\MySQL\\MySQL Server 5.7\\share\\
lc_time_names   en_US
license GPL
local_infile    ON
lock_wait_timeout   31536000
log_bin OFF
log_bin_basename    
log_bin_index   
log_bin_trust_function_creators OFF
log_bin_use_v1_row_events   OFF
log_builtin_as_identified_by_password   OFF
log_error   .\\DESKTOP-11VS9FN.err
log_error_verbosity 3
log_output  FILE
log_queries_not_using_indexes   OFF
log_slave_updates   OFF
log_slow_admin_statements   OFF
log_slow_slave_statements   OFF
log_statements_unsafe_for_binlog    ON
log_syslog  ON
log_syslog_tag  
log_throttle_queries_not_using_indexes  0
log_timestamps  UTC
log_warnings    2
long_query_time 10
low_priority_updates    OFF
lower_case_file_system  ON
lower_case_table_names  1
master_info_repository  FILE
master_verify_checksum  OFF
max_allowed_packet  173741056
max_binlog_cache_size   1.84467E+19
max_binlog_size 1073741824
max_binlog_stmt_cache_size  1.84467E+19
max_connect_errors  100
max_connections 151
max_delayed_threads 20
max_digest_length   1024
max_error_count 64
max_execution_time  0
max_heap_table_size 70254592
max_insert_delayed_threads  20
max_join_size   1.84467E+19
max_length_for_sort_data    1024
max_points_in_geometry  65536
max_prepared_stmt_count 16382
max_relay_log_size  0
max_seeks_for_key   4294967295
max_sort_length 1024
max_sp_recursion_depth  0
max_tmp_tables  32
max_user_connections    0
max_write_lock_count    4294967295
metadata_locks_cache_size   1024
metadata_locks_hash_instances   8
min_examined_row_limit  0
multi_range_count   256
myisam_data_pointer_size    6
myisam_max_sort_file_size   1.07374E+11
myisam_mmap_size    1.84467E+19
myisam_recover_options  OFF
myisam_repair_threads   1
myisam_sort_buffer_size 8388608
myisam_stats_method nulls_unequal
myisam_use_mmap OFF
mysql_native_password_proxy_users   OFF
named_pipe  OFF
net_buffer_length   16384
net_read_timeout    30
net_retry_count 10
net_write_timeout   60
new OFF
ngram_token_size    2
offline_mode    OFF
old OFF
old_alter_table OFF
old_passwords   0
open_files_limit    6209
optimizer_prune_level   1
optimizer_search_depth  62
optimizer_switch    ""index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,duplicateweedout=on,subquery_materialization_cost_based=on,use_index_extensions=on,condition_fanout_filter=on,derived_merge=on""
optimizer_trace ""enabled=off,one_line=off""
optimizer_trace_features    ""greedy_search=on,range_optimizer=on,dynamic_range=on,repeated_subselect=on""
optimizer_trace_limit   1
optimizer_trace_max_mem_size    16384
optimizer_trace_offset  -1
parser_max_mem_size 1.84467E+19
performance_schema  ON
performance_schema_accounts_size    -1
performance_schema_digests_size 10000
performance_schema_events_stages_history_long_size  10000
performance_schema_events_stages_history_size   10
performance_schema_events_statements_history_long_size  10000
performance_schema_events_statements_history_size   10
performance_schema_events_transactions_history_long_size    10000
performance_schema_events_transactions_history_size 10
performance_schema_events_waits_history_long_size   10000
performance_schema_events_waits_history_size    10
performance_schema_hosts_size   -1
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances   -1
performance_schema_max_digest_length    1024
performance_schema_max_file_classes 80
performance_schema_max_file_handles 32768
performance_schema_max_file_instances   -1
performance_schema_max_index_stat   -1
performance_schema_max_memory_classes   320
performance_schema_max_metadata_locks   -1
performance_schema_max_mutex_classes    210
performance_schema_max_mutex_instances  -1
performance_schema_max_prepared_statements_instances    -1
performance_schema_max_program_instances    -1
performance_schema_max_rwlock_classes   40
performance_schema_max_rwlock_instances -1
performance_schema_max_socket_classes   10
performance_schema_max_socket_instances -1
performance_schema_max_sql_text_length  1024
performance_schema_max_stage_classes    150
performance_schema_max_statement_classes    193
performance_schema_max_statement_stack  10
performance_schema_max_table_handles    -1
performance_schema_max_table_instances  -1
performance_schema_max_table_lock_stat  -1
performance_schema_max_thread_classes   50
performance_schema_max_thread_instances -1
performance_schema_session_connect_attrs_size   512
performance_schema_setup_actors_size    -1
performance_schema_setup_objects_size   -1
performance_schema_users_size   -1
pid_file    C:\\ProgramData\\MySQL\\MySQL Server 5.7\\Data\\BLUEOA-LP005.pid
plugin_dir  C:\\Program Files\\MySQL\\MySQL Server 5.7\\lib\\plugin\\
port    3306
preload_buffer_size 32768
profiling   OFF
profiling_history_size  15
protocol_version    10
proxy_user  
pseudo_slave_mode   OFF
pseudo_thread_id    503
query_alloc_block_size  8192
query_cache_limit   1048576
query_cache_min_res_unit    4096
query_cache_size    1048576
query_cache_type    OFF
query_cache_wlock_invalidate    OFF
query_prealloc_size 8192
rand_seed1  0
rand_seed2  0
range_alloc_block_size  4096
range_optimizer_max_mem_size    8388608
rbr_exec_mode   STRICT
read_buffer_size    8192
read_only   OFF
read_rnd_buffer_size    1
relay_log   
relay_log_basename  C:\\ProgramData\\MySQL\\MySQL Server 5.7\\Data\\BLUEOA-LP005-relay-bin
relay_log_index C:\\ProgramData\\MySQL\\MySQL Server 5.7\\Data\\BLUEOA-LP005-relay-bin.index
relay_log_info_file relay-log.info
relay_log_info_repository   FILE
relay_log_purge ON
relay_log_recovery  OFF
relay_log_space_limit   0
report_host 
report_password 
report_port 3306
report_user 
require_secure_transport    OFF
rpl_stop_slave_timeout  31536000
secure_auth ON
secure_file_priv    C:\\ProgramData\\MySQL\\MySQL Server 5.7\\Uploads\\
server_id   1
server_id_bits  32
server_uuid 215d32a3-5340-11e8-93c8-106530971942
session_track_gtids OFF
session_track_schema    ON
session_track_state_change  OFF
session_track_system_variables  ""time_zone,autocommit,character_set_client,character_set_results,character_set_connection""
session_track_transaction_info  OFF
sha256_password_proxy_users OFF
shared_memory   OFF
shared_memory_base_name MYSQL
show_compatibility_56   OFF
show_create_table_verbosity OFF
show_old_temporals  OFF
skip_external_locking   ON
skip_name_resolve   OFF
skip_networking OFF
skip_show_database  OFF
slave_allow_batching    OFF
slave_checkpoint_group  512
slave_checkpoint_period 300
slave_compressed_protocol   OFF
slave_exec_mode IDEMPOTENT
slave_load_tmpdir   C:\\WINDOWS\\SERVIC~3\\NETWOR~1\\AppData\\Local\\Temp
slave_max_allowed_packet    1073741824
slave_net_timeout   60
slave_parallel_type DATABASE
slave_parallel_workers  0
slave_pending_jobs_size_max 16777216
slave_preserve_commit_order OFF
slave_rows_search_algorithms    ""TABLE_SCAN,INDEX_SCAN""
slave_skip_errors   OFF
slave_sql_verify_checksum   ON
slave_transaction_retries   10
slave_type_conversions  
slow_launch_time    2
slow_query_log  ON
slow_query_log_file DESKTOP-11VS9FN-slow.log
socket  MySQL
sort_buffer_size    262144
sql_auto_is_null    OFF
sql_big_selects ON
sql_buffer_result   OFF
sql_log_bin ON
sql_log_off OFF
sql_mode    
sql_notes   ON
sql_quote_show_create   ON
sql_safe_updates    OFF
sql_select_limit    1.84467E+19
sql_slave_skip_counter  0
sql_warnings    OFF
ssl_ca  
ssl_capath  
ssl_cert    
ssl_cipher  
ssl_crl 
ssl_crlpath 
ssl_key 
stored_program_cache    256
super_read_only OFF
sync_binlog 1
sync_frm    ON
sync_master_info    10000
sync_relay_log  10000
sync_relay_log_info 10000
system_time_zone    AUS Eastern Standard Time
table_definition_cache  1400
table_open_cache    2000
table_open_cache_instances  16
thread_cache_size   10
thread_handling one-thread-per-connection
thread_stack    262144
time_format %H:%i:%s
time_zone   SYSTEM
timestamp   1527639658
tls_version ""TLSv1,TLSv1.1""
tmp_table_size  15728640
tmpdir  C:\\WINDOWS\\SERVIC~3\\NETWOR~1\\AppData\\Local\\Temp
transaction_alloc_block_size    8192
transaction_allow_batching  OFF
transaction_isolation   REPEATABLE-READ
transaction_prealloc_size   4096
transaction_read_only   OFF
transaction_write_set_extraction    OFF
tx_isolation    REPEATABLE-READ
tx_read_only    OFF
unique_checks   ON
updatable_views_with_limit  YES
version 5.7.22-log
version_comment MySQL Community Server (GPL)
version_compile_machine x86_64
version_compile_os  Win64
wait_timeout    28800
warning_count   0
</code></pre>

<p>*/ EDIT 1 */ We have decided to abandon the read only optimisations that were put in place for MySql 5.5 as we were unable to resolve this roadblock.</p>
",https://stackoverflow.com/questions/50595820/create-temporary-tables-in-read-only-transaction-mysql-5-7,"['mysql', 'readonly', 'temp-tables', 'mysql-5.7', 'mysql-5.6']",2549,TRUE,5,1
maven not running integration test methods,"<p>I am using dockerfile-maven plugin to move jar file inside my docker container and maven-failsafe-plugin to initiate my integration testing. But maven never run integration test methods. Below is my pom.xml</p>

<pre><code>        &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.20.1&lt;/version&gt;
          &lt;configuration&gt;
            &lt;excludes&gt;
              &lt;exclude&gt;**/*IntegrationTestIT.java&lt;/exclude&gt;
            &lt;/excludes&gt;
          &lt;/configuration&gt;
          &lt;executions&gt;
            &lt;execution&gt;
              &lt;id&gt;integration-test&lt;/id&gt;
              &lt;goals&gt;
                &lt;goal&gt;test&lt;/goal&gt;
              &lt;/goals&gt;
              &lt;phase&gt;integration-test&lt;/phase&gt;
              &lt;configuration&gt;
                &lt;excludes&gt;
                  &lt;exclude&gt;none&lt;/exclude&gt;
                &lt;/excludes&gt;
                &lt;includes&gt;
                  &lt;include&gt;**/*IntegrationTestIT.java&lt;/include&gt;
                &lt;/includes&gt;
              &lt;/configuration&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
            &lt;artifactId&gt;maven-failsafe-plugin&lt;/artifactId&gt;
            &lt;version&gt;2.12&lt;/version&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                &lt;goals&gt;
                    &lt;goal&gt;integration-test&lt;/goal&gt;
                &lt;/goals&gt;
                &lt;configuration&gt;
                    &lt;includes&gt;
                        &lt;include&gt;**/*.java&lt;/include&gt;
                    &lt;/includes&gt;
                &lt;/configuration&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;com.spotify&lt;/groupId&gt;
            &lt;artifactId&gt;dockerfile-maven-plugin&lt;/artifactId&gt;
            &lt;version&gt;1.3.7&lt;/version&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                    &lt;id&gt;default&lt;/id&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;build&lt;/goal&gt;
                        &lt;goal&gt;push&lt;/goal&gt;
                    &lt;/goals&gt;
                &lt;/execution&gt;

            &lt;/executions&gt;
            &lt;configuration&gt;
                &lt;repository&gt;rohitbarnwal7/presto_log_updated&lt;/repository&gt;
                &lt;tag&gt;${project.version}&lt;/tag&gt;
                &lt;buildArgs&gt;
                    &lt;JAR_FILE&gt;plugin-${project.version}-jar-with-dependencies.jar&lt;/JAR_FILE&gt;
                &lt;/buildArgs&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;
</code></pre>

<p>I have named my Integration test class as IntegrationTestIT.java and followed <a href=""https://github.com/spotify/dockerfile-maven"" rel=""nofollow noreferrer"">this</a> to integrate dockerfile maven plugin. </p>

<p>I have been stuck with this problem for a while, any help would be highly appreciated.</p>

<p>Update 1:
Adding my IntegrationTestIT.java file. Here I am trying to connect with presto and run a query to check if they are logged to a file.(Maven project is a presto plugin which is suppose to log all presto queries ran on the presto server.)</p>

<pre><code>import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.SQLException;
import java.sql.ResultSet;
import java.io.IOException;
import java.io.File;
import java.util.Scanner;
// import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.*;
import static org.junit.matchers.JUnitMatchers.*;
import io.prestodb.tempto.query.QueryExecutor;
import static io.prestodb.tempto.context.ThreadLocalTestContextHolder.testContext;
import io.prestodb.tempto.AfterTestWithContext;
import io.prestodb.tempto.BeforeTestWithContext;
import org.junit.Assert.*;
import com.facebook.presto.jdbc.PrestoDriver;
import io.airlift.log.Logger;
import org.testng.annotations.*;


class IntegrationTestIT{

@Test
void checkForQueryInFile() {

    System.out.println(""This test method should be run"");

    String url = ""jdbc:presto://sandbox:8080/jmx/default"";

    Statement stmt = null;
    try {
        Connection connection = DriverManager.getConnection(url, ""jumbo"", null);

        stmt = connection.createStatement();
        String file_path = """";
        String sql_string = ""show schemas"";

        ResultSet rs = stmt.executeQuery(sql_string);
        File folder = new File(""//jars"");
        // Move this to constant class
        File[] files = folder.listFiles(); 

        for (File file:files) {
            if (file.isFile()) {
                file_path = file.getAbsolutePath();
            }
        }
        File log_file = new File(file_path);
        final String scanner = new Scanner(log_file).useDelimiter(""\\Z"").next();;

        assertThat(scanner, containsString(sql_string));

    rs.close();
    stmt.close();
    connection.close();

    } catch (IOException exception) {
        exception.printStackTrace();
    } catch(SQLException sqlException) {
        sqlException.printStackTrace();
    }
}
}
</code></pre>

<p>Update 2:</p>

<p>Here is the maven test report from console.</p>

<p>[INFO] Successfully built rohitbarnwal7/presto_log_updated:0.0.1
[INFO] --- maven-surefire-plugin:2.20.1:test (integration-test) @plugin</p>

<p>[INFO]  T E S T S</p>

<p>[INFO] Running IntegrationTestIT</p>

<p>[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.804 s - in IntegrationTestIT</p>

<p>[INFO] Results:
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0</p>

<p>[INFO] --- maven-failsafe-plugin:2.12:integration-test (default) @plugin ---
[INFO] Failsafe report directory: /Users/rohit/workspace/work/presto-plugins/target/failsafe-reports</p>

<hr>

<h2> T E S T S</h2>

<p>Running IntegrationTestIT
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNGMapConfigurator@7960847b
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.469 sec</p>

<p>Results :</p>

<p>Tests run: 0, Failures: 0, Errors: 0, Skipped: 0</p>
",https://stackoverflow.com/questions/48639730/maven-not-running-integration-test-methods,"['java', 'maven', 'plugins', 'testng']",1804,TRUE,3,1
Programmatically invoking the ASP.NET Core request pipeline,"<h2>Question</h2>

<p>Is there a way to programmatically invoke the ASP.NET Core request pipeline from within my own application, given I have a HTTP verb, the route, headers and body payload?</p>

<h2>Background</h2>

<p>There are use-cases where the WebAPI of our ASP.NET Core application is not accessible because the application is running behind a firewall or is otherwise not reachable.</p>

<p>To provide a solution for this scenario we want our application to poll some other service for ""work-items"" which then translate into API calls in our application.</p>

<h2>Approaches I considered</h2>

<ul>
<li>I could probably just ask DI to give me an instance of a controller and then invoke methods on it. Problems with this approach:

<ul>
<li>Authorization attributes are not enforced. But it is important in our use-case to have the bearer token validated. So here the question would be: How to invoke programmatically the Authorization middleware?</li>
<li>I would have to route the incoming work-items to the correct controller/method myself.</li>
</ul></li>
<li>Using the <code>Microsoft.AspNetCore.TestHost</code> package I could create a <code>TestClient</code> which allows me to make requests to myself (see <a href=""https://learn.microsoft.com/en-us/aspnet/core/testing/integration-testing?view=aspnetcore-2.0#the-test-host"" rel=""noreferrer"">here</a>). But there are a couple of uncertainties here:

<ul>
<li>The intended use-case of this <code>TestHost</code> is for integration testing. Is it safe to use this in a production environment?</li>
<li>Is it even possible to have such a <code>TestServer</code> running alongside the regular hosting?</li>
<li>What about thread-safety? Can I create multiple <code>TestClients</code> from a single <code>TestServer</code> instance and use them from different threads?</li>
</ul></li>
</ul>

<p>So I'm sure there must be a cleaner and more direct way to programmatically invoke the request pipeline from within my own application...</p>
",https://stackoverflow.com/questions/50407760/programmatically-invoking-the-asp-net-core-request-pipeline,"['asp.net-core', 'middleware', 'asp.net-core-testhost', 'request-pipeline']",1013,TRUE,9,1
Debugging Elasticsearch Plugin Integration Tests using IntelliJ and Gradle,"<p>I am building an Elasticsearch plugin based on <a href=""https://github.com/spinscale/cookiecutter-elasticsearch-ingest-processor"" rel=""nofollow noreferrer"">this example</a>. The plugin uses Gradle for building, testing, integration testing, etc. I want to use IntelliJ to set a breakpoint in an Elasticsearch integration test and debug it. I don't care if I run the Gradle build from within IntelliJ or outside of IntelliJ, but right now in both cases I'm running into issues. I'll describe my setup and the problems below:</p>

<p>First I download and build/test the example project via CLI:</p>

<pre><code>$ pip install cookiecutter
$ cookiecutter gh:spinscale/cookiecutter-elasticsearch-ingest-processor
$ # keep all default settings when prompted...
$ gradle build # (also runs the test and integTest tasks)
</code></pre>

<p>This runs fine and the tests pass. I generate the IntelliJ project using Gradle (<code>$ gradle idea</code>) and open it in IntelliJ (shows a green Gradle icon on the directory). I use the default gradle-wrapper option and keep all other defaults when opening.</p>

<p><strong>First problem:</strong> I open IntelliJ's Gradle window (view > Tool Windows > Gradle), but I don't see any of the Gradle tasks which I know are defined in the project. This doesn't seem to be a huge deal, but it would be nice to have them.</p>

<hr>

<p>Now I want to run the tests within IntelliJ, so I open the tests in <code>org.elasticsearch.plugin.ingest.awesome.AwesomeProcessorTests</code>. This class extends the <code>ESTestCase</code> class from Elasticsearch but doesn't directly test any Elasticsearch API interaction. </p>

<p><strong>Second problem:</strong> I run this test class using the little green triangles next to the class name. This fails with the error <code>java.lang.RuntimeException: unable to install test security manager</code>. </p>

<p>I figured out I can get around this by editing the run configuration and adding the VM argument <code>-Dtests.security.manager=false</code>. Now the simple tests run and pass, and I can also set breakpoints and debug them.</p>

<hr>

<p>Now I want to directly test some Elasticsearch functionality, so I write a new integration test class that extends the class <code>ESIntegTestCase</code>. The test should hit the Elasticsearch <code>_cat/plugins</code> endpoint and check that the response string is non-empty.</p>

<pre><code>public class SimpleIT extends ESIntegTestCase {
    private RestClient restClient;
    @Before
    public void setUp() throws Exception {
        super.setUp();
        this.restClient = getRestClient();
    }
    @Override
    protected Collection&lt;Class&lt;? extends Plugin&gt;&gt; nodePlugins() {
        return Collections.singletonList(IngestAwesomePlugin.class);
    }
    public void testPluginInstallation() throws IOException {
        Response response = restClient.performRequest(""GET"", ""_cat/plugins"");
        String body = EntityUtils.toString(response.getEntity());
        assertTrue(body.length() &gt; 0);
    }
}
</code></pre>

<p>When I run this via CLI (<code>gradle integTest</code>), the test passes. If I add a purposely-failing assertion (e.g. <code>assertTrue(body.length() &lt; 0</code>), then the test fails. So that seems to work.</p>

<p><strong>Third problem:</strong> When I run the same test from within IntelliJ (little green triangles), I get the error: </p>

<pre><code>java.lang.IllegalArgumentException: no hosts provided

    at __randomizedtesting.SeedInfo.seed([6F620686489164F5:270C27B7060A2BA1]:0)
    at org.elasticsearch.client.RestClientBuilder.&lt;init&gt;(RestClientBuilder.java:68)
    at org.elasticsearch.client.RestClient.builder(RestClient.java:124)
    at org.elasticsearch.test.ESIntegTestCase.createRestClient(ESIntegTestCase.java:2261)
    at org.elasticsearch.test.ESIntegTestCase.createRestClient(ESIntegTestCase.java:2248)
    at org.elasticsearch.test.ESIntegTestCase.createRestClient(ESIntegTestCase.java:2242)
    at org.elasticsearch.test.ESIntegTestCase.getRestClient(ESIntegTestCase.java:2236)
    at org.elasticsearch.plugin.ingest.awesome.SimpleIT.setUp(SimpleIT.java:36)
</code></pre>

<p>This maps to the line where I call <code>getRestClient()</code>, meaning IntelliJ is blocking the Gradle/Elasticsearch integration testing setup which otherwise works from the CLI.</p>

<p>FWIW, I can still set a breakpoint on this line and debug the test class in IntelliJ and it will stop at the line.</p>

<hr>

<p>Now I try to run the integration tests via CLI, set a breakpoint in IntelliJ, and use IntelliJ's remote debugger to attach to the tests. </p>

<p>I setup a new ""Remote"" run configuration, keeping the defaults (transport socket, debugger mode attach, host <code>localhost</code>, port 5005). On the ""Search sources using module's classpath"" option, I've tried all the possible settings.</p>

<p>I set a breakpoint on the <code>getRestClient()</code> line, and run Gradle with remote debugging options via CLI:</p>

<pre><code>$ GRADLE_OPTS=""-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005"" gradle integTest
</code></pre>

<p><strong>Fourth problem:</strong> As expected, the Gradle process suspends, showing <code>Listening for transport dt_socket at address: 5005</code>. I start the new remote task in IntelliJ, and then the Gradle process continues running. Unfortunately it runs all the way through and doesn't stop at the breakpoint. The tests still pass.</p>

<hr>

<p>I've searched online extensively for different ways to attach to the Gradle debugger. I've seen many things about disabling the daemon, and I've also tried using <code>--system-prop</code> to pass the debug parameters, but nothing solves this problem so far.</p>
",https://stackoverflow.com/questions/51549782/debugging-elasticsearch-plugin-integration-tests-using-intellij-and-gradle,"['java', 'elasticsearch', 'gradle', 'intellij-idea', 'integration-testing']",713,FALSE,3,0
DropWizard: Why is it ignoring a connection if flooded with 100 requests?,"<p>We have Gatling tests (mis)used for integration testing. 
One of things it does at one place is that it shoots 100 HTTP requests <em>at the same instant</em> to the tested service, based on DropWizard 1.3.5.</p>

<p>Before upgrading from DropWizard 0.9.5, this worked fine.</p>

<p>But now, these requests end up with <code>ConnectException</code> on the client side, and I don't see any errors on the server side - the requests is silently ignored by DropWizard. I also looked at the pools over JMX and don't see these hanging anywhere. It looks as if the server lost track of the socket and never sent a response or ""hanged up"".</p>

<pre><code>java.net.ConnectException: Connection timed out: somehost.mycompany.net/10.103.66.45:9000
</code></pre>

<p>I have looked at the <a href=""https://www.dropwizard.io/1.3.1/docs/manual/configuration.html"" rel=""nofollow noreferrer"">DropWizard config reference</a>. I don't see any fine tuning of what's rejected and when. Here is my current config:</p>

<pre><code>server:
  maxThreads: 64
  maxQueuedRequests: 1024
  adminMaxThreads: 8
  ...
database:
  url: jdbc:postgresql://localhost:5432/mydb
  poolInitialSize: 20
  poolMaxSize: 100
</code></pre>

<p>I am including the DB pool size because it might be that it gathers the resources for the request handling IoC, but 100 should cover all Dw threads.</p>

<p>I would expect the extra requests to wait in the queue (which AFAIK should be handled on the OS side, since the new IO API is used) and taken by the 64 threads.</p>

<p>What's interesting is that before I set the <code>maxThreads</code> to 64, the default of 1024 applied; and then, sometimes the tests passed, sometimes not.  </p>

<p>My question is:<br>
Does DropWizard do this intentionally (a DoS detection)?<br>
If yes, how do I configure it?<br>
If not, well, then that's a bug.</p>
",https://stackoverflow.com/questions/51164738/dropwizard-why-is-it-ignoring-a-connection-if-flooded-with-100-requests,"['java', 'performance', 'http', 'connection-pooling', 'dropwizard']",451,FALSE,2,0
How to unit test MVC controller with argument validation in action filter?,"<p>We have an MVC.NET Core Web API app which uses an action filter to validate the controller's methods' arguments.</p>

<p>For validation we use FluentValidation framework. In the action filter, we find the <code>IValidator&lt;TModel&gt;</code> where <code>TModel</code> is the argument of the controller action, eg:</p>

<pre><code>public async Task&lt;IActionResult&gt; Post([FromBody] TModel model)
{
}
</code></pre>

<p>In the filter's <code>OnActionExecuting(ActionExecutingContext context)</code> we find the proper validator (<code>IValidator&lt;TModel&gt;</code>), validate the arguments (<code>context.ActionArguments</code>) and if validation fails, we short-circuit by assigning the validation result into the <code>context.Result</code> - which means the execution never reaches the controller.</p>

<p>Basic principle is similar to hooking up FluentValidation into the MVC's ModelState validation pipeline but we need some extra things so we're doing it manually.</p>

<p>We would like to unit test both the controller and the validator. The problem is with unit testing the controller. In the test setup we instantiate the controller and call one of its methods. Now in production environment, the arguments will always get validated and actually make it to the controller method only if the arguments are valid. But when unit testing the controller, we can easily pass invalid arguments and get unexpected behaviour.</p>

<p>In principal, is there a way around this? Or do I actually need to make sure that in the test method I pass valid arguments to the controller?</p>

<p>EDIT:</p>

<p>We are also planning on integration testing (most likely using .NET Core's TestServer) to make sure the pipeline is working. In this post, I would like to discuss only the issue around invalid arguments passed from unit test methods to the controller.</p>
",https://stackoverflow.com/questions/49942904/how-to-unit-test-mvc-controller-with-argument-validation-in-action-filter,"['c#', 'unit-testing', 'fluentvalidation', 'asp.net-mvc-filters']",1916,TRUE,2,3
org.springframework.boot:spring-boot-maven-plugin:1.5.10.RELEASE:repackage failed: Unable t o find main class,"<p>I have the following project structure :</p>

<pre><code>parent pom
   |
   - Core module - pom
   - Dist - pom
   - Integration test - pom
</code></pre>

<p>Spring boot main class is in the core module. Integration tests will go into the integration tests folder. </p>

<p>I am trying to use spring-boot-maven-plugin for integration testing. 
I have done the following pom configuration for the same in the integration-test module. The start-class property is set in the parent pom :</p>

<pre><code>         &lt;plugin&gt;
            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
            &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
            &lt;configuration&gt;
                &lt;mainClass&gt;${start-class}&lt;/mainClass&gt;
                &lt;layout&gt;JAR&lt;/layout&gt;
            &lt;/configuration&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;repackage&lt;/goal&gt;
                    &lt;/goals&gt;
                &lt;/execution&gt;
                &lt;execution&gt;
                    &lt;id&gt;pre-integration-test&lt;/id&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;start&lt;/goal&gt;
                    &lt;/goals&gt;
                &lt;/execution&gt;
                &lt;execution&gt;
                    &lt;id&gt;post-integration-test&lt;/id&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;stop&lt;/goal&gt;
                    &lt;/goals&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
        &lt;/plugin&gt;
</code></pre>

<p>However I get the following error on mvn clean install on the parent pom :</p>

<pre><code>[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.10.RELEASE:start (pre-integration-test) on pro
</code></pre>

<p>ject: Spring application did not start before the configured timeout (30000ms -> [Help 1]
[ERROR]</p>

<p>Questions :</p>

<ol>
<li>Is this project structure the best way to organize the integration
tests? </li>
<li>How and where do I give the path of the main class to the
spring-boot-maven-plugin correctly? It doesn't work even when I give
it in the integration module or parent pom even after giving a
relative path that you would normally do (e.g.
../core-module/)</li>
<li>maven-failsafe-plugin and spring annotations on the test class itself seem sufficient to run integration tests. So first of all is there any relation between integration tests and spring boot maven plugin? What is the need of spring boot maven plugin apart from packaging into an executable file. I have this confusion because it has goals like start pre-integration-test &amp; post-integration-test but I fail to understand why its needed.</li>
</ol>

<p>PS : I have checked few questions with a similar problem but none answer the questions I have asked for the given project structure. </p>
",https://stackoverflow.com/questions/48656895/org-springframework-bootspring-boot-maven-plugin1-5-10-releaserepackage-faile,"['maven', 'spring-boot', 'spring-boot-maven-plugin']",2478,FALSE,1,1
Unit testing a PHP class that accepts string arguments to create a PDO object,"<p>I have a class (<code>PDOMySQLForeignKeysToURLsService</code>) that does exactly what it says on the tin, it takes a JSON encoded database entity, compares it to a configuration file and transforms any foreign key fields into URLs linking to other RESTful resources. i.e.</p>

<pre><code>[
  {
    ""ID"": ""1"",
    ""person_id"": ""1"",
    ""pc_name"": ""my_computer""
  }
]
</code></pre>

<p>assuming <code>person_id</code> is a foreign key in the database, will become something like</p>

<pre><code>[
  {
    ""ID"": ""1"",
    ""person_id"": ""http://localhost/api/db/person/1"",
    ""pc_name"": ""my_computer""
  }
]
</code></pre>

<p>because this service itself is initalized from a configuration file it can only accept text in it's constructor,</p>

<p><code>public function __construct(string $pdoDSN, string $username, string $password, string $tablename, string $schemaname)</code></p>

<p>everything seems to running fine and dandy, but now I want to write some unit tests for this class, and part of it requires that a <code>PDO</code> object is instantiated and the <code>INFORMATION_SCHEMA</code> table queried like below</p>

<pre><code>  SELECT 
    *
  FROM
    INFORMATION_SCHEMA.KEY_COLUMN_USAGE
  WHERE
    TABLE_SCHEMA = ? AND
    CONSTRAINT_NAME != ""PRIMARY"" AND
    REFERENCED_TABLE_NAME IS NOT NULL AND
    REFERENCED_COLUMN_NAME IS NOT NULL
</code></pre>

<p>The method in which this occurs is in an implementation of an interface <code>Resolvable</code>, defining <code>function resolveRequest(ServiceRequest $request, ServiceResponse $response)</code></p>

<p>I basically have no idea how to go around testing all of this besides setting up a schema/some tables in the tests set up? I have heard from my peers that this is bad practice and does not constitute unit testing but rather integration testing - so my question is how could I go about unit testing this method, is unit testing even appropriate here? The class is by definition very dependant on MySQL (and PDO). Should I write some kind of adapter around PDO and use a DI framework to inject it, and interface with that rather than PDO directly? I'm pretty lost at what to do, tbh, and don't understand the idea/how to mock dependencies that are only used within the scope of a method</p>
",https://stackoverflow.com/questions/51207499/unit-testing-a-php-class-that-accepts-string-arguments-to-create-a-pdo-object,"['php', 'mysql', 'unit-testing', 'pdo', 'phpunit']",59,TRUE,0,1
Spring Boot - How to start my Spring Boot Application from sister module in a multi-module project?,"<p>I have a multi-module project with two projects: <em>backend</em> and <em>client</em>. The backend is a normal Spring Boot Rest API, nothing special. The <em>client</em> module is just a Java Library using the Rest API. </p>

<p>The backend has packaging of ""war"" as the backend as it uses JSPs, too and needs to be deployed to a servlet container. The backend is still easily testable with @SpringBootTest.</p>

<p>Now I want to have some integration tests inside the <em>client</em> module using the backend module as a sandbox server.</p>

<p>To use all the backend classes in the client module I added </p>

<pre><code>&lt;plugin&gt;
  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
  &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
  &lt;configuration&gt;
    &lt;attachClasses&gt;true&lt;/attachClasses&gt;
  &lt;/configuration&gt;
&lt;/plugin&gt;
</code></pre>

<p>and configured the backend as a test dependency in client with classes</p>

<p>In my client/src/test/java I have a helper class which starts up the backend module</p>

<pre><code>@Configuration  
public class SandboxServer {

  @Bean
  public ConfigurableApplicationContext backend() {
    return 
      new SpringApplicationBuilder(BackendApplication.class)
      .sources(SandboxServerConfig.class)
      .run(""spring.profiles.active=sandbox"")
  }
}
</code></pre>

<p>The profile ""sandbox"" is used to setup a test database etc. But I had more problems. First problem was regarding the document root, so I configured it:</p>

<pre><code>public class SandboxServerConfig 
  implements WebServerFactoryCustomizer&lt;TomcatServletWebServerFactory&gt; {
  @Override
  public void customize(TomcatServletWebServerFactory factory) {
    factory.setDocumentRoot(new File(""../backend/src/main/webapp""));
  }
}
</code></pre>

<p>But it still does not work as Spring is not picking up backend/src/main/resources/application.properties</p>

<p>That might be correct as it is not in the root classpath of the client module.</p>

<p>So it does not really work. I guess it is not possible to just start up the sibling module in an Integration test.</p>

<p>How can I achieve to start up the sibling spring boot module for integration testing? What is the best practice for szenarios like this?</p>
",https://stackoverflow.com/questions/53692607/spring-boot-how-to-start-my-spring-boot-application-from-sister-module-in-a-mu,"['java', 'spring', 'spring-boot', 'testing', 'integration-testing']",318,TRUE,0,2
Testing razor pages app,"<p>I am writing a Razor Pages app for a University project, which I am required to test. I couldn't find many sources and examples online on testing Razor Pages and I'm trying to follow the examples on this link : <a href=""https://learn.microsoft.com/en-us/aspnet/core/testing/razor-pages-testing?view=aspnetcore-2.1"" rel=""nofollow noreferrer"">https://learn.microsoft.com/en-us/aspnet/core/testing/razor-pages-testing?view=aspnetcore-2.1</a>  </p>

<p>My first problem is unit testing:<br>
This is the test method I wrote, it's supposed to check that a value that is filled in the OnGet method on my model is receiving the correct value:    </p>

<pre><code>[Fact]
    public void OnGet_ViewStores()
    {
        // Arrange
        var httpContext = new DefaultHttpContext();
        var modelState = new ModelStateDictionary();
        var actionContext = new ActionContext(httpContext, new RouteData(), new PageActionDescriptor(), modelState);
        var modelMetadataProvider = new EmptyModelMetadataProvider();
        var viewData = new ViewDataDictionary(modelMetadataProvider, modelState);
        var pageContext = new PageContext(actionContext)
        {
            ViewData = viewData
        };
        var storesModel = new StoresModel()
        {
            PageContext = pageContext,
            Url = new UrlHelper(actionContext)
        };

        #region snippet2
        // Act
        storesModel.OnGet();
        #endregion

        #region snippet3
        // Assert
        var actualStores = wsep1.Services.ViewAllStores(1);
        Assert.Equal(storesModel.StoreDetails, actualStores);
        #endregion
    }
</code></pre>

<p>And this is the model which is being checked:</p>

<pre><code>public class StoresModel : PageModel
{
    public List&lt;string&gt; StoreDetails { get; set; }
    public string Message { get; set; }
    public int clientId;

    public void OnGet()
    {
        clientId = (int)HttpContext.Session.GetInt32(""clientId"");
        Message = ""Your clientId id is "" + clientId;
        StoreDetails = wsep1.Services.ViewAllStores(clientId);
    }
}
</code></pre>

<p>The problem is that the test throws an exception because I am using an HttpContext.Session which is not configures properly in the test. In my real project it is configured beforehand in Startup.cs in this method: </p>

<pre><code>public void ConfigureServices(IServiceCollection services)
    {
        services.AddWebSocketManager();
        services.AddMvc();
        services.AddDistributedMemoryCache();
        services.AddTransient&lt;ShoppingHandler&gt;();
        services.AddSession(options =&gt;
        {
            // Set a short timeout for easy testing.
            options.IdleTimeout = TimeSpan.FromSeconds(1000);
            options.Cookie.HttpOnly = true;
        });
    }
</code></pre>

<p>But I can't seem to find a way to configure this in my test.  </p>

<p>My second problem is with integration testing:<br>
I am trying to run a very basic test with the Test Server, this is my test class:  </p>

<pre><code>   public class IndexPageTest : IClassFixture&lt;TestFixture&lt;Client.Startup&gt;&gt;
{
    private readonly HttpClient _client;

    public IndexPageTest(TestFixture&lt;Client.Startup&gt; fixture)
    {
        _client = fixture.Client;
    }

    #region snippet1
    [Fact]
    public async Task Request_ReturnsSuccess()
    {
        // Act
        var response = await _client.GetAsync(""/"");

        // Assert
        response.EnsureSuccessStatusCode();
    }
    #endregion
}  
</code></pre>

<p>I hardly changed the TextFixture class that was included in the demo project in the link I gave at the beginning of the post, all I did was add my services to the configuration method (as I said before, I'm using a Session object and also WebSocketManager in my app).<br>
_client.GetAsync(""/"") returns a status of ""500 - internal server error"" and I have no idea why and how to configure these tests to work.<br>
Any ideas would be appreciated, Thanks.</p>
",https://stackoverflow.com/questions/50065040/testing-razor-pages-app,"['asp.net', 'testing', 'razor', '.net-core', 'razor-pages']",1232,FALSE,2,0
Where to set env variables for local Spring Cloud Dataflow?,"<p>For development, I'm using the local Spring Cloud Dataflow server on my Mac, though we plan to deploy to a Kubernetes cluster for integration testing and production. The SCDF docs say you can use environment variables to configure various things, like database configuration. I'd like my registered app to use these env variables, but they don't seem to be able to see them. That is, I start the SCDF server by running its jar from a terminal window, which can see a set of environment variables. I then configure a stream using some Spring Cloud stream starter apps and one custom Spring Boot app. I have the custom app logging System.getenv() and it's not showing the env variables I need. I set them in my ~/.bashrc file, which I also source from ~/.bash_profile. That works for my terminal windows and most other things that need environment, but not here. Where should I be defining them?</p>

<p>To the points in the first answer and comments, they sound good, but nothing works for me. I have an SQS Source that get's its connection via:</p>

<pre><code>return AmazonSQSAsyncClientBuilder.standard()
    .withRegion(Regions.US_WEST_2.getName()))
    .build();
</code></pre>

<p>When I deploy to a Minikube environment, I edit the sqs app's deployment and set the AWS credentials in the env section. Then it works. For a local deployment, I've now tried:</p>

<pre><code>stream deploy --name greg1 --properties ""deployer.sqs.AWS_ACCESS_KEY_ID=&lt;id&gt;,deployer.sqs.AWS_SECRET_ACCESS_KEY=&lt;secret&gt;""

stream deploy --name greg1 --properties ""deployer.sqs.aws_access_key_id=&lt;id&gt;,deployer.sqs.aws_secret_access_key=&lt;secret&gt;""

stream deploy --name greg1 --properties ""app.sqs.AWS_ACCESS_KEY_ID=&lt;id&gt;,app.sqs.AWS_SECRET_ACCESS_KEY=&lt;secret&gt;""

stream deploy --name greg1 --properties ""app.sqs.aws_access_key_id=&lt;id&gt;,app.sqs.aws_secret_access_key=&lt;secret&gt;""
</code></pre>

<p>All fail with the error message I get when credentials are wrong, which is, ""The specified queue does not exist for this wsdl version."" I've read the links, and don't really see anything else to try. Where am I going wrong?</p>
",https://stackoverflow.com/questions/48179824/where-to-set-env-variables-for-local-spring-cloud-dataflow,"['macos', 'spring-cloud-dataflow']",1966,TRUE,2,1
Running Integration Test project with dependencies on a parent project via Docker,"<p>I'm new to this site (although Ive used it many times for information!) And have decided to ask a question as me and my colleagues are stuck with Docker as were new to the tech.</p>
<p>I have an integration-test project written in Java, which tests various parts of the system. Ive setup a maven goal for the project which is ran by running:</p>
<blockquote>
<p>mvn clean verify -P integraion-test</p>
</blockquote>
<p>This works fine when running from the command line, but were looking to expand the process by containerizing it using Docker. The problem is that the integration testing project depends on some jars from the project were trying to test such as DAO and API related things. In my POM.xml I have</p>
<pre><code>&lt;parent&gt;
 &lt;groupId&gt;com.fleet&lt;/groupId&gt;
 &lt;artifactId&gt;fleet-parent&lt;/artifactId&gt;
 &lt;version&gt;1.0.0&lt;/version&gt;
&lt;/parent&gt;
</code></pre>
<p>which will pull the dependencies down from the parent so that they can be used inside the integration-test project.</p>
<p>However, when i build my dockerfile using</p>
<blockquote>
<p>docker build -t integration-tests .</p>
</blockquote>
<p>I get the following error:</p>
<blockquote>
<p>The project com.kinesisfleet.integration:running-integration-tests:0.1 (/integration-test/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for com.fleet.integration:running-integration-tests:0.1: Could not find artifact com.fleet:fleet-parent:pom:1.0.0 in central (<a href=""https://repo.maven.apache.org/maven2"" rel=""nofollow noreferrer"">https://repo.maven.apache.org/maven2</a>) and 'parent.relativePath' points at wrong local POM.</p>
</blockquote>
<p>This is my Dockerfile:</p>
<blockquote>
<p>FROM maven</p>
<p>ADD . /integration-test</p>
<p>WORKDIR /integration-test</p>
<p>RUN  mvn clean install</p>
<p>CMD  mvn verify -P integration-test</p>
</blockquote>
<p>Is there anyway of getting the jars from the parent into my integration-test project so they can be used?</p>
<p>Can i use the COPY command to copy jars from my local repo inside my project?</p>
<p>Any help would be appreciated.</p>
",https://stackoverflow.com/questions/52553042/running-integration-test-project-with-dependencies-on-a-parent-project-via-docke,"['java', 'docker', 'integration-testing']",221,FALSE,1,1
ArgumentError: cannot interpret as DNS name: nil capybara,"<p>Hi all can anyone help me to resolve the issue</p>

<p>'ArgumentError: cannot interpret as DNS name: nil'</p>

<p>The error is coming when doing capybara selenium integration testing in rails 4
here I am using jruby-1.7.9 and ruby version inside JRuby is 2.0.0p195
already I had used the Ruby version is 1.9.7 at that time I faced the error
'cant connect to chrome driver error'
in pure ruby like without using JRuby its the integration testing is working. but my application is in JRuby. and I am using ubuntu platform.
So anyone have any solution on this. what should I do to resolve this??</p>

<p>Here iam adding the exception backtrace</p>

<p>[""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/resolv.rb:1181:in <code>create'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/resolv.rb:1027:in</code>generate_candidates'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/resolv.rb:1052:in <code>resolv'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/resolv.rb:518:in</code>each_resource'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/resolv.rb:411:in <code>each_address'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/resolv.rb:120:in</code>each_address'"", ""org/jruby/RubyArray.java:1613:in <code>each'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/resolv.rb:119:in</code>each_address'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/resolv.rb:97:in <code>getaddress'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/resolv.rb:48:in</code>getaddress'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/1.9/resolv-replace.rb:10:in <code>getaddress'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/1.9/resolv-replace.rb:22:in</code>initialize'"", ""org/jruby/RubyIO.java:1178:in <code>open'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/net/http.rb:882:in</code>connect'"", ""org/jruby/ext/timeout/Timeout.java:144:in <code>timeout'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/net/http.rb:881:in</code>connect'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/net/http.rb:866:in <code>do_start'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/net/http.rb:855:in</code>start'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/net/http.rb:582:in <code>start'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/capybara-2.9.1/lib/capybara/server.rb:81:in</code>responsive?'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/capybara-2.9.1/lib/capybara/server.rb:97:in <code>boot'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/capybara-2.9.1/lib/capybara/session.rb:72:in</code>initialize'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/capybara-2.9.1/lib/capybara.rb:324:in <code>current_session'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/capybara-2.9.1/lib/capybara/dsl.rb:47:in</code>page'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/capybara-2.9.1/lib/capybara/dsl.rb:52:in <code>visit'"", ""/media/sidharthan/NewVolume/sidharthan_fooddev/foodapp/webapp/food/test/test_helper.rb:115:in</code>IntegrationTest'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/capybara-2.9.1/lib/capybara.rb:67:in <code>configure'"", ""/media/sidharthan/NewVolume/sidharthan_fooddev/foodapp/webapp/food/test/test_helper.rb:102:in</code>IntegrationTest'"", ""org/jruby/RubyBasicObject.java:1565:in <code>instance_exec'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:446:in</code>make_lambda'"", ""org/jruby/RubyProc.java:271:in <code>call'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:192:in</code>simple'"", ""org/jruby/RubyProc.java:271:in <code>call'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in</code>call'"", ""org/jruby/RubyArray.java:1613:in <code>each'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in</code>call'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:92:in <code>__run_callbacks__'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:782:in</code>_run_setup_callbacks'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in <code>run_callbacks'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/activesupport-4.2.6/lib/active_support/testing/setup_and_teardown.rb:41:in</code>before_setup'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/activerecord-4.2.6/lib/active_record/fixtures.rb:827:in <code>before_setup'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest/test.rb:105:in</code>run'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest/test.rb:204:in <code>capture_exceptions'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest/test.rb:104:in</code>run'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest/test.rb:255:in <code>time_it'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest/test.rb:103:in</code>run'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:348:in <code>on_signal'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest/test.rb:275:in</code>with_info_handler'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest/test.rb:102:in <code>run'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:799:in</code>run_one_method'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:322:in <code>run_one_method'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:310:in</code>run'"", ""org/jruby/RubyArray.java:1613:in <code>each'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:309:in</code>run'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:348:in <code>on_signal'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:335:in</code>with_info_handler'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:308:in <code>run'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:158:in</code>__run'"", ""org/jruby/RubyArray.java:2409:in <code>map'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:158:in</code>__run'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:135:in <code>run'"", ""/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:62:in</code>autorun'""]</p>

<p>Thanks in advance</p>
",https://stackoverflow.com/questions/51021887/argumenterror-cannot-interpret-as-dns-name-nil-capybara,"['ruby-on-rails', 'capybara', 'selenium-chromedriver']",677,FALSE,0,1
Flutter: Debugging an integration test,"<p>I'm learning Flutter and using Android Studio as my IDE and i've hit some pain points around Integration Testing.</p>

<p>As part of the learning process i have written a basic Integration Test.</p>

<p>The intention with this integration test is to examine an Image widget (created via Image.Asset) to see if the image source, which is dynamically generated, is the expected value, or that an image is being displayed.</p>

<p>I run the integration test using the Terminal tab in the IDE, e.g: <code>flutter drive --target=my_app/test_driver/user_list_scrolling.dart</code></p>

<p>I want to add a breakpoint to my Integration Test method and step through it from within Android Studio to help aid my learning of the testing functions.</p>

<p>My questions are:</p>

<p>How can i debug an integration test from within Android Studio? - As I'm learning i would love to put a breakpoint in my integration test and play around with the Finders in the immediate window. However, when i start my integration test from the terminal my Breakpoints seem to be ignored, i also tried adding the <code>Debugger();</code> command. Execution paused, but i was unable to step through my code in Android Studio. I've also tried using the 'Attach to process' option in the IDE but the 'Choose process' list is empty.</p>

<p>Can i execute an integration test from within Android Studio without having to manually enter a command into a terminal? - i would rather click a button than memorise a command. Right-clicking my integration test file and selecting run does not appear to work.</p>

<p>How can i effectively test an Image widget from within an Integration Test? - The image source is set by calling Image.Asset() with a calculated value as the first argument, so i want to confirm that an image is displayed / the argument is the expected value. I'm guessing i need to use <code>find.byType(""Image"")</code> and somehow examine the result for the source value?</p>
",https://stackoverflow.com/questions/52024702/flutter-debugging-an-integration-test,"['android-studio', 'debugging', 'flutter', 'integration-testing']",6023,TRUE,11,4
