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
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
Group member name: Nika Emadian
Function 1 name: SameSite
Function 2 name: Write
Group Member: Berat Kir
Function 1: echo
Function 2: uptime
Group Member: Timur Kaya
Function 1: Write
Function 2: writeError
Group Member: Maarten Mostert
Function 1: StripPrefix
Function 2: addCookie
Test 1 & 2: TestWriteJSON & TestRedirect
Group Member: Berat Kir
Old 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
Test 1: configureInterceptors
Old Coverage
New Coverage
Test 2: Close
Old 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
Test 1: TestFlightValueNil
Old Coverage
New Coverage
Test 2: TestFlightAddCookie
Old 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
Test 1: TestStripPrefixEmpty
Old Coverage
New Coverage
Test 2: AddCookie
Old Coverage
New 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%.
Old Coverage
New Coverage