title,body,link,tags,view_count,is_answered,score,answer_count
close qt application through program,"<p>I have written small tool and works well. I would like to system testing where I can open window and close window to run high level flow. But I am not able to figure to close window through program. One silly option is, to kill process to close window but I feel there could be some better way.</p>
<p>Just sharing invoking code</p>
<pre><code>self.logger.info(&quot;Running gui mode&quot;)
        if self.approval:
            app = QApplication([])
            window = ApprovalWindow(app, self.block, self.mil, 
                                    self.vio, self.app, 
                                    self.prep, self.logger)
        else:
            app = QApplication([])
            window = ReviewWindow(app, self.block, self.mil, 
                                  self.vio, 
                                  self.pre, self.logger)
 
        window.create_widget()
        window.show()
        app.exec_()

Tried method
#       app.close()
#        for widget in appl.allwidgest():
#           widget.close
      
</code></pre>
",https://stackoverflow.com/questions/69504414/close-qt-application-through-program,"['python', 'pyqt', 'pyqt5']",227,True,0,1
Is there ErrorCollector rule analogue for JUnit5,"<p>There was the ErrorCollector Rule in JUnit4 and now we have to switch to extensions during migration to JUnit5. Usage of the ErrorCollector was described here <a href=""https://junit.org/junit4/javadoc/4.12/org/junit/rules/ErrorCollector.html"" rel=""nofollow noreferrer"">https://junit.org/junit4/javadoc/4.12/org/junit/rules/ErrorCollector.html</a>
Is there a similar extension in JUnit5. I found one in the assert-j <a href=""https://www.javadoc.io/doc/org.assertj/assertj-core/latest/org/assertj/core/api/junit/jupiter/SoftAssertionsExtension.html"" rel=""nofollow noreferrer"">https://www.javadoc.io/doc/org.assertj/assertj-core/latest/org/assertj/core/api/junit/jupiter/SoftAssertionsExtension.html</a> but is the same thing still supported in JUnit 5 as an extension?</p>
<p>Note: I would like to use this on a system testing level. So I would have Step 1 -&gt; assertion -&gt; Step 2-&gt; assertion-&gt;... assertAll in my opinion is worse option here as I have to store values for verification and assert them at the end of the test, not in places where I got these values.</p>
<pre><code>assertAll(() -&gt; {{Some block of code getting variable2}
                    assertEquals({what we expect from variable1}, variable1, &quot;variable1 is wrong&quot;)},
                {Some block of code getting variable2}
        assertEquals({what we expect from variable2}, variable2, &quot;variable2 is wrong&quot;),
                {Some block of code getting variable3}
        assertEquals({what we expect from variable3}, variable3, &quot;variable3 is wrong&quot;));
