Popping open the last chat that was used to generate the code for the previous post, and simply asking it to "Ok, now generate a python script to use the gherkin test case. Use the pyautogui library."
This generates:
|
After playing with the code for the last post a bit, a colleague asked how hard it would be to do the same with a random python library. A quick search turned up PyAutoGUI, which seems ok. Popping open the last chat that was used to generate the code for the previous post, and simply asking it to "Ok, now generate a python script to use the gherkin test case. Use the pyautogui library." This generates: test_runner.py
Hmm, now I just need to build a test library that will test AI generated tests.....
0 Comments
In the fast-paced world of software development, functional GUI testing plays a critical role in ensuring seamless user experiences. While traditional GUI testing approaches have been effective, the emergence of Artificial Intelligence (AI) has brought a new wave of possibilities to enhance and optimize the testing process. How can AI elevate traditional GUI testing? What are the benefits of utilizing test cases generated by AI. I'll give an example prompt and demonstrate how an AI can generate test cases to streamline the testing process. The Power of AI Artificial Intelligence introduces a range of advancements that augment traditional GUI testing, enabling more efficient and effective processes. Rather than replacing traditional methods, AI serves as a valuable ally, complementing and enhancing existing practices. AI can leverage Natural Language Processing (NLP) algorithms to generate Gherkin-style test cases, further streamlining the testing process. To demonstrate the power of AI, let's consider an example prompt: "Write gherkin test cases to validate the login functionality." The prompt produces structured test cases that describe the login functionality. Here's an example of test cases generated by the AI: Login test case
AI-powered Execution and Analysis With these test cases in hand, an existing test library like watir can be integrated seamlessly. With a few more prompts like, "Now generate the ruby code to run this test using the watir library. Use the page object pattern, and separate the code into the correct files. Use a test_params.yaml file to store the variables like urls, usernames, passwords, etc." Here is what we get: test_parameters.yaml
login_page.rb
login_steps.rb
test_runner.rb
It even generated some helpful instructions: instructions.txt
Conclusion
While there is still some setup and configuration to do, we can see that AI brings a wealth of opportunities to enhance traditional GUI testing practices. By generating some of the basic test cases we can focus effort on doing the non-standard tests, poking around where we know the bugs hide. Integrating AI with existing GUI testing libraries allows for automated uses of the generated test cases. Embracing AI in GUI testing is a powerful tool in our QA bag of tricks. So, let's embrace the potential of AI and unlock a new era of GUI testing! Paging Dr. Object
Organizing your tests and the objects that describe elements within the application your are testing is one of the ways to help DRY up your tests and to reduce the amount of change needed when the application your are testing changes. You can do this in a couple of ways, and, depending on the driver you are using, there are some libraries that can help you. One way to do this is with the page object pattern. Just to be clear, cucumber is not a testing tool, it is a collaboration and analysis tool. Rspec is a specification runner. With that out of the way, here is how I choose what format to write my "tests" in.
Starting a project
There are a number of things I setup by default, folder structure, helper files, snippets, etc. I do this a lot, so have a tool that automates some of this. I've posted it on Bitbucket but it is very much a work in progress. IDE vs. Editor vs. ...
I've played with a lot of different IDEs and editors for ruby and have settled on one for use when I'm on my desktop, and one for use while I'm on my phone or tablet (yes, there are sometimes when I have an idea or 'fix' that needs to be in and I'm not at my computer). After playing with IDEs like Aptana, eclipse, RubyMine, Geany, and some crazy mash ups called CubicTest and Bromine, I found that they all had some benefits (built in debugging, package management, snippets), but mostly had quirks and drawbacks (price, keyboard shortcuts, configurations) that didn't fit with how I wanted to work. Mainly I want something fast, clean, easy to configure to do exactly what I want, and portability to move with me from system to system (some clients won't allow me to bring my own system). I've been helping to setup automation for a number of individuals and teams and have decided to publish all of the setups and configs that I've been using. I'll break this down into a couple of parts to focus on each of the steps along the way. If I get ambitious I may even automate the setup...
|
AuthorHi, my name is Clancey and I am a quality advocate, agile coach, scrum master, automator, and toolsmith. Getting started with ruby automation series
Archives
March 2024
Categories
All
|
Copyright injinia, images copyright Adachi Photography
|