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

Testing Strategy #3

Open
bcpeinhardt opened this issue Feb 8, 2023 · 3 comments
Open

Testing Strategy #3

bcpeinhardt opened this issue Feb 8, 2023 · 3 comments
Assignees

Comments

@bcpeinhardt
Copy link
Owner

SchnauzerUI needs an overarching testing strategy. The shape of the program is pretty well defined, so we need to decide on where and how certain things will be tested.
Currently the only tests the project has are "test scripts", which are SchnauzerUI scripts which can be run to serve as E2E tests.
It needs unit tests and "integration" tests as well. Actually launching the browser and executing scripts can be a pain, especially where timeouts are involved. Setting up the tests also requires a website to test against, which needs to be updated and redeployed each time a test is added, which is a mega pain. Finally, running webdrivers in ci/cd pipelines like github actions is always a pain.
It'd be REALLY nice if I could somehow provide test HTML to test against without launching the browser. I'll be doing some discovery related to all of this.

@bcpeinhardt bcpeinhardt self-assigned this Feb 8, 2023
@bcpeinhardt bcpeinhardt moved this to Discovery in SchnauzerUI Feb 8, 2023
@bcpeinhardt
Copy link
Owner Author

So I have decided to use cargo taurpalin to generate a test coverage report. This will help me build out unit tests to cover the parser and scanner, which will reduce the number of E2E tests required to run in an actual browser.
From there we can figure out running SchnauzerUI tests through cargo test in the browser. Ideally, rather than having some big testing webpage, I'd like to define the target HTML for the test IN the test with the SchnauzerUI script. I wanna know everything about a test just by reading the test.
What if I wrote a macro which would write the test html to a file, and then delete it after the test was done? Could I just open the filepath with SchnauzerUI, rather than setting up some kind of host?

@bcpeinhardt bcpeinhardt moved this from Discovery to Planned in SchnauzerUI Feb 14, 2023
@bcpeinhardt bcpeinhardt moved this from Planned to In Progress in SchnauzerUI Feb 14, 2023
@bcpeinhardt
Copy link
Owner Author

Wow so that worked shockingly well, I've just pushed an integration test setup with 48.59% test coverage in like, an hour. The plan for building out tests is:
Have 1 integration test for each locator strategy, each smart swap, each command, and each stmt.
Fill in the Gaps for the rest of the library with unit tests. For now I won't worry about the CLI, as I need to do some research on testing
CLAP clis.

@bcpeinhardt
Copy link
Owner Author

So I just made a commit at 62% code coverage from the integration tests. Most of the untested code is the CLI, and I'm fairly certain I'm going to keep this test setup around, so I'm gonna move this to done :)

@bcpeinhardt bcpeinhardt moved this from In Progress to Done in SchnauzerUI Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

1 participant