certification-tool icon indicating copy to clipboard operation
certification-tool copied to clipboard

[Feature] Allow of enabling of human-friendly logging for test runs (--trace-to json:log) as a debug option

Open tcarmelveilleux opened this issue 1 year ago • 5 comments

Feature description

--trace-to json:log decoding is much more user friendly for python tests. Then we can see logs such as:

...
[MatterTest] 08-14 09:13:07.482 INFO 	"payload" :
[MatterTest] 08-14 09:13:07.482 INFO 	{
[MatterTest] 08-14 09:13:07.482 INFO 		"decoded" :
[MatterTest] 08-14 09:13:07.482 INFO 		{
[MatterTest] 08-14 09:13:07.482 INFO 			"report_data" :
[MatterTest] 08-14 09:13:07.482 INFO 			{
[MatterTest] 08-14 09:13:07.482 INFO 				"attribute_reports" :
[MatterTest] 08-14 09:13:07.483 INFO 				{
[MatterTest] 08-14 09:13:07.483 INFO 					"Anonymous<0>" :
[MatterTest] 08-14 09:13:07.483 INFO 					{
[MatterTest] 08-14 09:13:07.483 INFO 						"attribute_data" :
[MatterTest] 08-14 09:13:07.483 INFO 						{
[MatterTest] 08-14 09:13:07.483 INFO 							"BridgedDeviceBasicInformation::uniqueID" : "\"4CED04A3961C4572\"",
[MatterTest] 08-14 09:13:07.483 INFO 							"data_version" : "2078803658",
[MatterTest] 08-14 09:13:07.483 INFO 							"path" :
[MatterTest] 08-14 09:13:07.483 INFO 							{
[MatterTest] 08-14 09:13:07.483 INFO 								"attribute_id" : "18 == 'uniqueID'",
[MatterTest] 08-14 09:13:07.483 INFO 								"cluster_id" : "57 == 'BridgedDeviceBasicInformation'",
[MatterTest] 08-14 09:13:07.483 INFO 								"endpoint_id" : "2"
[MatterTest] 08-14 09:13:07.483 INFO 							}
[MatterTest] 08-14 09:13:07.483 INFO 						}
[MatterTest] 08-14 09:13:07.483 INFO 					}
[MatterTest] 08-14 09:13:07.483 INFO 				},
[MatterTest] 08-14 09:13:07.483 INFO 				"interaction_model_revison" : "11",
[MatterTest] 08-14 09:13:07.483 INFO 				"subscription_id" : "2963187484"
[MatterTest] 08-14 09:13:07.483 INFO 			}
[MatterTest] 08-14 09:13:07.483 INFO 		},
[MatterTest] 08-14 09:13:07.483 INFO 		"hex" : "1526001CA79EB036011535012600CA06E87B3701240202240339240412182C02103443454430344133393631433435373218181824FF0B18",
[MatterTest] 08-14 09:13:07.483 INFO 		"size" : 56
[MatterTest] 08-14 09:13:07.483 INFO 	},
[MatterTest] 08-14 09:13:07.483 INFO 	"payloadHeader" :
[MatterTest] 08-14 09:13:07.484 INFO 	{
...

which is very human-readable, especially the decoded cluster content and payload.

This log format should be possible to enable via TH config.

See https://github.com/project-chip/matter-test-scripts/issues/335

Use Cases

  • Easier debugging and analysis of test results

Test Cases

No response

Additional Information

Found in 1.4 TE2

tcarmelveilleux avatar Aug 14 '24 15:08 tcarmelveilleux

Hi @tcarmelveilleux there is an issue for the frontend in order to present the log in the UI in a human-friendly format: https://github.com/project-chip/certification-tool/issues/356

If you download the execution log, the log is presented in a pretty format, while we are still not able to present the log in the UI in a human-friendly format.

In addition, there is one option in project config that you can disable the trace log, in case you don't need to much detail in the logs. Screenshot 2024-08-14 at 14 39 18

rquidute avatar Aug 14 '24 17:08 rquidute

--trace-to is part of what command?

@fabiowmm, @tcarmelveilleux, can you provide instructions to reproduce?

raul-marquez-csa avatar Aug 28 '24 03:08 raul-marquez-csa

Hi @raul-marquez-csa, the --trace-to argument is enabled, by default. At project configuration screen you will be able to turn on/off this argument by setting the trace_log to true/false.

rquidute avatar Aug 28 '24 12:08 rquidute

@tcarmelveilleux

From our conversation

  • We need a way to ensure that the executed command line for the Python tests have --trace-to json:log on it by default
  • The finding was that the python tests did not have it on the command line when launched from TH
  • This can currently be viewed in the black log at the top when you start the run, also in the downloaded logs

Anything I missed?

From the title: "human-friendly": Does human friendly mean in json format? what does it currently look like? "debug option": This to me implies it can be toggled (but on by default), is this toggle expected to be some switch in the TH UI? Per project? Per test case?

raul-marquez-csa avatar Aug 30 '24 07:08 raul-marquez-csa

After frontend PR merged, this is how it looks like now: Screenshot 2024-09-03 at 09 54 47

rquidute avatar Sep 04 '24 16:09 rquidute

@tcarmelveilleux, from the screenshot shared by @rquidute, does that resolve the issue?

raul-marquez-csa avatar Oct 22 '24 01:10 raul-marquez-csa

Yep, looks great! Can you enable/disable it or is it always enabled? In any case, the screenshot is what was needed.

tcarmelveilleux avatar Oct 22 '24 01:10 tcarmelveilleux

Hi @tcarmelveilleux it is always enabled 👍

rquidute avatar Oct 22 '24 12:10 rquidute