More unit tests
We need more unit tests in runtime package.
- [x] pkg/runtime/core
- [ ] pkg/runtime/expressions
- [ ] pkg/runtime/expressions/operators
- [ ] pkg/runtime/expressions/literals
- [ ] pkg/runtime/expressions/clauses
I'm new to this project but have always had an interest in web scraping :). I can give this a go if nobody else has taken it yet...
@esell sure, let me organize the task better in order to make it easier to track the progress. Though, it's not directly related to the scraping thing :) To test Ferret with running Chrome, we need to setup integration tests first, it requires more work on infrastructure, that I just put aside for now. Ideally, it needs to run a web server that would serve both types of pages - static and dynamic, you could write tests against.
@ziflex, so these tests should be browser based? I'm looking at pkg/runtime/core right now and using errrors.go as a starting point because it appears to be pretty easy and will allow me to get up-to-speed with goconvey. I just hacked a really basic test together that looks like:
func TestError(t *testing.T) {
Convey("Should match", t, func() {
msg := "test message"
cause := errors.New("cause")
e := errors.Errorf("%s: %s", cause.Error(), msg)
ce := core.Error(cause, msg)
So(ce, ShouldNotBeNil)
So(ce.Error(), ShouldEqual, e.Error())
})
}
Should this be something that would require a mock server to test against or is generating the test data inside of the tests and passing that to the functions ok? As you can likely tell, this code base is brand new to me so I'll have to poke around a bit to get an understanding :).
@esell hey,runtime package is a package that contains a runtime for the language itself. The language is pretty agnostic and entire browser thing lives in standard library (pkg/stdlib/html).
As I said earlier, it needs more work to create tests that would cover functionality in pkg/stdlib/html/driver/dynamic.
Ok cool, I think that makes sense haha. I'll put together a handful of tests and submit a WIP PR to see what you think. If it looks good I'll keep at it, if not we can talk then ;)
@esell you can do it with small chunks. it will be easier to track the progress and make changes.
Like, you started covering runtime/core, that could be one PR. Then you can work on pkg/runtime/expressions, that would be another one.
After all PRs you'll get a hacktoberfest t-shirt :)
Hi, I am new to this project and would like to work on this if there is still need?!
Hi, I am new to this project and would like to work on this if there is still need?!
Hey, welcome!
Sure, the overall coverage is still pretty low, so any help is appreciated!
Hello, I wanna help with the test some consideration or example I should read
Hi this is my PR for add new Tests https://github.com/MontFerret/ferret/pull/734
Hello, I wanna help with the test some consideration or example I should read
Hey, thanks for your offer to help!
Drivers are not very well covered with unit tests. If http driver is relatively easy to test, then cdp requires more mocking since it has external dependencies that we need to replicate.
I've opened a PR here for more unit tests. Let me know if this is still needed.
Hi. I've opened a PR #781 for more unit test. Let me know if this is still needed.
Hi. I've opened a PR https://github.com/MontFerret/ferret/pull/791 for ForExpression unit tests. Let me know if you need any corrections to my tests.