Right now, the WebUI is mostly functional, and that's great, but for quickly making changes to the project it would be nice to have some sort of test suite.
I've been working on some unit tests for various backend functions, but since many of those functions utilize the docker's client library or other outside library it's extremely unwieldy to actually try and mock them out in unit tests.
So maybe there's a few steps to take. (1) Deciding on an overall approach to testing. Do we care about unit tests? Do we just want a few end-to-end tests that cover the important functionality? That seems maybe easier but unit tests might help with coverage. (2) Creating a reasonable approach toward implementation. Right now I've added a mess of interfaces which 'own' certain types of functions. For instance, the external/ directory contains *_package.go files. One of these files is app_package.go, and the AppPackage interface owns functions like GetApps()GetAppStatuses(), so everytime you wanna use that function you have to do h.ap.GetApps() or something similar. (3) Implementation For unit tests, this shouldn't be too hard but maybe it will be more difficult to integration or end to end testing when we need to use external docker containers etc.
It would also be nice to clean up the frontend mock data stuff after we create tests and mock data in the backend to use for a mock service.
Please share your thoughts!
Right now, the WebUI is mostly functional, and that's great, but for quickly making changes to the project it would be nice to have some sort of test suite.
I've been working on some unit tests for various backend functions, but since many of those functions utilize the docker's client library or other outside library it's extremely unwieldy to actually try and mock them out in unit tests.
So maybe there's a few steps to take.
**(1) Deciding on an overall approach to testing.** Do we care about unit tests? Do we just want a few end-to-end tests that cover the important functionality? That seems maybe easier but unit tests might help with coverage.
**(2) Creating a reasonable approach toward implementation.** Right now I've added a mess of interfaces which 'own' certain types of functions. For instance, the `external/` directory contains `*_package.go` files. One of these files is `app_package.go`, and the `AppPackage` interface owns functions like `GetApps()` `GetAppStatuses()`, so everytime you wanna use that function you have to do `h.ap.GetApps()` or something similar.
**(3) Implementation** For unit tests, this shouldn't be too hard but maybe it will be more difficult to integration or end to end testing when we need to use external docker containers etc.
It would also be nice to clean up the frontend mock data stuff after we create tests and mock data in the backend to use for a mock service.
Please share your thoughts!
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Right now, the WebUI is mostly functional, and that's great, but for quickly making changes to the project it would be nice to have some sort of test suite.
I've been working on some unit tests for various backend functions, but since many of those functions utilize the docker's client library or other outside library it's extremely unwieldy to actually try and mock them out in unit tests.
So maybe there's a few steps to take.
(1) Deciding on an overall approach to testing. Do we care about unit tests? Do we just want a few end-to-end tests that cover the important functionality? That seems maybe easier but unit tests might help with coverage.
(2) Creating a reasonable approach toward implementation. Right now I've added a mess of interfaces which 'own' certain types of functions. For instance, the
external/directory contains*_package.gofiles. One of these files isapp_package.go, and theAppPackageinterface owns functions likeGetApps()GetAppStatuses(), so everytime you wanna use that function you have to doh.ap.GetApps()or something similar.(3) Implementation For unit tests, this shouldn't be too hard but maybe it will be more difficult to integration or end to end testing when we need to use external docker containers etc.
It would also be nice to clean up the frontend mock data stuff after we create tests and mock data in the backend to use for a mock service.
Please share your thoughts!