Closed danielbate closed 10 months ago
Good stuff @danielbate! π
Somewhat related, we also have this:
We can resume the work on it now that #984 was merged.
Here's the spec from the last attempt:
Good point @arboleya! Will add a task for just that.
Do you mean other than the #284?
Apologies, I will not be writing any more issues but I will be using the above task list as a reference to track changes made to bring us closer to adhering to the above standards. So I just meant that I will add another task to the above list, that references #284.
The above requires updating due to further developments, however this is a good classification from @arboleya that will insight the specification:
Unit = Worries about units, usually mocking external stuff Feature = Worries about features, not mocking or mocking minimally Integration = Tests that target fuel-core locally E2E - Tests that target fuel-core remotely
Here's how these tests could be spread in directories:
<package-name>
βββ src
βΒ Β βββ index.test.ts # This would be a unit
βΒ Β βββ index.ts
βββ test
βββ e2e
βββ feature
βββ fixtures
βββ integration
βββ utils
I ended up with test/{fixtures,utils,feature}
in:
It worked great, and I think all packages should segregate their tests.
This goes back to maybe re-distributing all tests from inside fuel-gauge
to other packages, and although something like this might not work (because these tests must import from fuels
):
packages/contract/test/integration/contract.test.ts
One thing that could work is:
packages/fuels/test/integration/contract.test.ts
As we approach mainnet, it is important we start to implement some stricter testing standards that ensures parity with the protocol/FuelVM and gives us the greatest level of confidence in the changes we are making as uptake in the SDK increases. Additionally, we can consolidate and structure our testing to give greater clarity as to what behaviours we are currently supporting. I would like to propose some MoSCoW testing standards as well as a roadmap of changes to bring the current SDK in line with the standards.
Where we are now
fuel-gauge
for feature and integration level testingforc
projects for testsProposed standards
utils
packagesGiven X, When Y, Then Z
- for unit tests onlywhen
andthen
are usually required as thegiven
is our service under test. We can then utilise theit()
syntax for unit tests andtest()
syntax for feature and integration tests)master
(coverage level TBD)Tasks (TBD)
This should bring greater clarity to the behaviours supported by the SDK, give greater confidence in the quality of our tests and increase overall coverage as discussed in #753 . All standards and tasks are up for discussion and I would appreciate any insights π