Enforcing DRY principles -- Optimization of test suites
See original GitHub issueDescribe the enhancement Currently, there are many tests that are repetitive, i.e: For example:
def test_issue_comments_mean_std_by_group(metrics):
response = requests.get('http://localhost:5000/api/unstable/repo-groups/10/issue-comments-mean-std')
data = response.json()
assert response.status_code == 200
assert len(data) >= 1
def test_issue_comments_mean_std_by_repo(metrics):
response = requests.get('http://localhost:5000/api/unstable/repo-groups/10/repos/25430/issue-comments-mean-std')
data = response.json()
assert response.status_code == 200
assert len(data) >= 1
def test_issue_comments_mean_std_by_repo(metrics):
response = requests.get('http://localhost:5000/api/unstable/repo-groups/10/repos/25430/issue-comments-mean-std')
data = response.json()
assert response.status_code == 200
assert len(data) >= 1
Instead of this, we could write a common function that could be called across these tests to incorporate readability, reusability and proper maintenance.
Additional info Working on this.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Keep Your Tests DRY - Telerik
Approach the design, implementation, and maintenance of your test suites with the same engineering and craftsman mindset you approach the design ...
Read more >A Better Definition of the DRY Programming Principle
One of the most frequently disregarded and misunderstood coding principle by junior developers is the DRY principle which stands for Don't Repeat Yourself....
Read more >Doesn't the DRY principle apply as much to testing code as ...
Nope. Test code should ideally be self-contained. Each testcase should be considered a separate program, independent of all other testcases and should be...
Read more >Why is DRY important? - Software Engineering Stack Exchange
DRY is a principle of software development aimed at reducing repetition of information of all kinds. Every piece of knowledge must have a...
Read more >DRY is an over-rated programming principle? - Hacker News
I found that approach much easier to test the functions and catch bugs, ... The DRY principle is intending to get you thinking...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mrsaicharan1 : OK … you might need to open a new PR, as we merged the first one!
Great!