Skip to content

About tests organization #982

@numero-744

Description

@numero-744

Below is the first part of the path:

tester/src/test/scala/spinal/

The standard for unit tests would be:

PROJECT/src/test/scala/spinal/

So let's admit that (most) tests running simulations are integration tests, hence putting them in a separate tester/ module. It also simplifies dependencies management for the day we want to use features released in tester/ to test something from core/ or lib/.

IMHO nothing to change here 👍


tester/src/test/scala/spinal/tester/
                             ^^^^^^

Then there is the tester/ folder. As it is about integration tests, it forces to import tested things (else using the same package as the test being run would bring in scope the stuff if the same package), making tests look more like examples, to better test the user's API, which seems to be a good thing.

IMHO nothing to change here 👍


Then there are lots of tests with poor organization. Below is a suggestion:

  • drafts/ for worksheets (old things that could be removed IMHO), so that most contributors can forget them
  • path/to/item.scala where the first element of the path is basically core, lib, etc. without being repeated.
  • issues/IssueXXX.scala for bug fixes

For instance:

tester/src/test/scala/spinal/tester/scalatest/AhbLite3InterconnectTester.scala

tests:

lib/src/main/scala/spinal/lib/bus/amba3/ahblite/AhbLite3Interconnect.scala

So it would be moved to:

tester/src/test/scala/spinal/tester/lib/bus/amba3/ahblite/AhbLite3InterconnectTester.scala

Tests about different elements (elements being tested, not elements used to test other elements) would be in the deepest common element in the paths.

I think it is okay to have Apps to test Scala syntax and types among scalatest-run tests.

This way it would be easier to find and add more tests.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions