Skip to content

dr-noid/go-safeweb

 
 

Repository files navigation

Report for Assignment 1

Project chosen

Name: go-safeweb

URL: go-safeweb

Number of lines of code and the tool used to count it: 13k LOC https://github.com/AlDanial/cloc

Programming language: go

Coverage measurement

Existing tool

go cover https://pkg.go.dev/cmd/cover

run the tests and save the coverage data in 'coverage.out' go test -coverprofile coverage.out ./... use the cover tool to get a nice visual display: go tool cover -html=coverage.out

coverage1 coverage2 coverage3 coverage4

Your own coverage tool

Group member name: Nika Emadian

Function 1 name: SameSite

Function 2 name: Write

GitHub Commit

Group Member: Berat Kir

Function 1: echo

Function 2: uptime

alt text

GitHub Commit

Group Member: Timur Kaya

Function 1: Write

Function 2: writeError

alt text

GitHub Commit

Group Member: Maarten Mostert

Function 1: StripPrefix

Function 2: addCookie

alt text

GitHub Commit

Coverage improvement

Individual tests

Test 1 & 2: TestWriteJSON & TestRedirect

Group Member: Berat Kir

GitHub Commit

Old Coverage

Old Coverage

New Coverage

New Coverage

The coverage for the response.go file was 0% at first and I increased the coverage to 50%, making sure to cover the two most used functions.

Group Member: Timur Kaya

GitHub Commit

Test 1: configureInterceptors

Old Coverage

Old Coverage

New Coverage

New Coverage

Test 2: Close

Old Coverage

Old Coverage

New Coverage

New Coverage

For the coverage measurement I set a flag if a branch was taken for the functions write and writeError, to see which branches were taken. Then I improved coverage for the functions configureInterceptors() in the Mux file, and close() in the Server file, improving the coverage from 84.8% to 93.5% and 35.2% to 37% respectively.

Group Member: Nika Emadian

GitHub Commit

Test 1: TestFlightValueNil

Old Coverage

Old Coverage

New Coverage

New Coverage

Test 2: TestFlightAddCookie

Old Coverage

Old Coverage

New Coverage

New Coverage

flight.go had a coverage of 89.5% initially, while by testing FlightValues it was increased to 92.1%. By testing the second function the coverage increased from 92.1% to 94.7%.

Group Member: Maarten Mostert

GitHub Commit

Test 1: TestStripPrefixEmpty

Old Coverage

Old Coverage

New Coverage

New Coverage

Test 2: AddCookie

Old Coverage

Old Coverage

New Coverage

Old Coverage

The coverage for header.go went from 82.9% to 95.3%, and the coverage for handler.go went from 87.5% to a full 100%.

Overall

Old Coverage

Old Coverage

New Coverage

New Coverage

Statement of individual contributions

About

Secure-by-default HTTP servers in Go.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 70.4%
  • HTML 29.6%