1

For a Drupal 7 Commerce site, I am working on the behavior of a payment and invoicing service during checkout. Among other things, there is one implementation of hook_commerce_checkout_complete(), the behavior of which I want to improve.

So far, for testing this, I always do a complete shopping and checkout process:

  1. Visit a product page.
  2. Add the product to the cart.
  3. Enter a (new) address. (For a realistic experience, I think I need to type in a new address, because most buyers on this site are one-time anonymous customers.)
  4. Choose a payment method, confirm.

After this, I will look at the logs, the order that was created, and the emails I received. Then I will start over with the next iteration.

My browser does a half-decent job of prefilling the form with the address. Just one field (city) is left empty consistently.

But even if this would work, there are still some steps too many for my taste, for rapid iteration of manual tests.

Is there a way to automate some of this?

Note: I am not talking about automated tests here. I am talking about manual testing during development.

EDIT: Automated vs manual testing

The comments indicate that my question might be confusing. Maybe I chose the terms poorly, so I will explain how I want them to be understood for this question.

"Automated testing": I have a machine that bakes a cake according to a codified recipe. And another machine that determines if the cake is according to expectations, e.g. by testing chemical properties or the color. The expectations are also codified, and do not change. The result is either "passes" or "does not pass".

What I want instead: A machine that bakes a cake according to a codified recipe. But then I want to taste the cake myself, and determine how I want to change the recipe. This means in this case, the expectations are not known beforehand, and they are not codified.

Without any automation, I would have to bake the cake manually, then taste it, then bake another cake, taste it again, etc.

According to the answer by @PatrickKenny, Selenium can do both things for me.

If someone can suggest a better way to say this, I will be grateful.

3
  • I find your question confusing because you mention automating manual testing, but don't want automated testing? That seems like a contradiction of terms. Can you clarify what you mean because I don't think you can have automated manual testing without it being some sort of automated testing. This seems pretty opinion-based too if it's a development preference. Maybe try writing behat/mink tests, which is a form of automated testing that uses your browser?
    – mradcliffe
    Commented Nov 15, 2017 at 15:58
  • @mradcliffe I am going to answer this as an edit to the question.
    – donquixote
    Commented Nov 15, 2017 at 17:34
  • @mradcliffe I hope this helps.
    – donquixote
    Commented Nov 15, 2017 at 17:52

1 Answer 1

2

This is not specific to Drupal, but you can use Selenium IDE.

Selenium is a framework for automated testing, but the IDE allows you to do lazy manual testing too.

You need to install Firefox and the Selenium IDE addon.

Basic explanation of how to get started

  1. Open the IDE (addon) and press the red "record" button.
  2. Go to your site and carry out all the steps manually. Selenium IDE will automatically record the steps as you go along.
  3. You can also add steps manually or edit the steps in the displayed editor. This supports cut and paste so you can edit it pretty quickly.
  4. When you're done, save the file. You can then open this file again in the IDE and press the play button to automatically carry out all the steps.
1
  • This sounds great. I will play around with this, but for now going to assume that this completely answers my question :)
    – donquixote
    Commented Nov 13, 2017 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.