Hello hello peeps π
I have been a bit of a workaholic lately, but all for a good cause π
Not sure if you know already, but I started to work on a project The Chaincademy helping Developers (SDETs, Engineers, Coders, Programmers, Test Automation Engineers…), especially the junior ones that are coming to Tech to find their first job π»
We have launched our MVP before Xmas, and we are testing it with our audience (Junior Developers). So, in case you want to accelerate your career (for now, only web3) and get your first experience as a developer, sign up for our Newsletter to get access π
First time I actually adventured myself with AI and Machine Learning was back in 2018 in a Machine Learning Workshop. I had to create this iOS app where AI was replacing my face with an emoji based on my expressions πβReally simple, but back in that time, AI was not so good as it is right now (As we say in Brazil: Na minha Γ©poca isso aqui era tudo mato – Back in my day, this place was all woods)
And since the launch of chatGPT to speed up all my work, I have been using AI on a daily basis, more Bard actually (Think it is much better than ChatGpt nowadays), so here I am going to give some tips on how I have been using it in test automation:
Test Automation
1. Test Case Generation:
- Scenarios: You need to pass user stories and acceptance criteria, to generate corresponding test cases with detailed steps and expected outcomes.
Prompt Example:Given a user tries to register with an invalid email address, describe the steps they would take and verify that the system displays an appropriate error message.
- Edge Cases: Ask to suggest potential edge cases or corner scenarios to test, ensuring comprehensive coverage of your application’s functionality.
Prompt Example:For the checkout process, what happens if the user's internet connection drops while entering their payment information? List potential scenarios and expected outcomes.
- Data-Driven Testing: Generate test data sets based on specific criteria.
Prompt Example:Generate 10 test cases for the login feature, covering cases with valid and invalid username/password combinations and different user types (admin, regular user).
2. Coding:
- Test Script Automation: Describe the test actions:
Prompt Example:I want to test clicking the 'Submit Order' button and verifying the order confirmation page appears. Write a Cypress with javascript script for this scenario.
- Code Completion: Get test assertions, locator identification, and handling complex interactions.
Prompt Example:In my Cypress test, I'm trying to assert that the element contains the text 'Welcome back'. Please suggest the next line of code with assertion syntax.
- Refactoring: Analyze your existing test scripts and suggest improvements like removing redundancy, increasing reusability, or optimizing execution time.
Prompt Example:Analyze my Pull request for the search functionality. Can you add comments and suggest ways to improve readability, reduce redundancy, and speed up execution?
3. Test Planning and Management:
- Prioritization and Risk Assessment: Provide the test case details and application knowledge, so it can help prioritize tests based on risk or impact.
Prompt Example:Given these 20 test cases for the new feature, rank them based on potential impact, speed of delivery and risk of failure. Explain your reasoning
for each. - Maintenance: Identify outdated or irrelevant test cases and suggest updates or new tests to maintain coverage.
Prompt Example:The application updated its login page layout. Identify test cases needing modification and suggest relevant updates based on the new UI.
4. Environment Management:
- Mocks: Describe data needs for specific tests, and generate mock data or API responses, reducing reliance on real environments and dependencies. Remember you can also use contract tests (with Pact for example) and this can be done automatically from the code.
Prompt Example:βGenerate mock API responses for the payment gateway integration test, simulating successful and failed scenarios based on test case requirements
- Environment Configuration: Configurations for different test environments based on your application and testing requirements.
Prompt Example:Suggest configurations for a staging environment replicating the production database but with limited user access. Include details for network settings and resource allocation.
Thanks to Abel from Graph Protocol π to send over these great resources that I have been using to learn about how to better prompt for Software Development are: