For the 6.x-2.x version (and also the 7.x-1.x version) automated tests are planned to be implemented. I've already written tests for the API, the address book, checkout and order administration which covers most (but not everything yet) of the "main flow". These tests will be added to the module soon.

As I'm just starting with writing tests, I would like to hear suggestions for improvements. You can post them here.

Comments

megachriz’s picture

Status: Active » Needs review

Automated tests for the API, the address book, checkout and order administration are committed.

The following automated tests were added:

  • Address book: Admin All
    Tests for the address book: view, edit and delete addresses.
  • Address book: Admin Edit
    Tests for the address book: view, edit and delete addresses.
  • Address book: Admin View
    Tests for the address book: view, edit and delete addresses.
  • Address book: Admin View Defaults
    Tests for the address book: view, edit and delete addresses.
  • Address book: Customer Basic
    Tests for the address book: view, edit and delete addresses.
  • Address book: Customer Delete
    Tests for the address book: view, edit and delete addresses.
  • Address book: Customer Edit
    Tests for the address book: view, edit and delete addresses.
  • Address book: Customer View
    Tests for the address book: view, edit and delete addresses.
  • Address book: Customer View Defaults
    Tests for the address book: view, edit and delete addresses.
  • Cart and checkout
    Ensures the cart and checkout process is functioning when Ubercart Addresses is enabled.
  • Orders
    Ensure that orders function properly when Ubercart Addresses is enabled.
  • Unit testing
    Ensure that the API behaves as expected.
  • User registration
    Test registration with address information.

Reviews are welcome.

megachriz’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Assigned: Unassigned » megachriz

I will work on the automated tests for the 7.x-1.x version.

megachriz’s picture

Assigned: megachriz » Unassigned

The automated tests for the 7.x-1.x version are updated.
See commit.

Reviews are still welcome.

megachriz’s picture

Assigned: Unassigned » megachriz

Some automated tests are not executed by the drupal.org testbot. That's because not all dependency projects are loaded (like the rules module). I'll try to fix that by adding a dummy module that lists all dependencies that are needed for the tests.

megachriz’s picture

Assigned: megachriz » Unassigned

All tests are now executed by the testbot.

In Ubercart 7.x-3.1 some of the automated tests were adjusted, causing a failure when executing the checkout test of Ubercart Addresses. This is fixed with the following commit:
http://drupalcode.org/project/uc_addresses.git/commit/c819aad

megachriz’s picture

I adjusted the checkout tests of both 6.x-2.x and 7.x-1.x to keep consistent with the checkout test in Ubercart. The checkout test in Ubercart now returns an order object instead of an order id. See for example this change in Ubercart.

Commits:

megachriz’s picture

I have made the methods getEditAddressValues() and generateAddressFieldValue() from UcAddressesTestCase class public static methods, so they can be accessed within other tests that don't extend UcAddressesTestCase. This a requirement for the tests I'm working on for #1735678: Autofill doesn't work, cause these tests are implemented in a test case class that extend UbercartTestHelper instead of UcAddressesTestCase.

Commits:

megachriz’s picture

The attached patch improves the uc_addresses_test module. Currently, this module defines two fields for Ubercart Addresses, but it didn't add alter the database so the values for these fields can be saved. I also moved the check for if the field should be in delivery/billing pane to a new field handler in the method checkContext(). This is not also cleaner, but it makes it easier to use uc_addresses_test in more automated tests. Currently, the test module is not compatible with all tests.

Let's see if the changes don't break any tests.

megachriz’s picture

Version: 7.x-1.x-dev » 6.x-2.x-dev
Status: Needs review » Patch (to be ported)

#8 committed.

Moving to 6.x-2.x.

megachriz’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new7.02 KB

This patch backports the test module to 6.x-2.x. However, the module isn't used in any tests yet. But these could be added later in other issues when needed.

megachriz’s picture

StatusFileSize
new11.4 KB

The test module couldn't be installed properly, so I added an automated test just to test that. Since that test "requires" the Views module, it's quite possible it's ignored by the testbot. If that's the case, then I will adjust the patch to strip out the requirement for Views, though it will added back in when I do the commit.

megachriz’s picture

StatusFileSize
new11.38 KB

Okay, now without the Views requirement.

megachriz’s picture

Status: Needs review » Fixed

Committed #11.

I'm closing this issue now. Eventually further improvements for the automated tests should be handled in new issues.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.