0

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?

1 Answer 1

0

There is no one-size-fits-all approach for organizing tests in Playwright or any other framework. It always depends on specific needs & preferences of the team. However, you can follow some general guidelines and good practices,

One common approach is to organize tests based on the functionality or feature being tested. This can help make it easier to find tests for specific features or functions. For example:

-Resources
--User management
---Login.test.ts
---Logout.test.ts
--Inventory management
---ViewInventory.test.ts
---AddItem.test.ts
---RemoveItem.test.ts
--Payment processing
---AddPaymentMethod.te

st.ts ---MakePayment.test.ts

Another approach is to organize tests based on the type of test. This can help make it easier to find specific types of tests, such as performance tests or integration tests. For example:

-Resources
--Unit tests
---inventory.test.ts
---user.test.ts
--Integration tests
---inventoryAndUser.test.ts
--Performance tests
---inventoryPerformance.test.ts
---userPerformance.test.ts

For file naming conventions, it's important to use descriptive names that clearly indicate the purpose of the test. Some common naming conventions include using a verb-noun format or a test case format. For example:

Verb-noun format: login.test.ts, viewInventory.test.ts, makePayment.test.ts

Test case format: testLogin.ts, testViewInventory.ts, testMakePayment.ts

Most important thing is to choose an approach that works for your team & helps you stay organized and efficient.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.