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

Organize Tests (MempoolStore Breakdown Part 1) #2197

Merged
merged 4 commits into from Sep 1, 2019

Conversation

@nopara73
Copy link
Collaborator

commented Sep 1, 2019

I decided to break down PR #2188 to reviewable parts. Because this PR moves files around, it is hard to review. Please follow my commits, instead of the total diff for review.

1. Decouple file name from class name.

Commit 4d0b274 removes nameof usages from Backend's Global.cs, because we shouldn't couple filenames to class names. Thus this PR closes #2159

2. Use [CallerMemberName] instead of nameof.

However in the tests we use the method names for specifying test data directory. The reason is, because tests should be independent and stateless, so it's not an issue if a test method name changes. Commit ab16877 removes nameof identifiers when we have to specify a data directory for the tests and rather use [CallerMemberName], because with this we don't have to update it. I also encountered many times with bugs when I just copypasted a test and forgot to update the nameof. With this, we don't have to update it anymore.

3. Divide tests to UnitTests and IntegrationTests.

Commit 16ca8ce is mainly just moving test source files around.
I divided the tests into two folders: UnitTests and IntegrationTests. I updated the CI .yaml files to only run UnitTests. We did that before, too, but now we don't have to update the .yamls every time someone adds a new unit test. I also added a README.md to the Test project, so to explain what is considered to be unit and what is considered to be integration tests:

Unit Tests run on CI. We define these as tests those have no external dependencies, however local dependencies are allowed.
We define Integration Tests as tests those have external dependencies. Because these external dependencies are unreliable, Integration Tests do not run on CI.

Examples for external dependencies are communication over the Internet, over the Tor network or with hardware wallets.
Examples for local dependencies are the file system, processes those do not interact with external dependencies, like these HWI's version command call or system mutexes.

4. Put ModelTests into their own files.

Commit 54c318c is hard to review, but it's just copypaste. All I did was that I deleted the ModelTests and put its content into separate files instead. ModelTests made no sense anymore.

nopara73 added 4 commits Sep 1, 2019

@nopara73 nopara73 marked this pull request as ready for review Sep 1, 2019

@molnard

This comment has been minimized.

Copy link
Collaborator

commented Sep 1, 2019

4d0b274 - Approved
ab16877 - Approved
16ca8ce - Approved
54c318c - Approved

@molnard
molnard approved these changes Sep 1, 2019

@nopara73 nopara73 merged commit 3528b5c into zkSNACKs:master Sep 1, 2019

4 checks passed

CodeFactor No issues found.
Details
Wasabi.Linux #20190901.4 succeeded
Details
Wasabi.Osx #20190901.4 succeeded
Details
Wasabi.Windows #20190901.4 succeeded
Details

@nopara73 nopara73 deleted the nopara73:tests branch Sep 1, 2019

@nopara73 nopara73 changed the title Organize Tests Organize Tests (MempoolStore Breakdown Part 1) Sep 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.