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

Needs more tests #54

Closed
23 of 41 tasks
xd009642 opened this issue Oct 11, 2017 · 7 comments
Closed
23 of 41 tasks

Needs more tests #54

xd009642 opened this issue Oct 11, 2017 · 7 comments

Comments

@xd009642
Copy link
Owner

xd009642 commented Oct 11, 2017

So tarpaulin is in need of some more tests. Currently I'm relying on a small number of tests and doing informal runs of projects to test things but as more features get added on this becomes harder to do.

There are a few areas I'd like to tackle, if anyone chooses to help I'm willing to help mentor you through any issues and generally help out.

Integration tests

  • Test tarpaulin on run throughs of more of the test projects
  • Assert against lines that should be hit
  • Try with more variations of config options
  • Create examples that represent coverage requirements derived from Inaccurate coverage estimates #63

Unit tests
This one is a bit trickier based on the reliance of ptrace or processing a binary in tarpaulin.

  • More unit tests for the source_analysis module would be useful.
  • Look to test report generation - particularly cobertura reports
  • Look for more testable areas that don't rely on external files or ptrace

Test projects for all Rust expression types
List taken from syn

  • Box
  • Array
  • Call - adequately covered by other tests
  • MethodCall
  • Tuple
  • Binary
  • Unary
  • Lit - covered by any constants in other tests
  • Cast
  • Type
  • Let
  • If
  • While
  • ForLoop
  • Loop
  • Match
  • Closure
  • Unsafe
  • Block
  • Assign - <expr> = <expr> form so way more to test than I've done but covered by a lot of others
  • AssignOp
  • Field
  • Index
  • Range
  • Path
  • Reference
  • Break
  • Continue
  • Return
  • Macro
  • Struct
  • Repeat
  • Paren
  • Group
  • Try
  • Async
  • TryBlock
  • Yield

Bonus challenge
Related to the issue with unit tests. This is potentially a challenging issue and might be ultimately more trouble than it's worth but is at least worth an investigation. It might even result in the genesis of a design that enables future non-Linux based development as I imagine it will result in a coverage tracing trait of some form.

  • Look into stubbing solutions to test tarpaulin with a simulated ptrace
@xd009642
Copy link
Owner Author

So for those that are interested I've pushed a new remote branch issue-54 to demonstrate my thoughts on testing for regression coverage in covering rust expressions. This has a project that should get 100% coverage and tests it gets this. If it doesn't it's because it's trying to cover additional instructions that aren't hit or the wrong instructions and missing them either showing that source_analysis needs updating or test_loader needs updating

@xd009642
Copy link
Owner Author

Examples of how to write these tests are in tests/mod.rs and tests/data projects if anyone fancies helping out 😄

@camchenry
Copy link
Contributor

Is this list up-to-date? I'd like to have a try at adding another test, specifically the loop functionality, since that seems like an important one to test.

@xd009642
Copy link
Owner Author

xd009642 commented Oct 4, 2019

It should be look in tests/data they tend to be named after what they test

@camchenry
Copy link
Contributor

camchenry commented Oct 5, 2019 via email

@xd009642
Copy link
Owner Author

xd009642 commented Oct 5, 2019

pick a language construct from the list that hasn't been done (I think the names were taken from expression types in syn so you can use that for reference). Then write a small project that uses it in a number of different ways that should get 100% coverage.

Once that's done you can add it to the projects that get run by adding a named test for it in tests/mod.rs

@xd009642
Copy link
Owner Author

xd009642 commented Jul 8, 2020

I'm just going to close this issue, we've got a relatively good language coverage via the different users and current tests (34 small test projects) and most coverage issues appear in larger crates.

Instead as a strategy I'm moving to a more directed projects that recreate issues users observe.

@xd009642 xd009642 closed this as completed Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants