51Testing软件测试论坛

标题: Failed to end Transaction "login" (by name). [打印本页]

作者: wang_shi_huan    时间: 2008-12-17 15:00
标题: Failed to end Transaction "login" (by name).
lr_output_message("The current username is %s",lr_eval_string("{username}"));
   
    lr_output_message("The current password is %s",lr_eval_string("{password}"));

    if(status==0)
        lr_end_transaction("login",LR_PASS);
    else
        lr_end_transaction("login",LR_FAIL);
    if(trans_time)
       lr_output_message("login事务耗时 %f 秒",trans_time);
    else
        lr_output_message("The duration cannot be determined.");
    if(atoi(lr_eval_string("{loginCount}"))>0){
        lr_error_message("login failed");}
    else
        {lr_output_message("login successful");
    return(0);}
    lr_end_transaction("login", LR_AUTO);

Failed to end Transaction "login" (by name). Please check that you made a call to start transaction operation.麻烦大家帮忙看看
作者: archonwang    时间: 2008-12-17 15:11
事务定义语句不匹配。

缺少Lr_start_transaction()函数。
作者: wang_shi_huan    时间: 2008-12-17 15:54
我迭代执行的,参数化了两个用户名,分别为longgy   d111,密码分别为654123   6541234,
第一次执行的结果是正确的:Action.c(20): web_submit_data("login") was successful, 76888 body bytes, 3421 header bytes, 65 chunking overhead bytes          [MsgId: MMSG-26385]
Action.c(39): The current username is longgy888   
Action.c(41): The current password is 654123
Action.c(45): Notify: Transaction "login" ended with "Pass" status (Duration: 2.0163 Wasted Time: 0.0004).
Action.c(53): login事务耗时 0.019677 秒
Action.c(65): login successful
Ending action Action.
第二次执行的结果是错误的:Action.c(39): The current username is d111
Action.c(41): The current password is 6541234
Action.c(45): Notify: Transaction "login" ended with "Pass" status (Duration: 1.5387 Wasted Time: 0.0001).
Action.c(53): login事务耗时 0.008038 秒
Action.c(61): Error: login failed
Action.c(69): Error: Failed to end Transaction "login" (by name). Please check that you made a call to start transaction operation.
Action.c(72): Notify: Transaction "logout" started.

如果缺少的话,那为什么第一次能执行成功,第二次就才爆这个错误呢?
作者: lch199883    时间: 2008-12-17 16:37
你定义了结束事务,但没有开始事务。
作者: wang_shi_huan    时间: 2008-12-17 16:48
我定义了的啊,只不过没贴出来


double trans_time;

    int status;

        lr_start_transaction("login");

    trans_time=lr_get_transaction_duration("login");

    web_reg_find("Text=用户名或密码错误",

        "SaveCount=loginCount",LAST);
这就是定义的那部分
作者: yetties2005    时间: 2008-12-17 17:35
帮顶。。。
作者: superfang    时间: 2008-12-17 21:46
if(status==0)
        lr_end_transaction("login",LR_PASS);
    else
        lr_end_transaction("login",LR_FAIL); 
你这不已经有结果的事务了,为什么最后又写了一个  lr_end_transaction("login", LR_AUTO); 
  很明显不对!去掉后面这个结束的事务就可以了。!
 




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2