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.

Improve naming scheme of parameterized tests

See original GitHub issue

With the new parameter() directive, the test names can become really large and not easy to handle, so we need to find an alternative naming scheme.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
vkarakcommented, Sep 3, 2021

If the test gets parametrised due to fixtures, then its name will have to change. In the example above, we could have a name such as TestA%f.f.p=1. If it had another parametrised fixture named g with parameter q could be TestA%f.f.p=1%g.q=1 and so on. Implementation-wise it might not be so straightforward, but let’s see 😃

Regarding the hash, I agree that it should be the standard name addressing mechanism, but I would rather compute the hash based on the raw information, i.e., class name + fixture index + parameter index or anything else that’s not based on the name.

0reactions
vkarakcommented, Oct 29, 2021

This was eventually addressed by #2166. See #2248 for improving the user experience.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Improve naming scheme of parameterized tests #1794 - GitHub
With the new parameter() directive, the test names can become really large and not easy to handle, so we need to find an...
Read more >
Making Better Unit Tests, Part 2: naming unit tests - Manning
From Unit Testing, Principles, Practices, and Patterns by Vladimir Khorikov. In this article, we'll talk about naming unit tests.
Read more >
A More Practical Guide to JUnit 5 Parameterized Tests
In this tutorial we will learn how to write JUnit 5 parameterized tests. The tutorial is structured so that it also answers most...
Read more >
Changing names of parameterized tests - Stack Overflow
This feature has made it into JUnit 4.11. To use change the name of parameterized tests, you say: @Parameters(name="namestring").
Read more >
Parameterized Tests - Medium
Tip: Use a good naming convention so that we can easily understand the test from reports itself. Now if you want to add...
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