Title: Rerun Spring integration tests after minimization with full context reset between tests by IlyaMuravjov · Pull Request #2574 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: Rerun Spring integration tests after minimization with full context reset between tests by IlyaMuravjov · Pull Request #2574 · UnitTestBot/UTBotJava
X Title: Rerun Spring integration tests after minimization with full context reset between tests by IlyaMuravjov · Pull Request #2574 · UnitTestBot/UTBotJava
Description: Description When generating integration tests we only partially reset context in between executions to save time. For example, entity id generators do not get reset. It may lead to non-reproduceable results if IDs leak to the output of the method under test. To cope with that, we rerun all executions that are left after minimization, fully resetting Spring context between executions. How to test Manual tests Generate integration tests for OrderController.getOrderById() from spring-boot-testing project, there should be test like this (with "id":1 in the expected part). public void testGetOrderById() throws Exception { UriComponentsBuilder uriComponentsBuilder = fromPath("/api/orders/{id}"); Map uriVariables = new HashMap(); Order order = new Order(); entityManager.persist(order); entityManager.flush(); Long long1 = ((Long) getFieldValue(order, "com.rest.order.models.Order", "id")); uriVariables.put("id", long1); UriComponentsBuilder uriComponentsBuilder1 = uriComponentsBuilder.uriVariables(uriVariables); String urlTemplate = uriComponentsBuilder1.toUriString(); Object[] uriVariables1 = {}; MockHttpServletRequestBuilder mockHttpServletRequestBuilder = get(urlTemplate, uriVariables1); ResultActions actual = mockMvc.perform(mockHttpServletRequestBuilder); actual.andDo(print()); actual.andExpect((status()).is(200)); actual.andExpect((content()).string("{\"id\":1,\"buyer\":null,\"price\":null,\"qty\":0}")); } Self-check list I've set the proper labels for my PR (at least, for category and component). PR title and description are clear and intelligible. I've added enough comments to my code, particularly in hard-to-understand areas. The functionality I've repaired, changed or added is covered with automated tests. Manual tests have been provided optionally. The documentation for the functionality I've been working on is up-to-date.
Open Graph Description: Description When generating integration tests we only partially reset context in between executions to save time. For example, entity id generators do not get reset. It may lead to non-reproduceabl...
X Description: Description When generating integration tests we only partially reset context in between executions to save time. For example, entity id generators do not get reset. It may lead to non-reproduceabl...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/pull/2574
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:f05493fa-33c7-93ba-e19d-fd8e9562137b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A4AE:2AF02:FE5939:1433816:69919091 |
| html-safe-nonce | 874957fa1b850a52d8292e2c5546391ab4917407a85f92f1e12091940c8f80f0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNEFFOjJBRjAyOkZFNTkzOToxNDMzODE2OjY5OTE5MDkxIiwidmlzaXRvcl9pZCI6IjczODE4MDA0Mzg0NjU2NjMxMjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b32731d783626a82ee2d6c060b3f571b4912a6dd19c4ed739c63e5d3e65cafa0 |
| hovercard-subject-tag | pull_request:1498622391 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/UnitTestBot/UTBotJava/pull/2574/files |
| twitter:image | https://avatars.githubusercontent.com/u/71839386?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/71839386?s=400&v=4 |
| og:image:alt | Description When generating integration tests we only partially reset context in between executions to save time. For example, entity id generators do not get reset. It may lead to non-reproduceabl... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/UnitTestBot/UTBotJava git https://github.com/UnitTestBot/UTBotJava.git |
| octolytics-dimension-user_id | 87413538 |
| octolytics-dimension-user_login | UnitTestBot |
| octolytics-dimension-repository_id | 480810501 |
| octolytics-dimension-repository_nwo | UnitTestBot/UTBotJava |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 480810501 |
| octolytics-dimension-repository_network_root_nwo | UnitTestBot/UTBotJava |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width