From the course: Advanced Scripting for Testers: Local Data, Spreadsheets, and Reporting

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Solution: Build and send a report

Solution: Build and send a report

(upbeat music) - [Instructor] Okay, let's work through my solution to the previous challenge. As always, it's okay if yours doesn't look like this. The value is found in trying to solve it yourself, not in getting the exact same solution as me. All right, so let's start with parsing the file. So this is going to be similar to what we did in lesson eight of chapter one. And so we'll use a similar approach to what we did there. So we'll open our gig tracker fake file, and what we'll do is we'll loop directly over this file. So we'll say for each line in the file, and then we're going to look at if HTTP/1.1 is in that line. And if it is, we want to get the status code. So we'll say our status code, and we'll do the end. So our status code is the last one. We split the line and then we get the last element here. And then we'll also do strip here just to strip off the new line characters from the end of that line. And then we'll get our date. So our date is going to be the first one in the…

Contents