Skip to content

Instantly share code, notes, and snippets.

@XavierVal
Created June 25, 2018 07:09
Show Gist options
  • Save XavierVal/cf9c9173ceab14419ce7af5190a485c8 to your computer and use it in GitHub Desktop.
Save XavierVal/cf9c9173ceab14419ce7af5190a485c8 to your computer and use it in GitHub Desktop.
test_francisco_ogando_2018
[QA_TEST] Tech
With the intention of analysing the data of the internet portals, we want to process the content of a list of webs. We provide to you a list of URLs. You should code a solution that access to this URLs from a navigator and retrieve the title for each of the accessed URLs and store it.
Once each URL in the list has been visited you should store the titles and group those titles per each distinct domain (domian1 -> title1, title2).
Also it is required to publish this info against a web service. The info that should be sent per each domain is the median (not the AVG) of the lengths of the titles associated to each domain group.
You are required to deliver a solution to fulfil this requirements:
Read and process the JSON source containing the URLs:
http://demo8437908.mockable.io/urls
Access to the URLs and retrieve the title from the web. For instance:
url1.com: "Periódico de Noticias" or test.url1.com: "Test de noticias"
Group by the subdomain 2nd level (from the URLs) the retrieved titles, more than one title could match the same domain. For instance:
url1.com: "Periódico de Noticias", "Test de noticias".
Sent a message to the API RESTful (further details later). One call per domain. That includes the calculated median of the lengths.
More details in Web Service Section:
Export the results to an output file with the domain's name and titles.
The output file should maths this pattern:
Ur1.es;Título1,Título2
Web service: RESTFull JSON
• Url: http://demo8437908.mockable.io/title-length
• Method: POST
• Headers:
X-Auth-Token: ABCDEFGHI12345678ASDFASD
• Body example (request):
{"domain": "url1.es", "median": 6}
General tips and proposals:
Selenium WebDriver.
Requests.
The solution should read this file according to a path or url
Define a config file or set it via parameter (via shell) the origin of the ulrs file. In case of having both options the priority is the one set by parameter.
Once you have a solution working think about how it could be TESTED and IMPROVED
The logging of the script is a nice starting point for debug.
Finally, we love it when you to test your own code :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment