urbanadventurer / WhatWeb

Next generation web scanner
https://www.morningstarsecurity.com/research/whatweb
GNU General Public License v2.0
5.45k stars 897 forks source link

Testing and Continuous Integration #186

Closed andrericardo closed 6 years ago

andrericardo commented 7 years ago

Hello, I would like to add some initial tests, but running them with the current whatweb is a bit tricky. For example the simple run $ ./whatweb slashdot.org reddit.com hangs when ran in rake maybe because rake eats the ARGV ? and the target list ends up being

Target List:["http://test/test*.rb"]

The whole full log is here: https://travis-ci.org/andrericardo/WhatWeb/jobs/165846465

My branch code is here https://github.com/andrericardo/WhatWeb/blob/continous-integration/test/test_whatweb.rb

From what I read it would be easier if whatweb had

if $0 == __FILE__
  # scripty bits
end

Is this something you are interested in having?

bcoles commented 7 years ago

Hi @andrericardo

We've been looking at implementing unit tests recently.

I'm not convinced the if $0 == __FILE__ approach would work here without some other refactoring (threads and command line parsing for starters).

Ideally the tests could be performed by instantiating a WhatWeb object then calling methods on the object. This would require some refactoring.

Perhaps in the short term you could fork a process and parse the output?

urbanadventurer commented 6 years ago

Thanks for the suggestion @andrericardo. Travis CI looks like a good platform for testing.

Thanks @bcoles for writing the Rake unit tests.