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

More unit tests #34

Open
1 of 5 tasks
ziflex opened this issue Oct 4, 2018 · 14 comments
Open
1 of 5 tasks

More unit tests #34

ziflex opened this issue Oct 4, 2018 · 14 comments
Labels
Milestone

Comments

@ziflex
Copy link
Member

ziflex commented Oct 4, 2018

We need more unit tests in runtime package.

  • pkg/runtime/core
  • pkg/runtime/expressions
  • pkg/runtime/expressions/operators
  • pkg/runtime/expressions/literals
  • pkg/runtime/expressions/clauses
@ziflex ziflex added good first issue Good for newcomers area/runtime Runtime issue hacktoberfest labels Oct 4, 2018
@esell
Copy link
Contributor

esell commented Oct 4, 2018

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...

@ziflex
Copy link
Member Author

ziflex commented Oct 4, 2018

@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.

@esell
Copy link
Contributor

esell commented Oct 4, 2018

@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 :).

@ziflex
Copy link
Member Author

ziflex commented Oct 4, 2018

@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.

@esell
Copy link
Contributor

esell commented Oct 4, 2018

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 ;)

@ziflex
Copy link
Member Author

ziflex commented Oct 4, 2018

@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 :)

@ConaGo
Copy link
Contributor

ConaGo commented Jul 2, 2021

Hi, I am new to this project and would like to work on this if there is still need?!

@ziflex
Copy link
Member Author

ziflex commented Jul 4, 2021

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!

@solrac97gr
Copy link

Hello, I wanna help with the test some consideration or example I should read

@solrac97gr
Copy link

Hi this is my PR for add new Tests #734

@ziflex
Copy link
Member Author

ziflex commented Mar 24, 2022

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.

@slowmanchan
Copy link
Contributor

I've opened a PR here for more unit tests. Let me know if this is still needed.

@tsukasaI
Copy link
Contributor

Hi.
I've opened a PR #781 for more unit test.
Let me know if this is still needed.

@rikinyan
Copy link

Hi.
I've opened a PR #791 for ForExpression unit tests.
Let me know if you need any corrections to my tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants