Skip to content

proposal: testing: export all test case into human friendly format. #37770

@imiskolee

Description

@imiskolee

Feature Request - Test Case Export

Hi, All:
As we know, Golang built-in a nice test solution now, but can't export test case without real to run.

In fact We're often want to export test case to a nice format then import to another test case management tool.

So, I am asking for a new feature to export test cases.

What did you do?

The test case sample

///coment for test function
func TestFooBar(t *testing.T) {
	///Comment for test case A
	t.Run("Test Case A",func (t *testing.T) {
		///Comment for test case 1
		t.Run("Test Case 1",func (t *testing.T) {

		})
		t.Run("Test Case 2",func (t *testing.T) {

		})
	})
	t.Run("Test Case B",func (t *testing.T) {
		t.Run("Test Case 1",func (t *testing.T) {

		})
		t.Run("Test Case 2",func (t *testing.T) {

		})
	})
}

What did you expect to see?

[
  {
     "name" : "TestFooBar",
     "comment" : "coment for test function",
     "sub" : [
        {
			"name" : "Test Case A",
  			"comment" : "Comment for test case A",
			"sub" : [
				{
						"name" : "Test Case 1",
  						"comment" : "Comment for test case 1",
				},
				{
						"name" : "Test Case 2"
				}
			]
		},
		...
     ]
  }
]

What did you see instead?

can't do it now.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions