Generating Tests from Source Code | Bondar Academy
Course: Claude Code for Playwright
Module: Playwright Workflows with Claude Code
Instructor: Artem Bondar
Lesson Summary
This video lesson focuses on generating Playwright scripts using agents, specifically through a skill called PWNewTest . The process is structured into several key steps: Steps to Generate Playwright Scripts Review Existing Test Suite: The agent checks current tests to avoid duplication and understand existing patterns. Inspect Application Source Code: The agent examines the source code based on the provided scenario and test steps. Write the Test: The agent creates a test using the appropriate naming conventions and ensures each test verifies one logical user flow. Ask User for Input: The agent prompts the user to run or adjust the generated test. Run the Test: The agent executes the test with tracing enabled. If it passes, it moves to the next step; if it fails, it enters debugging. Debugging: The agent analyzes the trace report to identify and fix issues automatically. Confirm and Finalize: The user reviews the test and confirms if it meets expectations. If so, the agent cleans up the code. Commit Changes: The agent offers to create a commit in git after the test is finalized. The lesson emphasizes the importance of staying involved in the test generation process to ensure accuracy and quality. As more tests are added, the agent becomes better at generating tests that align with user preferences. In practice, the user can automate multiple scenarios by calling the skill repeatedly, ensuring a streamlined and efficient testing workflow.