question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update unit-test guidelines to require independent testing

See original GitHub issue

Subject of the documentation

Now we have some tests where we test different cases sequentially inside one single function. This is not ideal as sometimes previous tests might have an unexpected impact on the following tests.

Imagine we test a function named func we can build tests as follows:

class TestFunc:
    def test_case1(self):
        ...

    def test_case2(self):
        ...

so that case1 and case2 are isolated.

In case we are just changing the values of the arguments, we can use Parametrizing tests to remove redundant code.

We do not have to refactor all existing code, but we should update the guidelines so that new tests or modified tests should be refactored.

If the documentation request is approved, would you be willing to submit a PR? (Help can be provided if you need assistance submitting a PR)

Yes

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
mathpluscodecommented, Oct 22, 2020

@s-sd I’ve updated the issue content, does it make more sense now?

1reaction
NMontanaBrowncommented, Sep 13, 2020

@mathpluscode I can work on DeepReg tickets after 28th Sept, MRes dissertation submission. Happy to work on it after then!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unit Tests, How to Write Testable Code, and Why It Matters
Essentially, a unit test is a method that instantiates a small portion of our application and verifies its behavior independently from other parts....
Read more >
Unit Testing Best Practices: 9 Ways to Make Unit Tests Shine
6. Avoid Test Interdependence ... Unit testing does not require 100% test coverage. You should set up fewer, but high-quality unit tests than...
Read more >
A Deep Dive into Unit Testing - Semaphore CI
Each unit test has to follow a set of defined requirements. Take a look at the list below: Classes should not break the...
Read more >
Unit Testing Guidelines What to Test And What Not
Find guidelines regarding unit testing- what to be unit tested or not, to what extent and so on.
Read more >
unittest — Unit testing framework — Python 3.11.1 ...
Skipping a test is simply a matter of using the skip() decorator or one of its conditional variants, calling TestCase.skipTest() within a setUp()...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found