</code></pre>
<p>This approach doesn't look clear and looks worse than described here <a href=""https://assertj.github.io/doc/#assertj-core-junit5-soft-assertions"" rel=""nofollow noreferrer"">https://assertj.github.io/doc/#assertj-core-junit5-soft-assertions</a></p>
",https://stackoverflow.com/questions/68506209/is-there-errorcollector-rule-analogue-for-junit5,"['java', 'junit', 'junit4', 'junit5', 'errorcollector']",1462,True,1,2
convert gremlin queries to cypher query,"<p>our system is using a graph database( not neo4j )and it's in live .
Wanted to migrate it to Neo4j.</p>
<p>we have used gremlin for graph traversal and approximately 10000 gremlin traversal queries(read intensive system) and impossible to translate each and every query to cypher .
It will lead to a very big change in the system , testing etc .</p>
<p>Hence we are looking for a gremlin to cypher translator which is something similar to open cypher library which converts cypher to gremlin.
Input is cypher query string and output is gremlin.</p>
<p>Similarly if we have any such library for taking gremlin query string as input and converting it to cypher query string so that we can seamlessly migrate our system.</p>
<p>We have tried a gremlin bolt driver [it relied on a lot of roundtrips.] but it didn't work as expected and it is not taking gremlin query as string and also big queries are not working .</p>
",https://stackoverflow.com/questions/68607272/convert-gremlin-queries-to-cypher-query,['neo4j'],462,False,1,1
"Unit integration tests, system tests with node js, express, javascript","<p>I am very new with testing , I have built a web app with node js, ejs, express . The web app has 10 different ejs files and for each file, there is a script linked to a .js file.</p>
<p>I need to test the 10 programs with unit , integration and system testing, I am using jest</p>
<p>the modules function on their own and they are not connected to each other</p>
<p>Is it possible to perform unit tests on chunks of code on a SINGLE .JS FILE, for example functions referring to them as units and is it possible to test these functions with variables or other connected functions in the SAME FILE referring to this as an integration test??</p>
<p>I am not sure if an integration test requires me to have a separate file with units for example functions and I must import them to another file in order to test integration with other units....?</p>
<p>I hope that was clear..
Thanks very much for your help!!</p>
",https://stackoverflow.com/questions/66324789/unit-integration-tests-system-tests-with-node-js-express-javascript,"['node.js', 'unit-testing', 'jestjs', 'automated-tests', 'integration-testing']",41,False,0,0
I&#39;m trying to filter an array of Objects simultaneosly by number and by string value,"<p>i have a little problem in my App !
it's a simple App that shows some restaurant tables and let you filter these tables by number of people eating (capacity) and the preferred place (Inside, Patio, Bar)</p>
<p>I have a problem specifically with this filter functionality:
i'm able to filter the tables by Place, but when i try to simultaneosly filter the Tables by Capacity it won't work (it'll forget the Place filter, and just filter them by Capacity).
I'll explain the user flow i used:</p>
<ol>
<li>I click on the Place select and choose the option 'Patio'</li>
<li>At this point 2 tables are showed; one is for 5 people, the other for 9 people</li>
<li>i click on the Capacity filter, choosing a table for 9 persons.</li>
<li>the App will forget the 'Patio' value and it'll also show a table with Location ' Bar' (and that's the part i'm trying to fix, i want the App to remember 'Patio' and only showing that one)</li>
</ol>
<pre><code>     const defaultState : any = {
            tables: [],
            tablesFiltered: [],
            bookings: [],
            error: null,
            loading: false,
        }
         case FILTER_TABLE:
                        return {
                            ...state,
                            tablesFiltered: action.payload,
                        }
</code></pre>
<p>this is my action</p>
<pre><code>export const filterTables = (filteredTable: tableI[]) =&gt; {
    return (dispatch: (arg0: { type: string; payload?: unknown; }) =&gt; void) =&gt;
    dispatch({type: FILTER_TABLE, payload: filteredTable})
}
</code></pre>
<p>finally, the component where the logic of the filter is:</p>
<pre><code>TableFilter.tsx

import { Form } from 'react-bootstrap';
import { useSelector, useDispatch } from 'react-redux';
import { filterTables } from '../../store/actions';
import { tableI } from '../../Interfaces';

const TableFilter: React.FC = () =&gt; {
  const tables: tableI[] = useSelector((state: any) =&gt; state.tables.tables);

  const dispatch = useDispatch();

  const handleChange = (event: any) =&gt; {
    const locationFilter: string = event.target.value;
    const capacityFilter: any = event.target.value;

    // console.log(typeof capacityFilter);

    const filteredArr = tables.filter(
      (table) =&gt; table.location === locationFilter
    );

    // console.log(filteredArr);
    dispatch(filterTables(filteredArr));
  };

  const changeCapacity = (event: any) =&gt; {
    // const locationFilter: string = event.target.value;
    const capacityFilter: any = event.target.value;

    // console.log(typeof capacityFilter);

    const filteredArr = tables.filter(
      (table) =&gt; table.capacity &gt;= Number.parseInt(capacityFilter)
    );

    // console.log(filteredArr);
    dispatch(filterTables(filteredArr));
  };

  const locations: string[] = tables.map((table) =&gt; table.location);
  const capacity: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9];

  const uniqueLocations = [...new Set(locations)];
return (
    &lt;Form&gt;
      &lt;Form.Group className=&quot;mb-3&quot; controlId=&quot;formBasicEmail&quot;&gt;
        &lt;Form.Label&gt;Select a table&lt;/Form.Label&gt;
        &lt;Form.Control
          onChange={handleChange}
          as=&quot;select&quot;
          aria-label=&quot;form-select-location&quot;
        &gt;
          &lt;option&gt;Select your table's location&lt;/option&gt;
          {uniqueLocations &amp;&amp;
            uniqueLocations.map((location: string, index: number) =&gt; (
              &lt;option aria-label=&quot;location&quot; key={index} value={location}&gt;
                {location}
              &lt;/option&gt;
            ))}
        &lt;/Form.Control&gt;
      &lt;/Form.Group&gt;

      &lt;Form.Group className=&quot;mb-3&quot; controlId=&quot;formBasicEmail&quot;&gt;
        &lt;Form.Label&gt;Select the capacity of your table&lt;/Form.Label&gt;
        &lt;Form.Control
          onChange={changeCapacity}
          as=&quot;select&quot;
          aria-label=&quot;form-select-capacity&quot;
        &gt;
          &lt;option&gt;Number of persons sitting &lt;/option&gt;
          {capacity &amp;&amp;
            capacity.map((capacity: number, index: number) =&gt; (
              &lt;option aria-label=&quot;capacity&quot; key={index} value={capacity}&gt;
                {capacity}
              &lt;/option&gt;
            ))}
        &lt;/Form.Control&gt;
      &lt;/Form.Group&gt;
    &lt;/Form&gt;
  );
};

