How to Export Java Code from Selenium IDE

How To

Selenium LogoIf you’re reading this, you’re probably familiar with Selenium IDE, a Firefox extension that lets you record actions and turn them into automated test scripts.

Maybe you’ve created your first recording, and now you’re wondering how you can export the raw Java code. Read on for step-by-step instructions!

Getting Java Code from Selenium IDE:

  1. Open Selenium IDE, and select the recording you want to use in the “Test Cases” list (see the left nav)
  2. In the top menu, click “Options” and in the resulting drop-down, select “Options…”
  3. Make sure the option for “Enable experimental features” is checked, and click “OK”
  4. Click on “Options” again in the top menu, and select “Format”
  5. Choose the Java test case format you want the code in — for example, “Java / TestNG / WebDriver”
  6. Copy the code that shows up (in the “Source” tab), and use it however you’d like!

For example, you can create an Eclipse TestNG file and paste the code in there. Just delete any irrelevant placeholder code in your new file, and remove the package name from the top of your Selenium IDE code, as you’ll already have a package name in your Eclipse file.

Do you use a different language than Java in your automated tests? No problem! For step number five above, you can choose Python, Ruby, or C# instead.

Manual Testing vs. Automated Testing

QA Engineering

When it comes to the world of QA, automated testing is becoming more and more popular. In fact, a quick search of QA jobs on sites like Indeed, LinkedIn, etc. will show that the majority of these jobs now require automation experience with a language like Java, Python, etc.

This can prove daunting for testers with a background in manual testing, who typically leave the coding to developers. It can also be confusing to employers, who aren’t sure how much automated testing they need, and whether it can replace manual testing completely.

I’ve worked with clients who use 100% manual testing to great success, and those who attempted to do 100% automation, and had to re-think their strategy — so the reality isn’t always as black and white as it may appear.

The ideal combination is having both manual and automated testing, though the amount of each depends on your exact product/service and what your company’s software development life cycle is like. For example, if you’re constantly adding new features, you’ll need very rigorous manual testers. Of course, ideally you’ll also have automated regression tests set up, to make sure that the new features being introduced aren’t breaking old features.

What’s the Difference Between Automated and Manual Testing?

Okay, so you know that a company should have both manual and automated testers. But what exactly is the difference besides a vague reference to “writing code”? Let’s break it down with a simple example.

Manual Testing involves, well, manually testing the app or website. For example, if you wanted to test whether a login feature in an iOS app was working, you might pick up your iPhone, tap the relevant app, select the Login button, type an email address and password using the keyboard, and tap to proceed — then observe whether it logged in successfully.

Automated Testing entails writing code to create test scripts that could automatically do the above actions for you and give you a report of any bug — scripts that you could run with the click of a button. (Or, if using continuous integration, whenever there’s a new build or at a certain time.)

Generally, to do automated testing, you need to have some programming skills — for example, knowledge of Java (which will enable you to write the test script code).

Is Manual Testing Dead?

In a word, no — or at least, it shouldn’t be. Manual testing and user experience consulting should still play a huge part in any QA team.

It’s great that more people are learning automated testing — above all, because it provides extra stability to the QA process. It can automatically alert the team of sudden bugs, and save a ton of time (and rote work!) with regression testing. There’s no doubt that it’s incredibly useful to have solid automation framework in place. However, I encourage both QA testers and tech employers to not abandon the importance of manual testing, for several reasons.

Good QA should be about proactively improving the product or service — not solely reporting obvious bugs. Manual testing has the power to go beyond basic “is this a bug or not” behavior testing. The power of having QA actively identifying areas of improvement and advocating for better user experience can’t be understated. It may sound like a luxury when funding is tight, but rest assured that it can have a huge affect on a company’s bottom line. As Fast Company shares:

For brands to compete for attention now takes something greater than mere presences in the right channels or support for the most popular devices. User experience is now becoming a critical point in customer engagement in order to compete for attention now and in the future.

Particularly in the win-fast-or-fail world of startups, user experience needs to be on point — and automated testing alone can’t cover this. By forcing manual testers to become automated testers, companies are overlooking a goldmine of talent and creativity.

So, the answer to the overarching question? (Or, in internet terms, TL;DR!) An ideal Engineering department should have both manual and automated testers, respecting the different strengths that each brings to the table.

