Refactor tests
See original GitHub issueRefactor tests so they all run as part of CI.
Currently, there are tests associated with UI, deployment, algorithms, and girder client. Some of the algorithm and girder client tests use unittest and are not currently run as part of CI. This gives an artificially low value for reported code coverage. Further, many of these attach to a remote server which is mutable and may cause the tests to fail in the future.
After removing UI and deployment from this repo, the remaining tests will no longer strictly require Girder. They should be refactored so that they all run in CI.
I recommend:
- Tests are refactored to use pytest. This will result in some changes to how asserts are used. For instance, in unittest we do
self.assertTupleEqual(a, b)
while in pytest we can doassert a == b
. - Tests are refactored to run without a remove server. Since we still want to test connecting to a Girder server, we can stand up a test server in a docker container, load it with appropriate data, and test against that.
- Tests are configured to run using tox as the test harness rather than cmake. This will make it easier to test multiple python versions. To run new tests, rather than executing the test files directly, we would run something like
tox -e py37 -- -k algorithm_test
.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Should you refactor test code? - Medium
Test code is a different beast than non-test code. We generally want our tests to be extremely simple and easy to read: if...
Read more >How do I refactor unit tests? [closed] - Stack Overflow
Before refactoring a section of code, a solid set of automatic unit tests is needed. The tests are used to demonstrate that the...
Read more >Why you should refactor your test automation scripts
Refactoring in testing: The benefits. Fowler's strict definition is that refactoring is only for code. It "improves the design, maintenance, and readability of ......
Read more >3 Easy Steps to Refactoring Tests for Greater Clarity
3 Easy Steps to Refactoring Tests for Greater Clarity · Step 1: Always Start from Green · Step 2: Extract What's Common into...
Read more >Code Refactoring: What You Need to Know About It
As a tester, refactoring of code roughly translates to = in-depth testing + regression testing. In-depth testing need to include all the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As part of this, we’ll want to move all issues to the appropriate repos.
UI has moved to https://github.com/DigitalSlideArchive/HistomicsUI. Deployment has moved to https://github.com/DigitalSlideArchive/digital_slide_archive.
Before removing the UI code here, I’ll make a 2.x-maintenance branch. The main README will include links to the UI and deployment repos.