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.

[FEATURE] Parameterize testing

See original GitHub issue

🚨🚨 Feature Request

  • Related to an existing Issue
  • A new implementation (Improvement, Extension)

Improve test coverage by evaluating multiple arguments.

For example, this function tests float32 (which should throw an exception) but should test other dtypes (uint16, unint32, int16,…).

def test_image():
    with pytest.raises(ValueError):
        image = Image((1920, 1080, 3), "float32")

If your feature will improve HUB

Makes Hub more robust by improving test coverage.

Description of the possible solution

pytest can pass multiple arguments to a test function:

test_inputs = [1, 2, 3]

@pytest.mark.parameterized("foo", test_inputs)
def test_stuff(foo):
   assert type(foo) == int

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
madhucharancommented, Feb 15, 2021

The current problem with this issue is when there is no support for other dtypes, It has been created and checked for errors if any other dtype is passed other than uint8,uint16. The PR is here. Now I have included support for all float and integer variants, We probably need to update the test cases to check the int and float variant tests and raise ValueError if any unsupported dtype is passed.

0reactions
davidbuniatcommented, Feb 24, 2021

If you added support for those dtypes, then you should switch testing against raising Error, now you need to test if you can create image with such dtypes (instead of checking if throws an error.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parameterize BDD Tests | TestComplete Documentation
In BDD tests, you parameterize test steps, not scenarios or features. That is, you set parameters for the Given , When , and...
Read more >
How to parametrize values in cucumber - Webkul
On running this class,the login credentials i.e username and password will get filled from feature file with new values each time till the...
Read more >
Data Driven Testing in Cucumber - Tools QA
Parameterizing without Example Keyword · Go to the Feature File and change the statement where passing Username & Password as per below: ·...
Read more >
JUnit Parameterized Test with Example using @Parameters
Parameterized test enables developer to execute the same test over and over again using different values. It helps developer to save time in ......
Read more >
Parametrizing fixtures and test functions — pytest documentation
@pytest.mark.parametrize allows one to define multiple sets of arguments and fixtures at the test function or class. · pytest_generate_tests allows one to define ......
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