# How to test providers

To run a test for a provider follow this steps:

  1. Create a fixtures.json where we'll add the test in the following path: /www.tenant.com/providers/test/fixtures.json
{
  "/marfeel/providers/main/videos/CustomVideoProvider.js": [                // Test for CustomVideoProvider
    {
      "in": "videoDetector.html",                                               // Test 1
      "out": {
        "type":"MP4",
        "videoSource": "http://www.marfeel.com/video",
        "posterSource": "http://www.marfeel.com/video/poster.jpg"
      }
    },
    {
      "in": "videoDetector_secondTest.html",                                    // Test 2
      "out": {
        "type":"MP4",
        "videoSource": "http://www.marfeel.com/video2",
        "posterSource": "http://www.marfeel.com/video2/poster.jpg"
      }
    }
  ],
  "/marfeel/providers/main/videoAttrs/CustomVideoAttrProvider.js": [        // Test for CustomVideoAttrProvider
    {
      "in": "videoAttrDetector.html",                                           // Test 3
      "out": {
        "type":"IFRAME",
        "videoSource": "http://www.marfeel.com/videoAttr"
      }
    }
  ]
}
  1. Each test has an in attribute where we will put the file of the html we want to test. Usually it will be a script or a link (in case of the nextPages).

  2. The out attribute will change depending the test we want to run:

{
  "/marfeel/providers/main/videos/CustomVideoProvider.js": [                // Video Detector
    {
      "in": "videoDetector.html",
      "out": {
        "type":"MP4",
        "videoSource": "http://www.marfeel.com/video",
        "posterSource": "http://www.marfeel.com/video/poster.jpg"               // Not mandatory field. Only use if video has poster
      }
    }
  ],
  "/marfeel/providers/main/videoAttrs/CustomVideoAttrProvider.js": [        // Video Attributes Detector
    {
      "in": "videoAttrDetector.html",
      "out": {
        "type":"IFRAME",
        "videoSource": "http://www.marfeel.com/videoAttr"
      }
    }
  ],
  "/marfeel/providers/main/nextPages/CustomNextPageDetector.js": [          // Next Page
    {
      "in": "nextPageDetector.html",
      "out": {
        "url": "http://www.marfeel.com/origin_artcile.html",
        "nextPage":"http://www.marfeel.com/origin_artcile/2.html"
      }
    }
  ]
}
  1. In order to run the test in each project, there is a module called Marfeel(Pro|Blg)BoilerProviders with the class BoilerParameterizedTest. Performing a run here will run all the fixtures there are in the project.