Happy testing — manual or automated!

 

Automated Test Cases with Java String Methods

How To

List of test casesWhen you’re writing automated test cases in Java, you’ll often want to use string methods to see if your test results match expectations.

What are string methods? They let you perform various operations on strings, like checking how many characters they have, or whether they contain certain words.

Below, you’ll find a list of some of the most common Java string methods. If you don’t understand how to use them, don’t worry — you can scroll down to see real live examples of code using each string method on the list below.

Common Java String Methods:

  • String length() — returns the length of the string
  • String charAt() — returns a char value at the given index number
  • String concat() — adds a given string at the end of the string
  • String contains() — returns true if chars are found in the string
  • String startsWith() — checks if a string starts with a given prefix
  • String endsWith() — checks if a string ends with a given suffix
  • String equals() — compares the contents of two given strings
  • String indexOf() — returns the index of a given character value or substring
  • String isEmpty() — checks if the string is empty
  • String replace() — returns a string replacing all of the old char with new char
  • String substring() — returns a part of the string
  • String toCharArray() — returns the string converted into character array
  • String toLowerCase — returns the string in lowercase letter(s)
  • String toUpperCase() — returns the string in uppercase letter(s)
  • String trim() — removes leading and trailing spaces

Test Cases Using String Methods:

You can view a suite of TestNG test cases using these string methods here, on my Github profile. This isn’t meant to be a comprehensive or real test plan, but rather a fun way to see what types of things the above list of string methods can do in an automated test.

Note that if it doesn’t make sense to you, that’s okay — everyone has to start from somewhere, and there are a ton of great free and low-cost resources online that can help you learn Java (or whatever language you’d like to write automated test scripts in). Two of the best cheap and/or free resources that I recommend are Codecademy and Udemy. Good luck!

 

 

What Makes a Good QA Engineer?

QA Engineering

People often ask me what makes a good QA engineer. What skills do you need to succeed in QA testing, and how do you get started? With that in mind, I’ve put together a list of some of the essential skills you need to be a good QA tester.

Detail-Oriented

The very first skill you need to excel in the world of QA is to be detail-oriented. Obviously being detail-oriented is an asset in any type of career, but it’s absolutely essential for anyone in Quality Assurance. You need to be able to spot not only errors, but anything and everything that isn’t actively perfect/ideal.

Anyone can notice when an app crashes, but will you be able to find a less conventional/obvious way of using the app that causes it to crash?  Will you notice when a field that accepts a large amount of text isn’t expandable, or when it’s difficult for a user to tap a login button when holding their device with only one hand? Anyone in QA needs to sweat the details, big time.

Finger Swiping AppsCreativity

Another important skill for QA that may surprise some people is creativity. After hearing about how detail-oriented a QA engineer has to be, many people assume that creativity is the opposite. Not true! Being creative actually helps greatly in being detail-oriented, because it enables you to think outside of the box when assessing different ways a person might use the app or service that you’re testing.

The marriage of creativity and being detail-oriented also applies to writing test cases. It’s not enough to say, “I was able to sign out successfully, so that feature works” — did you try testing it with Wi-Fi versus cell coverage, or from an admin account as well as guest? The bigger your imagination is, the better when it comes to QA.

Communication

As a QA Engineer, you need to excel at communication with all different types of people, from CEOs to Project Managers, Designers, Customer Success, Engineers, and more. Your colleagues or clients will be relying on you to represent the customer or user’s point of view, and to know both when and how to reach out (and who to reach out to) about bugs you find, or potential user experience improvements.

You’ll need to know when it’s appropriate to simply file a bug ticket, and when you need to take it a step further and alert relevant stakeholders immediately. You’ll be relied on to assess and prioritize the severity of bugs, and to know how to explain a bug or potential improvement in both highly technical language as well as plain English so that every member of the team, from Engineering to Sales, can understand what the issue is and how it affects the product.

You also need to be respectful and kind (while still emphasizing the severity!) when reporting bugs to Developers/Engineers. They created the site, app, or other software, so it’s only natural that some might be inclined to feel defensive when being confronted with a problem in their code. Remember, you’re not here to blame or judge them — you’re all on the same team, working to make a product or service as beautiful as possible.

Are you detail-oriented, creative, and a great communicator? Nice — welcome to the world of QA! You’ll do great.