<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Paul Grandjean on Medium]]></title>
        <description><![CDATA[Stories by Paul Grandjean on Medium]]></description>
        <link>https://medium.com/@pgrandje?source=rss-18f070d71710------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_FT_BK9yJc_x8F-Qi2s9mA.jpeg</url>
            <title>Stories by Paul Grandjean on Medium</title>
            <link>https://medium.com/@pgrandje?source=rss-18f070d71710------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 12:02:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pgrandje/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Experiment #2: Letting Playwright MCP Write My Tests]]></title>
            <link>https://medium.com/@pgrandje/letting-playwright-mcp-write-my-tests-824e54d587d8?source=rss-18f070d71710------2</link>
            <guid isPermaLink="false">https://medium.com/p/824e54d587d8</guid>
            <category><![CDATA[playwrights]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[playwright-mcp]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[end-to-end-testing]]></category>
            <dc:creator><![CDATA[Paul Grandjean]]></dc:creator>
            <pubDate>Fri, 13 Nov 2026 23:37:39 GMT</pubDate>
            <atom:updated>2026-11-18T18:14:01.453Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Experiment #2: what happened when Copilot and the Playwright MCP agents wrote every line of code</em></h4><p>Playwright MCP is really powerful, but you still have to tell it everything. That’s the main lesson from my second experiment in AI-generated Playwright tests - <em>give very specific instructions.</em> A couple of times, Copilot led me astray, and I only got back on track by questioning what it told me.</p><p>This is Experiment #2 in my series on how best to use AI to generate Playwright end-to-end tests. In <a href="https://medium.com/@pgrandje/ai-generated-playwright-tests-experiment-1-no-mcp-014dae1137e0">Experiment 1</a>, I strictly used GitHub Copilot without Playwright MCP to completely generate tests without touching code. This time I did the same but used Playwright MCP. This post describes what I learned.</p><p>It took me a while to get this out because there was a lot to learn. It’s long and detailed, covering the problems I ran into along the way. Playwright MCP should save time when building a test suite from scratch, as long as you plan your agent instructions well. If you’re short on time, read the key takeaways, jump to the conclusions and come back to the details as needed.</p><h3>Key Takeaways</h3><ul><li><strong>Playwright MCP is powerful, but it isn’t hands-off.</strong> You still have to tell it everything. The effort moves into configuring the agents, as opposed to the bulk of the effort put into the prompting to your AI client. That setup however should be reusable.</li><li><strong>Each agent is limited by its tool list.</strong> The Generator couldn’t edit files outside /tests until I changed its configuration.</li><li><strong>Conflicting instructions can fail silently.</strong> Copilot picked one of my two conflicting rules and never mentioned the other. Asked afterward however, it could point me to the exact lines that were conflicting and recommend changes. But I had to review its work and catch the error first.</li><li><strong>Ask Copilot to check itself.</strong> When its answers sounded misleading, questioning them produced better ones. Rely on your intuition. If something doesn’t seem quite right and ask. (Just like you would probably do with a coworker!)</li><li><strong>Review the test plan.</strong> Copilot sometimes fills gaps with its own assumptions.</li><li><strong>Watch the template files.</strong> seed.spec.ts and example.spec.ts become part of your suite unless you say otherwise.</li></ul><h3>What is Playwright MCP?</h3><p>Playwright MCP provides three customizable agents: the Test Planner, Test Generator, and Test Healer. They use the Model Context Protocol (MCP) to provide specific services to an AI client such as GitHub Copilot, and they’re included in recent Playwright releases.</p><p>Naveen Khunteta provides a good tutorial, and the Playwright documentation is also useful:</p><ul><li>Naveen Kunteta’s <a href="http://youtube.com/watch?v=ld9gB348SEM">Playwright MCP Tutorial</a></li><li><a href="https://www.shapemyinterview.com/resources/playwright-mcp-ai-agents-guide">https://www.shapemyinterview.com/resources/playwright-mcp-ai-agents-guide</a></li><li><a href="https://playwright.dev/docs/getting-started-mcp">https://playwright.dev/docs/getting-started-mcp</a></li><li><a href="https://playwright.dev/docs/test-agents">https://playwright.dev/docs/test-agents</a></li></ul><h3>Tools Used</h3><p>I used the following tools:</p><ul><li>GitHub Copilot Free, with Auto for the model</li><li>Playwright 1.64.0 (latest version)</li><li>VS Code 1.136.1</li><li>Playwright MCP with its three agents</li></ul><h3>Method</h3><p>I kept everything the same as in <a href="https://medium.com/@pgrandje/ai-generated-playwright-tests-experiment-1-no-mcp-014dae1137e0">Experiment 1</a>. I generated tests against my simple photography website, paulgrandjeanphotography.com. Copilot generated all the code, and I prompted it to follow common end-to-end standards such as the Page Object Model. Since this is Playwright in TypeScript, I also required it to use fixtures in a base-test file.</p><p>I gave explicit instructions to each Playwright MCP agent, plus global instructions for all agents in .github/copilot-instructions.md. In both cases I started with Naveen Khunteta’s agent instructions and modified them slightly to match some standards that have worked well for me in the past. (For example, I prefer my test assertions in ‘verify-methods’ within the page objects to make the tests shorter and more readable).</p><p>As in Experiment 1, I didn’t touch any code. I relied strictly on Copilot prompts and agent instructions for all the code writing. The only files I edited were the agent instruction files and the README.md. My chat dialog with Copilot is in the linked code repository.</p><h4>Setting up Playwright MCP</h4><p>I let Copilot handle the Playwright install and MCP setup. But beforehand I read through the Playwright MCP documentation and watched Naveen Khunteta’s tutorial video to be sure I understood the setup. This wasn’t as straightforward as it sounds and I went back-and-forth with Copilot several times. Although, it did help me understand how agents work in VSCode and Copilot.</p><h4>Changing the out-of-the-box agent instructions</h4><p>The default agent instructions needed changes. They appear to be minimal examples; page objects, for instance, aren’t mentioned. I modified playwright-test-planner.agent.md and playwright-test-generator.agent.md. I left the Healer alone to see how it would do with its default instructions.</p><h4>Running the Planner</h4><p>You have to use one agent at a time. You can’t generate the test plan and the test code all at once. You first select the agent you want from the dropdown in the VS Code Copilot window. Select the Planner to generate a test plan, then the Generator to write the tests, then the Healer to verify the tests and fix any bugs, in that order.</p><p>The Planner took over five minutes, even for this small site. It asked for confirmation several times (confirmation requirements can be specified in the agent instructions). It also said it needed to “set up” the planner first. It wasn’t clear what needed setting up or whether that could have been done up front. Something to investigate at some point but I didn’t want to distract from my main goal.</p><h4>Running the Generator</h4><p>I had to click “Allow” several times to approve generation actions. I believe this was because my <em>copilot-instructions.md</em> file required approval for certain actions. I may refine this later to make it more automatic, but it’s probably best to be cautious at first so I can monitor what Copilot is doing.</p><h3>The Code</h3><p>The generated code has been uploaded to GitHub <a href="https://github.com/pgrandje/PlaywrightAI-GeneratedExample2">https://github.com/pgrandje/PlaywrightAI-GeneratedExample2</a>.</p><p>Note that the full chat transcript is included.</p><h3>Results</h3><h4>Installation and initialization</h4><p>During installation, Copilot gave me overly detailed information that distracted from the task at hand. I sensed this, but it was more intuition than knowledge. When I questioned Copilot’s responses, it acknowledged it was leading me astray and gave me better answers.</p><h4>Fine-tuning the agent instructions</h4><p>The first pass with the Generator didn’t complete. An instruction from the example I’d borrowed prevented Copilot from writing to any folder other than /tests. That blocked it from adding fixtures in /fixtures and page objects in /pages.</p><p>Once I asked why it hadn’t written the fixtures, Copilot explained the problem and recommended instructions to resolve the conflict. I pasted those into copilot-instructions.md, which fixed it.</p><p>Next, though, Copilot said it didn’t have an edit tool that works across the entire project:</p><blockquote><strong><em>Copilot: </em></strong><em>“The instructions now allow creating the fixture, but this session still has no general workspace file writer…..</em></blockquote><blockquote><em>Please switch to a coding session with general workspace editing enabled, and I can create the fixture and generate the tests there.”</em></blockquote><p>Once again Copilot was giving me useful information but with a recommendation leading me astray. It was saying I had to switch to a new chat and select the “built-in Agent mode…”. That didn’t sound right. Could the playwright-test-generator really be that limited? So I asked, and got a response that made more sense:</p><blockquote><strong><em>Copilot: </em></strong><em>“Yes. The test-generator agent’s tools: list is an allowlist. It currently includes Playwright browser and test-generation tools, but no general workspace editor, so its writer can save specs under tests but can’t create src/fixtures/ or src/pages/.</em></blockquote><blockquote><em>To keep using that agent, add VS Code’s workspace editing tool to tools: in playwright-test-generator.agent.md, while keeping the existing playwright-test/* tools. Select the editor tool from the agent’s available-tools picker; its exact name can vary by VS Code version. Add a terminal or test-running tool too if you want the agent to validate the generated tests.</em></blockquote><blockquote><em>Then the generator can use the workspace editor for fixtures and page objects, and generator_write_test for spec files. Your updated copilot-instructions.md provides the project rules, but it doesn’t grant tools by itself.”</em></blockquote><p>So I needed to enable the VS Code editing tools for the playwright-test-generator agent.</p><p>To fix this, I opened playwright-test-generator.agent.md in the editor and clicked the tiny <em>Configure Tools...</em> link near the top of the file. Then selected the editing tool. After which VS Code however the format from an indented dash list to a block list using square brackets. It also didn’t indent under the tools: header, so the editor showed a <em>“Missing Value”</em> error. I worked through this with Copilot’s help, but it was another back-and-forth. You definitely need to intervene at times.</p><h4>Generating the tests</h4><p>Once I got past these setup problems, it took about 30 minutes to generate the tests. I had to approve multiple requests along the way, triggered by instructions meant to limit potentially destructive actions. That meant I also had to take the time to read Copilot’s responses.</p><h4>Still No Page Objects</h4><p>After the tests passed, reviewing the generated code still found no page objects. When I asked Copilot, it said I had two conflicting instructions. But instead of telling me, it had just picked one and went with it! Here’s the exchange:</p><blockquote><strong><em>Me:</em></strong><em> “Why didn’t you use page objects? That was in the copilot-instructions. Did you miss that?”</em></blockquote><blockquote><strong><em>Copilot:</em></strong><em> “I saw the page-object guidance, but I gave too much weight to the later exception saying to keep a test in the spec when it remains clear without a page object. That was a poor call for this suite: the instructions also define a BasePage contract and require page objects to be registered as fixtures, and I should have reconciled those rules instead of defaulting to inline locators.</em></blockquote><blockquote><em>So I didn’t completely miss the text, but I failed to follow the project’s intended architecture. The generated tests should be reviewed for a page-object refactor.”</em></blockquote><blockquote><strong><em>Me:</em></strong><em> “Ok, do I need to revise the instructions so it’s more clear?”</em></blockquote><blockquote><strong><em>Copilot:</em></strong><em> “Yes, if you want page objects used consistently. The current instructions are ambiguous: they define a page-object contract, but also say to keep a test in the spec if it can remain clear without one. I interpreted that as permission to use inline locators.</em></blockquote><blockquote><em>If page objects are mandatory, remove that exception and add an explicit rule such as: “Every test must use page objects for page locators and actions, even for simple scenarios. Specs should coordinate page objects and assert outcomes; they should not contain page locators or interaction logic.”</em></blockquote><p>Well at least Copilot admits to its mistakes when called out. And on my part, I had missed a conflict between the original template and the page-object conventions I’d added. The cool thing is that once I asked, <em>Copilot knew about the conflict and could even tell me the conflicting line numbers within the agent instructions.</em> I removed the conflicting line from the original template and asked Copilot to refactor using the page-object instructions, which took it about 8 minutes.</p><h4>Paths and Folder Cleanup</h4><p>And, still another lesson learned. Copilot resolved relative paths from the project root, not from the context of our conversation. I found the /tests folder sitting outside /src which contained all the other code. I had Copilot move it and update its own instructions so it wouldn’t repeat the mistake. It moved the folder but left the old &lt;project root&gt;/tests folder behind. Sheesh, you have to tell it everything! It turned out Copilot had no tool for removing folders. After several more minutes of back-and-forth trying to configure one, I deleted the folder myself, which Copilot also recommended. That violated my principle of letting the AI do all the code manipulation, so I asked:</p><blockquote><strong><em>Me:</em></strong><em> “Ok, but I’m trying to test if all the code manipulation can be done by AI, i.e., yourself. Of course it was easier to just delete the folder myself. But going forward for something so simple I’d prefer that you do it. How can we have you do it next time?”</em></blockquote><blockquote><strong><em>Copilot:</em></strong><em> “You’re right: deleting the empty folders was simple, and I should have been clear about the limitation sooner.</em></blockquote><blockquote><em>The playwright-test-generator agent only has the tools exposed in its Configure Tools list. Since that list has no folder-removal tool, I can’t delete directories from that agent. For similar cleanup next time, switch this same chat to a coding/Agent mode that has workspace file operations or terminal access, then ask me to remove the empty directory. If you want the generator agent itself to do it, it needs a dedicated folder-delete tool; enabling its existing Edit tool doesn’t add that capability.”</em></blockquote><p>This is another limitation of the playwright-test-generator agent. And I didn’t see a folder delete tool that I could add. It’s probably by design, to prevent accidentally deleting lots of folders. I’ll accept it as a safety rail and won’t try to add that capability.</p><p>Also, after the tests were in /src/tests, some were in subfolders I didn’t need:</p><blockquote><strong><em>Me:</em></strong><em> “Ok, and I don’t need subfolders under /tests, I just need all the tests listed at the same level. Can you move them all under /tests, and if you can, remove the folders “contact”, “content”, and “core”. If not, I’ll remove those once the tests are moved.”</em></blockquote><p>Instead of removing the subfolders, it moved everything back to &lt;project root&gt;/tests, undoing the move I’d just had it do! So I told it:</p><blockquote><strong><em>Me:</em></strong><em> “No no no! sorry, I meant under /src/tests where I just had you move the tests to. Sorry, I thought at this point you had the context. Please use /src/tests but with no subfolders under that.”</em></blockquote><p>That put all the test files in the correct /src/tests folder, with the unused paths removed. It was definitely more complicated than just doing it myself! (I do recognize the irony that this was at least the second time I apologized to Copilot!)</p><h4>The seed file</h4><p>Finally, the playwright-test-generator agent uses seed.spec.ts to generate tests. I asked Copilot whether it could be deleted, and it said:</p><blockquote><em>“The test plan and generator instructions reference it for browser setup. Deleting it alone could break future generation. The generator can run without an explicitly supplied seed, but its tool says it will create a default seed file, so that may still introduce a placeholder into the suite.”</em></blockquote><p>I decided it’s best to leave this alone for the time being until I can dedicate some time to put a seed-spec template directly into the Generator’s instructions and test it out.</p><h3>Verifying the tests</h3><p>The Generator can’t run the tests it creates. For that, switch to the Healer, which has the test_run and test_list tools, or to the general Copilot agent, which can also edit files and run tests. Of course switching to the general agent would negate my purpose of evaluating Playwright MCP so I switched to the Healer.</p><p>Once the tests were run, they all passed the first time and no fixes were needed. I ran them from both the Healer and manually from VSCode to be certain.</p><h3>Final code review</h3><ul><li>I identified a page object file covering the Playwright documentation. When I asked Copilot, it said that was a mistake, and that it had applied the playwright-generator rules to the example.spec.ts file, which was part of the Playwright installation. I had Copilot clean this up for me and remove example.spec.ts.</li><li>The Playwright Generator saw that some page object methods were common to multiple pages so <em>it automatically created a base class for them, putting the common code in that base class</em>. It did this without being asked!</li></ul><h3>Conclusions</h3><ul><li><strong>Trust your intuition.</strong> Ask Copilot whether what it’s giving you is correct.</li><li><strong>You still have to give it a lot of instructions,</strong> but with Playwright MCP the effort goes into setting up the agents which should be reuseable.</li><li><strong>Review the generated test plan.</strong> Copilot may make assumptions when something isn’t specified.</li><li><strong>Copilot can fail to infer the current context</strong> so it doesn’t hurt to clearly tell it to use the previous prompt and its response when sending a new prompt.</li><li><strong>Playwright MCP agents also limit AI capabilities more than a general Copilot VS Code agent. </strong>That could be by design to protect against catastrophic errors (I’m not conjecturing on that point). What had worked without Playwright MCP may not work with it. This was confusing. When I asked, Copilot could explain the limitations, but its first explanations weren’t clear either and I had to ask follow-up questions.</li><li><strong>Be careful about conflicting instructions.</strong> Copilot may default to one and ignore the other without telling you.</li><li><strong>Copilot will suggest changes to its own instructions </strong>if you ask.</li><li><strong>Watch for </strong><strong>seed.spec.ts and </strong><strong>example.spec.ts.</strong> They become part of the suite and Copilot will work on them as well unless you say otherwise. However, also be aware the Playwright Generator instructions use seed.spec.ts as a boilerplate for how tests should be structured.</li></ul><h3>Next steps</h3><p>This exercise now suggests several more things to try.</p><ul><li>Retry this experiment, but now with the fine-tuned agent instructions to see if Copilot will efficiently write the tests in one go, now that I know what the agent instruction should be.</li><li>Use the agent configurations and tool selections I learned here against a larger application under test and evaluate the efficiency in generating the tests.</li><li>Fine-tune the Healer. I never needed it to fix anything, so that work is still to do. Additionally, some of my reading claimed it’s the Healer that takes the most amount of work to fine tune for an existing real-life application under test. One has to be careful about not allowing the Healer to ‘fix’ tests that should be failing due to an actual bug in the application.</li><li>Try putting a test boilerplate directly in the Generator’s instructions to get around needing <strong>seed.spec.ts</strong>.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=824e54d587d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI-Generated Playwright Tests: Experiment 1: No MCP]]></title>
            <link>https://medium.com/@pgrandje/ai-generated-playwright-tests-experiment-1-no-mcp-014dae1137e0?source=rss-18f070d71710------2</link>
            <guid isPermaLink="false">https://medium.com/p/014dae1137e0</guid>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[playwright-mcp]]></category>
            <category><![CDATA[playwright-community]]></category>
            <category><![CDATA[test-generation]]></category>
            <category><![CDATA[ai-code-generation]]></category>
            <dc:creator><![CDATA[Paul Grandjean]]></dc:creator>
            <pubDate>Mon, 12 Oct 2026 23:46:26 GMT</pubDate>
            <atom:updated>2026-10-12T23:46:26.512Z</atom:updated>
            <content:encoded><![CDATA[<p>(This is the first article in a short series)</p><h3>Summary</h3><p>Copilot alone can generate decent Playwright tests, but only if you tell it everything.</p><p>Like many taking the AI revolution seriously, I’m documenting my process as I learn how best to use LLMs to generate Playwright tests. I’m doing this as a series of experiments, and this is the first.</p><p>I wanted to see how well Playwright tests could be generated with and without Playwright MCP, and how much prompting an LLM needs to produce tests that are readable, maintainable, and follow best practices.</p><h3>Method</h3><p>For this experiment I used the following tools.</p><ul><li>GitHub CoPilot-Free for the LLM with Auto for the model.</li><li>Latest version of Playwright, 1.64.0</li><li>VS Code v 1.136.1</li></ul><p>I generated tests against a very simple website that I own, paulgrandjeanphotography.com. It’s publicly accessible and requires no login, which kept things uncomplicated for my first couple of experiments. The site has a simple subscription sign-up form and a main menu that navigates to pages showing my photography.</p><p>All the code was generated by Copilot. I prompted it as needed to build the tests and to organize the code in a standard, readable way. For example, one prompt asked for page objects, and others had to specify naming conventions and where assertions should be placed. In a couple of cases, after reviewing the output, I asked Copilot to use more meaningful variable or method names. After each prompt and response, I reviewed the generated code.</p><p>I never touched the code manually. The only file I wrote by hand was the README.md.</p><h3>The Code</h3><p>The generated code has been uploaded to GitHub <a href="https://github.com/pgrandje/PlaywrightAI-GeneratedExample1">https://github.com/pgrandje/PlaywrightAI-GeneratedExample1</a>.</p><h3>Results</h3><p>Even without Playwright MCP, much if not most of the process can be done directly from Copilot. The catch is that you have to tell it everything: how to design and organize the code, which tests to write, how to treat the page objects, and what to put in them.</p><p>For a simple site like this one, it didn’t save much time and may have been a little slower. For a larger site, it could probably save time if the prompts are chosen carefully.</p><h3>Conclusions</h3><p>I did this experiment as a step in my own learning. I could have dived straight into Playwright MCP, but I wanted to see what the process looks like for someone just starting out who may not yet know about Playwright MCP.</p><p>My main takeaway is that it would be a time-saver to <em>create prompts ahead of time as a reusable standard</em>. I also learned that Copilot supports a “skills file” (placed in a .github/skills/ directory) where you could probably store a set of standard prompts that act as defaults for all test generation.</p><p>However, there is even a better way. Use Playwright MCP agents, configured with instructions that communicate your organization’s coding standards. When the agents are initialized, default instructions are created for each agent in a .md file. These can then be modified to your own standards. This appears to be the recommended approach.</p><h3>Next Experiment….</h3><p>The next step in this learning process will be to</p><ul><li>Generate the same test suite using Playwright MCP.</li><li>Use the Agents.md file to set coding standards and directory structure.</li><li>Use the default Playwright MCP agent configurations (tuning these defaults will be a later experiment).</li></ul><p>Stay tuned.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=014dae1137e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Playwright: The Best of Cypress and Selenium]]></title>
            <link>https://medium.com/@pgrandje/playwright-the-best-of-cypress-and-selenium-181bfe1c3316?source=rss-18f070d71710------2</link>
            <guid isPermaLink="false">https://medium.com/p/181bfe1c3316</guid>
            <category><![CDATA[cyprus]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[playwright-test]]></category>
            <dc:creator><![CDATA[Paul Grandjean]]></dc:creator>
            <pubDate>Mon, 13 Nov 2023 04:18:06 GMT</pubDate>
            <atom:updated>2023-12-02T19:28:43.430Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*3gYpfXoj2J5puVZUnWE8Rg.jpeg" /></figure><p>No doubt you’ve heard of at least one, and quite possibly, all three of these tools. These are the primary end-to-end testing tools used in the industry today. And so here I’ll provide a brief synopsis of their differences that I hope will provide a foundation that illustrates why, and when, they are used at different organizations.</p><p>My intent is to provide a brief synopsis showing the main points. There are articles available which compare these tools in a greater depth. I’ve listed a few of those at the end of the article in the References section.</p><p>I’ll also mention that sprinkled in here are some of my own opinions based on my experiences using each of these tools.</p><h3>Four Generations</h3><p>These tools represent multiple generations of E2E testing tools, and each was a response to limitations and improvements on their immediate predecessor.</p><p>Let’s start though in the early 2000s with the commercial E2E testing tools. The most widely used tool was Mercury by Mercury Interactive. This was eventually bought by Hewlett-Packard (and renamed at one point as QTP). Mercury is the great-grandfather.</p><p>Next came Selenium. Started in 2004, it has evolved into a suite of tools used for E2E testing. And I’ve heard the Selenium community at one point describe it as a “protocol” for driving the browsers to support testing. Nowadays when one talks about Selenium they’re usually referring to Selenium-Webdriver which includes the Selenium-Server and a corresponding client-library API in whichever language they happen to be coding in. Fun fact — the Selenium authors named their tool Selenium because that is the chemical element that serves as the antidote to Mercury poisoning.</p><p>Selenium is the wise and well-experienced grandfather. The Selenium way of doing things can require more steps to get started than the newer generation tools. However it’s been around a long time and has a large, international, and very supportive user base with well-established best-practices and a wealth of published information and examples.</p><p><strong>Cypress</strong></p><p>Cypress appears to be designed by front-end developers for front-end developers. It quickly gives E2E testing tool capabilities to front-end developers already experienced in JavaScript. In that service it does very well. And it’s added some nice features that Selenium didn’t have. One notable feature is intercepting network calls to control backend responses in your tests. Cypress is now widely used and has a large user community and information is widely available.</p><p>Cypress is the parent. Mostly up to date with latest techniques and not too long ago was the new trend-setter but now is established, and a little too busy with its current tasks to stay caught up with the latest trends.</p><p><strong>Playwright</strong></p><p>Playwright is relatively new with it’s first release in January 2020. It may be the “young upstart” however it has been rapidly gaining acceptance. It’s adoption rate, user base, and available coding examples appears to be growing rapidly. I’m now seeing many more blog articles with coding examples than I did when I first started using it a year and a half ago.</p><p>Playwright has taken the strongest features of its predecessor tools. It has used, and improved on, syntactic constructs and features from Cypress, but also retains the full browser support from Selenium. Playwright has also expanded on the abilities of both to configure test suite features with many useful settings easily configured from a central configuration file.</p><p>Playwright is the newest generation, the child. Actually, Playwright appears to be fairly bug free for such a new tool and so a better analogy might be an ambitious recent college graduate.</p><h3>Technical Comparisons</h3><p>Here are the primary characteristics of each tool listed separately.</p><p><strong>Selenium</strong></p><ul><li>Supports many languages including Java, JavaScript/TypeScript, Python, C#, Ruby, and PHP.</li><li>Large user community and widely-available information and examples.</li><li>Typically takes time to setup the first time, in particular to get the test code to connect to the Selenium-Server.</li><li>A basic test framework requires some experience to setup. Requires experience with object-oriented programming and with a test-engine such as JUnit.</li><li>Can run tests in parallel with a test engine that supports it. In the JavaScript-based client libaries such as NightWatch parallel execution support comes with the framework and works with little setup. Parallel execution is supported at the test-file level (similar to Cypress). For other supported languages some programming experience with basic parallel execution is required to ensure the browser-driver is thread-safe.</li><li>Most browsers supported including older ones such as Internet Explorer.</li><li>Selenium uses the browsers installed on your operating system. If browers automatically update there’s the potential for tests to fail if Selenium isn’t also updated in parallel. Historically, since Selenium is a volunteer run project, there is sometimes is a gap between when browser updates are available and when Selenium is updated to support the new browsers. However the Selenium Manager is a more recently developed tool that addresses these issues. The Selenium Manager downloads browsers if they are not already installed and manages updates to the browser-drivers which provide the interface between the Selenium-Server and the browsers themselves.</li></ul><p><strong>Cypress</strong></p><ul><li>Must be programmed in JavaScript or TypeScript.</li><li>Large user community, although likely not as extensive as with Selenium.</li><li>Easy to install and get started.</li><li>Test framework is easier to build than Selenium assuming some knowledge of JavaScript and TypeScript.</li><li>Can run tests in parallel based on a command-line parameter. Parallel execution is limited to running the test files in parallel but not individual test cases.</li><li>Browser support is more limited without support for older browsers such as Internet Explorer. Supports Chrome-based browsers and Firefox. Safari support is “experimental”.</li><li>Cypress uses the browsers installed on your operating system, so browser version support is similar to that of Selenium and would need to be monitored and managed.</li></ul><p><strong>Playwright</strong></p><ul><li>Playwright blends the best features of both Selenium and Cypress.</li><li>Supports JavaScript, Python, Java, and C# so not as many as Selenium but still provides flexibility. JavaScript/TypeScript seems to be the most widely used.</li><li>Smaller user community but growing rapidly as more teams adopt Playwright.</li><li>Easy to install and get started with minimal setup. At least when using JavaScript (I haven’t tried it with the other languages).</li><li>Test framework is arguably easier to build than Selenium with some knowledge of JavaScript or TypeScript.</li><li>Running tests in parallel works by default out-of-the-box and is easily configurable.</li><li>Supports the primary modern browsers Chrome, Edge, Safari and Firefox with some caveats. Playwright does support Safari directly but supports WebKit which is used in the development of Safari. Playwright also doesn’t support the branded, released version of Firefox but does support the latest build. More information is available in the <a href="https://playwright.dev/docs/browsers">Playwright documentation’s browsers section</a>.</li><li>Browser management is much more seamless than with Selenium and Cypress. Browsers are built into Playwright making browser version management available via easy command-line options. Also with every release, Playwright updates the versions of the browsers it supports, so that the latest Playwright would support the latest browsers at any moment.</li></ul><h3>Puppeteer</h3><p>Puppeteer should get a mention. It can be considered as the actual parent of Playwright since Playwright was developed by some of the engineers who originally wrote Puppeteer. I haven’t used Puppeteer myself so can’t comment on a comparison here.</p><h3>Conclusion</h3><p>I loved working with Selenium back in day. I felt it did it’s job very well once one learned the recommended design-patterns and gained some experience with it. I attended a couple of Selenium conferences and found the Selenium committers and the user community to be a wonderfully supportive organization with many very talented engineers more than willing to share information.</p><p>Nowadays, however, I’ve become a Playwright convert. It’s ease of use to get a suite started, and that runs in parallel out-of-the-box, was a capability that is hard to pass up. It still took me a few months of experience to get truly comfortable but that was more related to me having to get more experience with JavaScript vs Python and Java which I had used with Selenium test suites.</p><p>Comparing to Cypress, I found the browser support, and the UI-based debugging tools of Playwright much more capable. Playwright also has a useful VS-Code plug-in that integrates with Playwright’s UI-Mode. Parallel execution is much more convenient since it runs by default from the command-line. Finally the configuration options seem more flexible, are easier to use, and are are very readable with Playwright’s configuration file.</p><h3>References</h3><p>Here’s some articles I used to compile this article.</p><p><strong>Cypress</strong></p><ul><li><a href="https://www.javacodegeeks.com/2023/03/web-application-testing-tools-cypress-vs-puppeteer.html#:~:text=Architecture%3A%20Cypress%20is%20designed%20as,level%20access%20to%20browser%20automation.">Cypress vs Puppeteer</a></li><li><a href="https://www.cypress.io/">JavaScript Component Testing and E2E Testing Framework | Cypress</a></li></ul><p><strong>Mercury</strong></p><ul><li><a href="https://en.wikipedia.org/wiki/Mercury_Interactive">Mercury’s Wikipedia Entry</a></li></ul><p><strong>Playwright</strong></p><ul><li><a href="https://www.browserstack.com/guide/cypress-vs-selenium-vs-playwright-vs-puppeteer">Cypress vs Selenium vs Playwright vs Puppeteer: Core Differences | BrowserStack</a></li><li><a href="https://www.lambdatest.com/blog/playwright-vs-selenium-vs-cypress/">Playwright vs Selenium vs Cypress: A Detailed Comparison | LambdaTest</a></li><li><a href="https://en.wikipedia.org/wiki/Playwright_(software)">Playwright’s Wikipedia Entry</a></li><li><a href="https://oxylabs.io/blog/playwright-vs-puppeteer">Playwright vs Puppeteer: The Differences</a></li><li><a href="https://medium.com/tech-p7s1/why-favor-playwright-over-selenium-or-cypress-e96df84c08e1">Why favor Playwright over Selenium or Cypress</a></li></ul><p><strong>Selenium</strong></p><ul><li><a href="https://www.browserstack.com/guide/selenium-webdriver-tutorial#:~:text=It%20supports%20a%20number%20of,%2C%20Ruby%2C%20Python%2C%20PHP.">Browser Stack: What is Selenium?</a></li><li><a href="https://nightwatchjs.org/guide/concepts/parallel-testing-in-nightwatch.html">Nightwatch Parallel Test Execution</a></li><li><a href="http://www.selenium.dev/">Selenium’s Official Site</a></li><li><a href="https://www.selenium.dev/blog/2022/introducing-selenium-manager/">Selenium Manager</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=181bfe1c3316" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[To Automate or Not to Automate: When to Write Automated Tests vs When to Rely on Manual Testing]]></title>
            <link>https://medium.com/@pgrandje/to-automate-or-not-to-automate-when-to-write-automated-tests-vs-when-to-rely-on-manual-testing-c07daa24924a?source=rss-18f070d71710------2</link>
            <guid isPermaLink="false">https://medium.com/p/c07daa24924a</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[automated-testing]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[regression-testing]]></category>
            <category><![CDATA[e2e-testing]]></category>
            <dc:creator><![CDATA[Paul Grandjean]]></dc:creator>
            <pubDate>Sun, 05 Nov 2023 19:12:11 GMT</pubDate>
            <atom:updated>2023-12-02T19:53:07.994Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*3ZTc-PoJ5yXkPAht.jpg" /></figure><p>Usually, automated testing is the better practice. But not always. There are considerations.</p><p>Sometimes engineers assume that automated tests are always better since it avoids human-error manual testing. And, it certainly makes testing run much much faster. Of course this is true but there are still trade-offs, and there are times when manual testing is actually more efficient.</p><p>I find once a team is deciding on a testing strategy that these decisions decide themselves from the project context. However, in more general discussions, such as job interviews, or discussing trade-offs and priorities with suppoting team members such as managers, project managers, or product owners then having clear definitions available can make these project planning conversations go more efficiently.</p><p>The decision on whether to automate tests also is also affected by the types of automation being considered, i.e. unit tests, integration tests (a not-well defined overused term for another article someday), API tests, or end-to-end (E2E) tests.</p><p>When to automate is sometimes an <em>interview question</em> that can be used for interviewing quality engineers, SDETs (Software Developer Engineer in Test) or even for developers. It’s also a great topic for an interview candidate to work into their answers to show a more nuanced understanding. The answer to “When to automate” is “sometimes” and to illustrate some the following questions have been considered shows a more nuanced understanding of the contexts that dictate the answer.</p><h3>Is It a New Feature?</h3><p>So for new features, the team may want to write automated tests in parallel, so that your automated test suite is kept current with the new feature. This is a best practice, however…</p><p>You won’t just use the automated tests to do ALL the testing against this new feature. In some cases that may be sufficient, but usually you’ll want to do some exploratory testing, looking for edge cases, beyond the pre-defined priority test cases that were based on the feature’s acceptance criteria (requirements).</p><p>For almost all new features you’ll want human eyes on it. This certainly applies to UI-based E2E testing. It can often apply to APIs as well using a tool such as Postman to do exploratory testing on all the inputs and visually inspecting the returned outputs. At the very least, a manual test of an API can be used to verify the automation is correct.</p><p>For UI testing its even more appropriate. Functionally the UI interface can be correctly passing automated tests, but if UI elements are misplaced on the screen an automated test won’t typically catch that, unless you have tests comparing bitmaps of UI screenshots or a similar technique. And even in those cases, the very first time the feature is tested someone will need to verify the first bitmap is correct. New interfaces almost always require visual inspection.</p><h3>Will the Interface Change?</h3><p>This is a primary reason for <em>not</em> writing automated tests. Will the interface to be automated change soon? And, will it change dramatically to the point where the tests would need to be re-written anyway? This applies to both UI and API tests. If the interface will change dramatically it’s not worth the effort to write automated tests now.</p><p>A question to ask is, “how much regression testing will we need to do before the interface is re-written?” Consider if you will have to do frequent regression testing before the interface is changed then automated tests may still be worth it. Especially if the regression-testing is time-consuming. But if few changes will be made to the old interface before the re-write then wait until the automation can be written to the new interface.</p><p>Another version of this question is what are the costs of maintaining the tests vs running the tests manually every release? That is, if the interface is changing so often that the tests are continually failing and needing to be fixed, then manual testing, at least until the interface stabilizes, may be temporarily more efficient. In this case one can “skip” the tests in the test suite (test engine tools like Jest, TestNg, JUnit support this) and then unskip the test to return it to the test suite once the interface has stabilized.</p><p>These are case-by-case, situational decisions, and there is usually a sweet spot that defines which way to go. The main thing is for the team to agree on the approach and make sure all are aware.</p><h3>Are Regression Tests Even Needed?</h3><p>This is the other primary reason for not automating tests. Will the team need to do any regression testing at all? <em>The purpose of automated tests is to automate the re-running of regression tests.</em> If no regression testing will be needed, or only occasional minimal “one-off” regression testing is needed, then no automated tests are needed.</p><p>Examples where this often occurs are simple internal tools, where interfaces are designed quickly, and the numbers of users are small and can easily reach out to developers if something is wrong. These are cases where bugs have less of an impact to the organization. Often internal tools are written quickly with the intention that there won’t be continuous development against them. So, if the code isn’t changing, there’s no re-testing happening, so developing and maintaining automated tests in those cases may be more costly than not having them.</p><p><em>Automated tests only have value when the same tests need to be run, repeatedly, again and again, i.e. regression-testing. If this is not the case, occasional manual testing may be more efficient.</em></p><h3>What is the Cost of a Bug Released to Production?</h3><p>Writing an automated test may be expensive in terms of time and resources, particularly with new E2E tests, and depending on how much of a test framework you’ve developed already. With UI-based E2E tests new features often require new code structures for representing new pages, components of pages, or new workflows. API tests also sometimes require considerable development work, for instance, if new database connections need to be established, test data created, etc. Unit tests are usually easier to write but also don’t cover the integration points that are common sources of defects. So this begs the question….</p><p>What is the return on investment for automating a test vs the expense incurred of not catching a bug in production? If the bug would be trivial in terms of impact to the user and would be considered lower priority for fixing if it did occur, than it might be better to not write the test. (Usually small features are better handled with well-written unit tests.) Remember every test you write also needs to be maintained and monitored.</p><p>Keep in mind that the more tests you add to your automated test suite the slower your suite will run. This can be an issue when running your tests as part of a development pipeline.</p><p>This question can be addressed by following the principles of the <a href="https://martinfowler.com/articles/practical-test-pyramid.html">testing pyramid</a> — a topic for a different post sometime.</p><h3>Are Unit Tests Adequate?</h3><p>One thing to ask, are existing or perhaps a few new unit tests adequate for the needed test coverage? If so, this will be much more efficient that adding new E2E or API tests. Typically unit test creation and updating is done by the developer as part of developing the new feature. The team can ask, will the unit testing give the test coverage we need?</p><p>The answer depends on potential failure points in the new feature. If it’s a small component without many, or any, integration points that could fail, then unit test coverage is likely sufficient.</p><h3>What Questions Have I Missed?</h3><p>I suspect I’ve missed something. Please comment if you’ve found other questions that can be asked.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c07daa24924a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Thoughts and Experience on Software Quality and Test Automation]]></title>
            <link>https://medium.com/@pgrandje/my-thought-opinions-experience-on-software-quality-and-test-automation-a3f688de5bf4?source=rss-18f070d71710------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3f688de5bf4</guid>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[test-tools]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[agile-methodology]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Paul Grandjean]]></dc:creator>
            <pubDate>Thu, 02 Nov 2023 21:17:13 GMT</pubDate>
            <atom:updated>2023-12-02T19:54:48.498Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi, and Welcome,</p><p>I’ve been working in software quality for 20 years and had long planned to share my experiences with the tech community. This blog is now my place to do this. I hope, over time, to cover a wide variety of topics that are all-things software quality including but not limited to,</p><ul><li>Testing processes within the SDLC</li><li>Agile Testing</li><li>End-to-End (E2E) test automation tools</li><li>Automated Testing design patterns</li><li>API test automation</li><li>Tips and Tricks I’ve learned</li><li>When is automation appropriate vs manual testing</li><li>Exploratory Testing</li><li>How to prioritize testing tasks both manual and automated</li><li>The role of AI in software quality</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3f688de5bf4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>