1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Quality Assurance Tools for Mods

Discussion in 'XenForo Development Discussions' started by Adrian Schneider, Mar 24, 2014.

  1. Adrian Schneider

    Adrian Schneider Active Member

    Has anyone done any PHPUnit or Behat testing on their add-ons? I'm working on a fairly complex add-on right now, and I'm getting pretty deep into Behat setup to get it all working properly.

    A Behat example would be

    Code:
    Feature: Seed recommendations with past forum posts
    
      Background:
        Given the forums:
          | forum            | parent   |
          | Strategy         |          |
          | Protoss Strategy | Strategy |
          | Terran Strategy  | Strategy |
          | Zerg Strategy    | Strategy |
          | Website          |          |
    
      Scenario: 100% when all posts in same forum
        Given I previously posted in:
         | forum         |  date    |
         | Zerg Strategy |  -8 days |
         | Zerg Strategy |  -4 days |
         | Zerg Strategy |  -2 days |
        When a new thread is posted in "Zerg Strategy"
        Then it should have a relevance of "100"
    
      Scenario: 50% when half in forum
        Given I previously posted in:
         | forum           | date    |
         | Zerg Strategy   | -8 days |
         | Zerg Strategy   | -4 days |
         | Terran Strategy | -2 days |
         | Terran Strategy | -2 days |
        When a new thread is posted in "Zerg Strategy"
        Then it should have a relevance of "50"
    
    This is a more business focused test. Other cases are ... when I click here, and enter these form fields in, I should see this result.

    If there is interest, I'm going to start documenting and sharing some of the tools (or integrations) that I develop. Next up is probably PHPUnit, but there isn't much custom stuff there needed. Much of the struggle is process... getting things set up in the right place, figuring out which environment to use (and setting up XenForo so it can be environment-ware), etc.

    Cheers
     
    Aayush and Alfa1 like this.
  2. Aayush

    Aayush Well-Known Member

    I have been longing to integrate testing frameworks into my XF addons.
    It would be great if you could share some documentations and tools
     
  3. Adrian Schneider

    Adrian Schneider Active Member

    Sorry to cross post here, but here is an update - http://xenforo.com/community/threads/versioning-product-assets.68671/#post-747142

    The outcome of that will include a skeleton project with some demo unit tests and behat scenarios, as well as some documentation on how to organize and run the tests.

    I have no idea how far off I am... hopefully by the end of this project I'm blowing through I'll have it ready (1-2 weeks).

    Cheers
     
  4. tyteen4a03

    tyteen4a03 Well-Known Member

    I am planning to add unit tests to my addons too.
     

Share This Page