testing - 不正确的刷新使用测试结果

  显示原文与译文双语对照的内容

我刚刚安装了 Freshen,我想把它挂起来。

以下测试运行,但输出的输出不正确。

测试:get_user.feature


Feature: Retrieve an existing User
 When a Users ID (ID, Email, User-name) is entered,
 An object containing all the Users information is returned

 Scenario: Get existing User from their ID
 Given I have the user where their id is '288' and account id is '57'
 Then their username should equal adminuserxxx

steps.py


from freshen import *
from freshen.checks import *

import user_operations
import util
#The URL of the API
api_root ="http://api.stuff.com/v1/core";

#The ID of the Application
appid ="1234567";

#Our private key
secret ="987654321";

#Headers
headers = {'Accept':'application/json', 'Content-Type':'application/json'}

@Before
def before(sc):
 scc.headers = headers
 util.get_auth_token_and_scope(api_root, appid, secret, scc.headers) #An authorization token is added to scc.headers here

@Given("I have the user where their id is (d+) and account id is (d+)")
def enter(user_id,account_id):
 scc.user = user_operations.get_user_from_id(int(account_id), int(user_id), scc.headers)

@Then("their (w+) should equal (w+)")
def check_result(field_value, result):
 assert_equal(str(result),scc.user[str(field_name)])

控制台输出:


C:UsersFront-End>nosetests --with-freshen -v features
Retrieve an existing User: Get existing User from their ID.. . UNDEFINED:"I hav
e the user where their id is '288' and account id is '57'" # featuresget_user.f
eature:6

----------------------------------------------------------------------
Ran 1 test in 0.137s

OK (UNDEFINED=1)

有谁能指出我在做什么? cheers!

时间: 作者:

如果你在 @Given 函数中使用( d+ ) 。( d+ ) 特性应该具有这里语法( 给出了用户id为 288,帐号id为 57的用户)

M.Harbaoui

...