Friday, 6 September 2024

Good & bad Prompt to write Selenium Tests using Generative AI with GPT

 



๐Ÿ“Œ Telegram Group: https://t.me/+FTf_NPb--GQ2ODhl
๐Ÿ“Œ YouTube channel: https://lnkd.in/gGUGmb-P

******

๐Ÿ’› Good & bad Prompt to write Selenium Tests using Generative AI with GPT

Scenario: Automate the validation of title for a webpage using Selenium-Java

***************************
๐Ÿ”บ Good Prompt Example:

๐Ÿ‘‰ Prompt:

โ€œWrite a Selenium test in Java to validate the title of the webpage. Ensure that the test uses proper exception handling, includes assertions for validation, and is structured with clear comments. The test should navigate to โ€˜https://www.example.com', and verify that the page title is โ€˜Example Domainโ€™. Additionally, the test should close the browser after execution.โ€

๐Ÿ‘‰ Why Itโ€™s Good:

Clarity:
The prompt is clear and specific about what the test should do.

Details:
It includes additional requirements like exception handling, assertions, and closing the browser.

Context:
The webpage and title to be validated are specified.

Code Quality:
It emphasizes writing a well-structured test with comments.

*********************************
๐Ÿ”บ Bad Prompt Example:

๐Ÿ‘‰ Prompt:
โ€œWrite a Selenium test to check a title.โ€

๐Ÿ‘‰ Why Itโ€™s Bad:

Vagueness:
The prompt is too vague, without specifying the webpage, title, or any other details.

Lack of Detail:
It does not mention important aspects like exception handling, assertions, or browser management.

Unstructured:
The lack of structure could result in poor-quality, incomplete code.

__________
๐Ÿšตโ€โ™€๏ธ Curious to learn more on usage of Prompts and How to use Generative AI and Code Generation tools for Software testing?
Try my sessions here: https://lnkd.in/gBjxYAPN

๐Ÿ‘พ Lets connect to discuss on use of LLM models like Sonet for Automation: https://lnkd.in/dP56a_5P

hashtag#ai hashtag#testing hashtag#softwaretesting hashtag#qualityassurance hashtag#career hashtag#sdet hashtag#qa hashtag#qaautomation hashtag#technology hashtag#llm hashtag#genai hashtag#sidpostai hashtag#sidpost

All Time Popular Posts

Most Featured Post

Remove All Occurrences of a Given Character using Two Pointer Approach

  - ๐—œ๐—ป๐˜๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„ ๐—ค&๐—” ๐—ฃ๐—ฎ๐—ฐ๐—ธ๐—ฎ๐—ด๐—ฒ ๐—ณ๐—ผ๐—ฟ ๐—ง๐—ฒ๐˜€๐˜ ๐—”๐˜‚๐˜๐—ผ๐—บ๐—ฎ๐˜๐—ถ๐—ผ๐—ป & ๐—ฆ๐——๐—˜๐—ง: https://topmate.io/sidharth_shukla/6053...