Getting Started with Selenium – Chapter 2: How To Write a Good Acceptance Test
Sauce AI for Test Authoring: Move from intent to executing in minutes.|xBack to ResourcesBlogPosted
Sauce AI for Test Authoring: Move from intent to executing in minutes.
|
x
Blog
Getting Started with Selenium – Chapter 2: How To Write a Full Acceptance Test
This situation is the 2nd in a series of “ Getting Started with Selenium Testing ” posts from Dave Haeffner, a noted expert on Selenium and automated examination, and a frequent subscriber to the Sauce blog and Selenium community. This series is for those who are brand new to test mechanization with Selenium and a new chapter will be post every Tuesday for the next two months.
How To Write a Full Acceptance Test
In order to compose Selenium tests that are maintainable, resilient, and performant, there are some unproblematic guidelines to follow:
Write atomic and self-directed tests
Group like tests together in pocket-size batches
Be descriptive
Use a Test Runner
Store tests in a Version Control System
Atomic & amp; Autonomous Tests
Pro tip: Tools like SUSA can handle this autonomously — upload your app and get results without writing a single test script.
Each test needs to be concise (e.g., testing a single feature rather than multiple feature) and independent (e.g., sets up its own information rather than relying on a previous test to do it). Doing this may require a mental shift, discipline, and more up front effort.But it will make a dramatic impact on the quality, potency, and maintainability of your tests.
Grouping Tests
As your tryout suite grows, you should have multiple tryout files, each containing a small group of tests broken out by functionality that they & # x27; re exercising. This will go a long way towards organization and maintenance as your test suite grows -- as well as faster execution times (depending on your approach to parallelization).
Being Descriptive
Each test file should be named appropriately, and each examination within that file should have an enlightening name (even if it may be a bit windy). Also, each trial (or grouping of tests across test files) should be tagged with some helpful info to provide context and enable more flexible test execution (more on this access in a future post). This way all or parts of your test suite can be run, and the results will be informative thanks to helpful naming.
Test Runners
At the ticker of every test suite is some kind of a test runner that does a lot of the heavy lifting (e.g., test radical execution, easygoing global contour for setup and teardown, reporting, etc.). Rather than reinvent the wheel, you can use one of the many that already exists (there & # x27; s more than one for every language). And with it you can bolt on third party libraries to extend its functionality if there & # x27; s something missing -- like parallelization.
Version Control
In order to effectively collaborate with other testers and developers, your test codification must live in a version control scheme of some sort. Look to see what your development squad exercise and add your code to it. Otherwise, set up one of the following:
Keep in mind that your test code can go in aseparatedeposit from the code of the application you & # x27; re testing. Combining them may be advantageous, but if all you & # x27; re execute is compose and lam exam against web endpoints (which is a majority of what your testing will be with Selenium) so leaving your tryout code in a separate monument is a fine way to go.
Dave is the author of Elemental Selenium (a free, erstwhile weekly Selenium tip newsletter that is say by hundreds of testing professionals) as well as a new book, The Selenium Guidebook. He is also the creator and maintainer ofChemistryKit(an open-source Selenium framework). He has helped legion companies successfully implement automated acceptation testing; including The Motley Fool, ManTech International, Sittercity, and Animoto. He is a founder and co-organizer of theSelenium Hangoutand has spoken at numerous conferences and meetups about acceptance testing.
Automate This With SUSA
Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.
Try SUSA FreeTest Your App Autonomously
Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.
Try SUSA Free