2014-03-01 45 views
1

背景:实习生功能测试都未能

让我的基础架构正确设置有针对一组VM实习生运行功能测试后。所有机器都存在于同一个网络上。

我正在使用实习生来运行我的功能测试。

*不使用酱汁实验室,而是使用硒网格2 - 集线器&节点。

问题:

所有功能的测试用例执行失败。

Error: Student Name field should contain same string that was entered: expected '' to equal 'qwerty' AssertionError: Student Name field should contain same string that was entered: expected '' to equal 'qwerty'

观察:

我看到的表单字段越来越填写,但是当我做的断言 - 这是为获取文本,并与预期的输入相匹配那么简单,我得到的错误响应7.

我试过了什么 这是功能测试用例的典型锅炉板。

 studentName: function() { 
      return this.remote 
       .get('http://some.ip.addr:3000/#students') 
       .elementById('name') 
       .clickElement() 
       .type('qwerty') 
       .end() 
       .elementById('name') 
       .text() 
       .then(function(resultText){ 
        assert.equal(resultText, 'qwerty', 'Student Name field should contain same string that was entered');    
        }); 
     } 

其他注释:
Link to Status Response Codes that are mentioned above

回答

1

将溶液以 ''(空字符串)被返回是使用:的

.elementById('name') 
    .getAttribute('value') 

代替

.elementById('name') 
    text() 

这是通过在项目上工作的联系人发送给我的。这里是他的解释:

Basically, .text() will not get the value of a form field, so you need to use WebDriver's getAttribute()