Title: Test Smell: it is not a good test practice to use the loop in the test · Issue #1038 · biojava/biojava · GitHub
Open Graph Title: Test Smell: it is not a good test practice to use the loop in the test · Issue #1038 · biojava/biojava
X Title: Test Smell: it is not a good test practice to use the loop in the test · Issue #1038 · biojava/biojava
Description: Hi! We notice that you use the loop structure in your test cases. For example, testQualityScoresIntArray() in FastqToolsTest.java However, using the loop in test cases is not a good test practice. We analyzed the relevant Stack Overflow ...
Open Graph Description: Hi! We notice that you use the loop structure in your test cases. For example, testQualityScoresIntArray() in FastqToolsTest.java However, using the loop in test cases is not a good test practice. ...
X Description: Hi! We notice that you use the loop structure in your test cases. For example, testQualityScoresIntArray() in FastqToolsTest.java However, using the loop in test cases is not a good test practice. ...
Opengraph URL: https://github.com/biojava/biojava/issues/1038
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Test Smell: it is not a good test practice to use the loop in the test","articleBody":"Hi!\r\n\r\nWe notice that you use the loop structure in your test cases.\r\nFor example, testQualityScoresIntArray() in FastqToolsTest.java\r\n\u003cimg width=\"497\" alt=\"截屏2022-08-17 下午5 17 26\" src=\"https://user-images.githubusercontent.com/110402847/185083359-94544a0a-e17c-454f-9406-d4fa380e6774.png\"\u003e\r\n\r\nHowever, using the loop in test cases is not a good test practice.\r\nWe analyzed the relevant Stack Overflow posts and summarized four potential negatives it brings:\r\n1. Loops make the test case more complex\r\n2. In most cases, a loop can be replaced with a data-driven test that is more readable.\r\n3. Loops break the assert-for-one-thing thumb rule. I don't mean a single assert statement.\r\n4. When a test fails, knowing the reason is more complicated.\r\n\r\nSolution:\r\nTo avoid using the loop in the test, JUnit provides an annotation (i.e., @ParameteredTest), enabling a test case to run multiple times with different parameters.\r\nWe provide a usage example here:\r\n\u003cimg width=\"622\" alt=\"image\" src=\"https://user-images.githubusercontent.com/110402847/185083811-1d731ae3-0188-475f-b378-714beb492e7a.png\"\u003e\r\n","author":{"url":"https://github.com/TestSmell","@type":"Person","name":"TestSmell"},"datePublished":"2022-08-17T09:23:02.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/1038/biojava/issues/1038"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d44aa6c9-347b-dd11-dd90-f0144857dcbe |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8B16:13E147:2E74EB7:3D65864:69744434 |
| html-safe-nonce | 9674ac8d33b02212b7fd29c6f0c777e805cbbff6e87a6cbe9de4ab4958eacb26 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjE2OjEzRTE0NzoyRTc0RUI3OjNENjU4NjQ6Njk3NDQ0MzQiLCJ2aXNpdG9yX2lkIjoiNTI2NTM1MTA5MzMxMTQxNjg0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 51d927361cc2499e9ba0ad70f6470be2b19a342f2406e9e8f7dbaa5de2f9421e |
| hovercard-subject-tag | issue:1341447386 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/biojava/biojava/1038/issue_layout |
| twitter:image | https://opengraph.githubassets.com/413181a02dc4cf2ba5a306c517d3233e0fabba3b4cedb69d141fdfadeec62997/biojava/biojava/issues/1038 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/413181a02dc4cf2ba5a306c517d3233e0fabba3b4cedb69d141fdfadeec62997/biojava/biojava/issues/1038 |
| og:image:alt | Hi! We notice that you use the loop structure in your test cases. For example, testQualityScoresIntArray() in FastqToolsTest.java However, using the loop in test cases is not a good test practice. ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | TestSmell |
| hostname | github.com |
| expected-hostname | github.com |
| None | e0b95d743b7672c9ac0e1032d5f117950182dc164a83434a7db86510e8f0b37c |
| turbo-cache-control | no-preview |
| go-import | github.com/biojava/biojava git https://github.com/biojava/biojava.git |
| octolytics-dimension-user_id | 237402 |
| octolytics-dimension-user_login | biojava |
| octolytics-dimension-repository_id | 9199359 |
| octolytics-dimension-repository_nwo | biojava/biojava |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 9199359 |
| octolytics-dimension-repository_network_root_nwo | biojava/biojava |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 56fe7e2e8de6e57740bca50402351ea656f7a4bf |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width