Same approach as 'Sun', however you keep the test data as they are and unpivot them with the free Microsoft Excel add-In Power Query (from Excel 2010). In this way you can keep your data source as it is and transform it quickly.
Having the data in a tabular form is a good practice for building flexible pivot table.
Having the following table structure, allow you to make the pivot you want.
Test no. Test Attribute Value
To make the transformation (actually you unpivot your data) follow the description on the MS Website.
- Import the data in Power Query (Ribbon Power Query -> from Table, cursor must be somewhere in your data)
Select the first column (test), on the Ribbon Transform, click on Unpivot Columns > Unpivot Other Columns

- Close and load to Excel (Ribbon Home)
You will get this list as data source for the pivot table:

Here the script generated from the Power Query UI.
let
Source = Excel.CurrentWorkbook(){[Name="Tabelle1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Test", Int64.Type}, {"Test A", type text}, {"Test B", type text}, {"Test C", type text}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Test"}, "Attribute", "Value")
in
#"Unpivoted Other Columns"
The pivot table is then based on the new list:
- ROWS = Value
- COLUMN = Attribute
- VALUES = Attribute (count)