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
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
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