2016-09-12 11 views
0

分度器テストがあります。私はテストのためにいくつかのデータを提供したいので、私はテストを自動的に生成することができます。分度器テストが実行されていません

私の機能は以下の通りです。問題は、私が記述のオープニングの後に何かをコンソールできることです。しかし、それはそれが機能した後ではありません。

コード:

bigTestFunction = function(testElements) { 

testElements = JSON.parse(testElements); 

for (i = 0; i < testElements.length; i++) { 
    var title = testElements[i].title; 
    var shouldText = testElements[i].should 
    var url = testElements[i].url; 
    var actions = testElements[i].action; 

    describe(title, function() { 
     it(shouldText, function() { 

      goToUrl(url); 

      for (x = 0; x < actions.length; x++) { 

       var action = actions[x].action; 
       var value = actions[x].value; 
       var element = actions[x].element; 
       var notEmpty = actions[x].notEmpty; 
       var nested = actions[x].nested; 

       if (action === 'sendKeys') { 
        sendKey(element, value); 
       } 

       if (action === 'click') { 
        click(element, notEmpty); 

        if (nested) { 
         for (x = 0; x < nested.length; x++) { 

          if (nested[x]['action'] === 'sendKeys') { 
           sendKey(nested[x]['element'], nested[x]['value']); 
          } 

          if (nested[x]['action'] === 'click') { 
           click(nested[x]['element'], nested[x]['notEmpty']); 
          } 
         } 
        } 
       } 

      } 
     }); 
    }); 
} 

}

testElements = JSON.parse(testElements); 

JSON:

[ 
    { 
    "id": 1, 
    "title": "Small test one", 
    "should": "should start training", 
    "url": "https://ledmagazine.nl/home", 
    "actions": [ 
     { 
     "id": 1, 
     "test_id": 1, 
     "element": "/html/body/div[1]/div/div/header/div/div[2]/div[2]/div/div/div/div/nav/section/ul/li[3]/a", 
     "action": "click", 
     "status": "notEmpty", 
     "value": "/html/body/div[1]/div/div/div[2]/div/div/div[1]/div/section", 
     "nested": { 
      "id": 1, 
      "action_id": 1, 
      "action": "sendKeys", 
      "element": "//*[@id=\"mce-EMAIL\"]", 
      "value": "[email protected]", 
      "created_at": null, 
      "updated_at": null 
     } 
     } 
    ] 
    } 
] 

私は私は本当に近いですが、機能は「(タイトル、機能を説明した後に停止すると思います(){... '

答えて

0

プロップあなたはデータを取得するためにbeforeEach(function() {...}がありません。

関連する問題