Playwright File Convention

New to QA and Playwright.

Related to styling and file naming conventions:

Say you have complex software with multiple endpoints that you are writing automated tests for. How would you organize your tests? My approach is to relate it to the use case of the test. i.e.

-resources
--GET
---filterResources.test.ts
---getSingleResource.test.ts
--POST

Whereas an approach was suggested to divide it down even further related to the readability of the actual test file. i.e

-resources
--GET
---filterResources.test.ts
---filterResourcesLoops.test.ts
---filterResourcesParametarized.test.ts
---getSingleResource.test.ts
---getSingleResourceLoops.test.ts
--POST

UPDATE: Upon some further digging it also seems that some prefer to take it further and have a test file for every test case. i.e.

-resources
--GET
---filterResourceBySearch.test.ts
---filterResourceByVersion.test.ts
---filterResourceByDate.test.ts
---getSingleResourceKey.test.ts
--POST

I cannot find any decent reading material covering the topic. What is the standard convention in this regard? Do you have any suggested reading material on the topic?

4 Likes

I have only just started to write tests in Playwright. At the moment I am grouping tests in files. I can well imagine that when\if I have lots of tests in Playwright I will want to subdivide some of those files. Having a convention for naming the files will be important

2 Likes