export default TableFilter;
</code></pre>
<p>here's my GitHub repo:</p>
<p><a href=""https://github.com/miki-miko/booking-system-testing"" rel=""nofollow noreferrer"">https://github.com/miki-miko/booking-system-testing</a></p>
",https://stackoverflow.com/questions/69850977/im-trying-to-filter-an-array-of-objects-simultaneosly-by-number-and-by-string-v,"['javascript', 'reactjs', 'typescript', 'redux']",99,True,1,2
E2E Test Automation workflow with GitLab CI/CD,"<p>I am to build a test automation system for E2E testing for a company. The product is React/Node.JS based runs in a cloud (Docker &amp; Kubernetes). The code is stored in GitLab repositories for which there are CI/CD pipelines setup for test/lint/deployment.</p>
<p>I plan to use Jest for test orchestration and Selenium / Appium for the UI testing (FRW being in TypeScript), while creating a generator to test our proprietary backend interface.
My code is in a similar repository and will be containerized and uploaded to the test environment.</p>
<p>In my former workplaces we used TeamCity and similar tools to manage test sessions but I do not seem to be able to find the perfect link between our already set up GitLab CI/CD and the E2E testing framework.</p>
<p>I know it could be implemented as part of the pipeline, but for me it seems lacking (which can also be because of my inexperience)</p>
<p>Could you advise some tools/methods for handling test session management for system testing in such an environment?
(with a GUI where I can see the progress of all sessions, being able to manage them, run / rerun / run on certain platforms only, etc)</p>
",https://stackoverflow.com/questions/65657061/e2e-test-automation-workflow-with-gitlab-ci-cd,"['testing', 'automated-tests', 'gitlab-ci', 'e2e-testing', 'system-testing']",518,False,2,0
Git limitations when pushing projects live using pipelines,"<p>We have several teams working on different projects, each using their own branch(es) in Git. Each team will then merge their branch into a common testing branch to allow system testing prior to moving the project to a user acceptance environment (uat) and ultimately the live environment. For different reasons, projects begin and end at different times and move along at different speeds. Projects with a high or critical priority may need to be tested and moved live within hours or days, much more quickly than dev projects which take months to complete and test.</p>
<p>However, once the individual project branches are merged into test, there is no way to promote/merge these branches individually to uat and then live. The uat and live branches have pipelines that automatically push the source to the relevant servers adding another layer of complexity.</p>
<p>As a project manager I would like to be able to see the status and location of individual projects.</p>
<p>I have asked this question in different ways before and have done a reasonable amount of research about the Git product and have come to the conclusion that there is no easy way to do this using Git.</p>
<p>Am I missing something - is there an easy way to achieve what I am looking for using Git? The solution must not overly tax or frustrate the dev teams - this will create more problems than it solves.</p>
<p>If not, is there another product that we can use instead of or in conjunction with Git?</p>
",https://stackoverflow.com/questions/70462779/git-limitations-when-pushing-projects-live-using-pipelines,"['git', 'version-control', 'project-management']",32,False,0,1
userform multicolumn listbox not showing records unless form is closed and re-opened,"<p>I have 4 user input forms where user inputs/edits records via fields on the form and the records display below in a multi-column listbox. (There are also Save and Delete buttons on the forms.) They have all worked fine for weeks of unit testing. Now that I have coded and debugged the calculations part of the project, I have started a final round of system testing where I am starting with blank data sheets. And the listboxes are showing a strange (new) behavior.</p>
<p>When I open a form with no records, enter the first record and save it, the record is not displayed. The record does get saved properly on the data sheets. The first column of the listbox displays the record number and the rest of the columns are blank. However, I am not including (displaying) the record number (column A) on the forms. I only display values from columns 2 the 7 (B thru H) of the data sheet. It will only show the record number for every record I enter thereafter, as long as I am in the same &quot;session&quot; of the open form when I entered the first record.</p>
<p>However, if I close the form and re-open it, the records displays as they should. And any subsequent records I enter after I re-open the form, the new records also display properly. Even if I delete all the records on the form and ad new ones, they display fine as long as I have not closed the form. This behavior is the same for all 4 of the forms. The forms all worked properly when I created them, and for literally a couple of months of unit testing after that. Admittedly, I have made a lot of code changes to correct errors I have found in the calculations part of my project. But I cannot conceive of any that would globally affect listboxes on all the forms.</p>
<p>Example code for one of the forms Initialize event:</p>
<pre><code>        If Not iAcctLastRow = 1 Then 'there are no records to load into listbox
            Set rAcctDB = wsAcctInput.Range(&quot;A2:J&quot; &amp; iAcctLastRow)
            With Me.lstAcct 'Populate listbox
                .Font.Name = &quot;Tahoma&quot;
                .Font.Size = 10
                .ColumnCount = 10
                .ColumnWidths = &quot;0,120,80,90,60,60,80,60,0,0&quot;
                .List = rAcctDB.Cells.Value
            End With
        End If
