Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add assertion for expected % coverage #17

Open
S-S-X opened this issue Mar 26, 2021 · 0 comments
Open

Add assertion for expected % coverage #17

S-S-X opened this issue Mar 26, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@S-S-X
Copy link
Owner

S-S-X commented Mar 26, 2021

Allow asserting expected test coverage of source files with something like:

require("mineunit")

assert.coverage("init", 100, "Some branches were not called during test execution")

sourcefile("init")

describe("mytestset",function()
  it("wont crash doing everything", function()
    mymod.doeverything()
  end)
end)

There assertion itself should go to queue and tested against coverage after execution of said spec is completed.
Or possibly after all tests in selected set completed.

Why?

Few use cases, first of course you might want to ensure that at least n% of your added code is actually tested.
Second for testing things like chat commands, it is not simple to check chat output and that does not belong to API testing but with 100% coverage test included you can still be sure that your tests will actually call through all branches while using testing chat commands.

Similar for everything where one would otherwise have to check text output or action that does not have definite constant outcome, instead simply check that all branches were called to ensure that your handlers actually work as expected.
This of course is not complete testing but still able to catch most simple errors that cannot be tested well by other means.

@S-S-X S-S-X added the enhancement New feature or request label Mar 26, 2021
@S-S-X S-S-X added this to Mineunit Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

1 participant