</code></pre>
<p>And in the Save procedure I refresh the listbox as follows:</p>
<pre><code>        iAcctLastRow = wsAcctInput.Range(&quot;B22&quot;).End(xlUp).row
        DelayThis 50 'added this delay but no change
        Set rAcctDB = wsAcctInput.Range(&quot;A2:J&quot; &amp; iAcctLastRow)
        Me.lstAcct.List = rAcctDB.Cells.Value 'Refresh listbox
</code></pre>
<p>The above code is the same on all 4 forms, varying in which data sheet and columns being used. I can repeat the above behaviors at will. Has anyone seen this before, or have any ideas?</p>
",https://stackoverflow.com/questions/69123138/userform-multicolumn-listbox-not-showing-records-unless-form-is-closed-and-re-op,"['excel', 'vba', 'listbox', 'userform']",237,True,0,2
How can I do a partial integration test (phpunit)?,"<p>I am working on an extension (app) of nextcloud (which is based on Symfony). I have a helper class to extract data from the request that is passed by the HTTP server to PHP. A much-reduced one could be something like this (to get the point here):</p>
<pre><code>&lt;?php
namespace OCA\Cookbook\Helpers;

class RequestHelper {
  public function getJson(){
    if($_SERVER['Request_Method' === 'PUT'){ // Notice the typos, should be REQUEST_METHOD
      $raw = file_get_content('php://input');
      return json_decode($raw, true);
    } else { /* ... */ }
  }
}
</code></pre>
<p>Now I want to test this code. Of course, I can do some unit testing and mock the <code>$_SERVER</code> variable. Potentially I would have to extarct the <code>file_get_content</code> into its own method and do a partial mock of that class. I get that. The question is: How much is this test worth?</p>
<p>If I just mimick the behavior of that class (white box testing) in my test cases I might even copy and paste the typo I intentionally included here. As this code is an MWE, real code might get more complex and should be compatible with different HTTP servers (like apache, nginx, lighttpd etc).</p>
<p>So, ideally, I would like to do some automated testing in my CI process that uses a real HTTP server with different versions/programs to see if the integration is working correctly. Welcome to integration testing.</p>
<p>I could now run the nextcloud server with my extension included in a test environment and test some real API endpoints. This is more like functional testing as everything is tested (server, NC core, my code and the DB):</p>
<pre><code>phpunit  &lt;---&gt; HTTP server  &lt;---&gt;  nextcloud core  &lt;---&gt;  extension code  &lt;---&gt;  DB
                                                           ^
                                                           |
                                                           +--&gt;  RequestHelper
</code></pre>
<p>Apart from speed, I have to carefully take into account to test all possible paths through the class <code>RequestHelper</code> (device under test, DUT). This seems a bit brittle to me in the long run.</p>
<p>All I could think of is adding a simple endpoint only for testing the functionality of the DUT, something like a pure echo endpoint or so. For the production use, I do not feel comfortable having something like this laying around.</p>
<p>I am therefore looking for an integration test with a partial mock of the app (mocking the business logic + DB) to test the route between the HTTP server and my DUT. In other words, I want to test the integration of the HTTP server, nextcloud core, my controller, and the DUT above without any business logic of my app.</p>
<p>How can I realize such test cases?</p>
<hr />
<p><strong>Edit 1</strong>
As I found from the comments the problem statement was not so obviously clear, I try to explain a bit at the cost of the simplicity of the use-case.</p>
<p>There is the nextcloud core that can be seen as a framework from the perspective of the app. So, there can be controller classes that can be used as targets for URL/API endpoints. So for example <code>/apps/cookbook/recipe/15</code> with a <code>GET</code> method will fetch the recipe with id <code>15</code>. Similarly, with <code>PUT</code> there can be a JSON uploaded to update that recipe.</p>
<p>So, inside the corresponding controller the structure is like</p>
<pre class=""lang-php prettyprint-override""><code>class RecipeController extends Controller {
  /* Here the PUT /apps/cookbook/recipe/{id} endpoint will be routed */
  public function update($id){
    $json = $this-&gt;requestHelper-&gt;getJson(); // Call to helper

    // Here comes the business logic
    // aka calls to other classes that will save and update the state
    // and perform the DB operation
    $this-&gt;service-&gt;doSomething($json);

    // Return an answer if the operation terminated successfully
    return JsonResponse(['state'=&gt;'ok'], 200);
  }
}
</code></pre>
<p>I want to test the <code>getJson()</code> method against different servers. Here I want to mock at least the <code>$this-&gt;service-&gt;doSomething($json)</code> to be a no-op. Ideally, I would like to <em>spy</em> into the resulting <code>$json</code> variable to test that exactly.</p>
<p>No doubt, in my test class it would be something like</p>
<pre class=""lang-php prettyprint-override""><code>class TestResponseHandler extends TestCase {
  public function setUp() { /* Set up the http deamon as system service */}
  public testGetJson() {
    // Creat Guzzle client
    $client = new Client([
      'base_uri' =&gt; 'http://localhost:8080/apps/cookbook',
    ]);
    // Run the API call
    $headers = ...;
    $body = ...;
    $response = $client-&gt;put('recipe/15', 'PUT', $headers, $body);

    // Check the response body
    // ....
  }
}
</code></pre>
<p>Now, I have two code interpreters running: Once, there is the one (A) that runs phpunit (and makes the HTTP request). Second, there is the one (B) associated with the HTTP server listening on <code>localhost:8080</code>.</p>
<p>As the code above with the call to <code>getJson()</code> is running inside a PHP interpreter (B) <strong>outside the phpunit instance</strong> I cannot mock directly as far as I understand. I would have to change the main app's code if I am not mistaken.</p>
<p>Of course, I could provide (more or less) useful data in the test function and let the <code>service-&gt;doSomething()</code> method do its job but then I am no longer testing only a subset of functions but I am doing functional or system testing. Also, this makes it harder to generate well-aimed test cases if all these side-effects need to be taken into account.</p>
",https://stackoverflow.com/questions/65898716/how-can-i-do-a-partial-integration-test-phpunit,"['php', 'unit-testing', 'integration-testing', 'nextcloud']",230,False,0,0
