是德科技
直播中

余姗姗

7年用户 180经验值
私信 关注
[问答]

TestexecSL ActiveX异常(RPC服务器不可用)

嗨,我正在使用vb .net创建一个Windows窗体应用程序。
表单应用程序有3个按钮来执行测试用例。
在testexecsl中,我创建了2个testplan(.tpa文件),每个文件只有一个测试。
第三个测试计划有2个测试(测试计划1和2的测试)。
TestPlan1.tpa(Test1)TestPlan2.tpa(Test2)TestPlan3.tpa(Test1& Test2)现在使用testexecsl activeX控件我正在加载&
在表单应用程序按钮上单击运行上面的testplan。
'On Button1_click Task1()'On Button2_click Task2()'On Button3_click Task1()'Thread.sleep(2000)Task2()'下面是vb函数Public Sub Task1()txsl1.LoadTestplan(“C: TestPlans  Testplan1”
.tpa“)txsl1.Testplan.Run()End Sub Public Sub Task2()txsl1.LoadTestplan(”C: TestPlans  Testplan2.tpa“)txsl1.Testplan.Run()End Sub Public Sub Task3()txsl1.LoadTestplan
(“C: TestPlans  Testplan3.tpa”)txsl1.Testplan.Run()End Sub上面的代码适用于按钮1和2,但对于按钮3,我得到异常。
下面是描述RPC服务器不可用。[来自HRESULT的异常:0x800706BA)。
我尝试从service.msi启用RPC定位器服务,但没有成功。
1.是否允许,加载并运行多个测试计划?
2.我无法使用所有测试创建单个测试计划(.tpa),因为我必须执行一个测试或两个测试。我不知道如何在测试计划(.tpa)中选择单个测试。
我检查了testexecsl API。
pl提供解决方案。
最诚挚的问候,Hemant。

以上来自于谷歌翻译


     以下为原文

  Hi,

I am creating a windows form application using vb .net.
form app has 3 buttons to execute testcases.

In testexecsl i have created 2 testplan (.tpa files), each with one test only. And the third testplan with 2 tests (tests of testplan 1&2).

TestPlan1.tpa ( Test1)
TestPlan2.tpa ( Test2)
TestPlan3.tpa ( Test1 & Test2)

Now using testexecsl activeX control i am loading & running the above testplan's on form application button click.

'On Button1_click
Task1()

'On Button2_click
Task2()

'On Button3_click
Task1()
'Thread.sleep(2000)
Task2()



'Below are the vb functions

Public Sub Task1()

        txsl1.LoadTestplan("C:TestPlansTestplan1.tpa")

       txsl1.Testplan.Run()

  End Sub



  Public Sub Task2()

       txsl1.LoadTestplan("C:TestPlansTestplan2.tpa")

       txsl1.Testplan.Run()

  End Sub


Public Sub Task3()

       txsl1.LoadTestplan("C:TestPlansTestplan3.tpa")

       txsl1.Testplan.Run()

End Sub



The above code works fine for button 1 and 2 , but for button 3 i am getting exception. below is the description
The RPC server is unavailable .[exception from HRESULT: 0x800706BA).

I tried by enabling the RPC locator services from the service.msi , but no success.

1. Is it allowed ,Loading and running multiple testplan?
2. I cannot create a single testplan(.tpa) with all the tests since i have to perform either one test  or both .and i don't know how to select a single tests within a testplan(.tpa). i checked the testexecsl API's .

pl provide solution.



Best Regards,
Hemant.  

回帖(1)

邢东

2018-10-9 10:03:26
Hi Hemant,_Question 1_:你可以通过1个testplan运行1个testplan。
但是,您应该在使用object.Testplan.State加载第二个测试计划之前检查测试计划的状态。下面是一个如何完成此操作的示例:private void runTestplan3(string testplan){if(TestExecSL1.LoadTestplan(testplan)){richTextBox1。
AppendText(testplan + Environment.NewLine);
string state = TestExecSL1.Testplan.State.ToString();
richTextBox1.AppendText(state + Environment.NewLine);
TestExecSL1.Testplan.Run();
state = TestExecSL1.Testplan.State.ToString();
richTextBox1.AppendText(state + Environment.NewLine);
int a;
a = string.Compare(state,“TestplanPassed”);
while(a!= 0){Thread.Sleep(1000);
// delay 1s state = TestExecSL1.Testplan.State.ToString();
a = string.Compare(state,“TestplanPassed”);
richTextBox1.AppendText(state + Environment.NewLine);
在加载另一个测试计划之前首先卸载testplan是一个好习惯//TestExecSL1.UnloadTestplan();
richTextBox1.AppendText(Environment.NewLine);
private void button3_Click(object sender,EventArgs e){richTextBox1.Clear();
string testplan =“C:\ My TxSL Files \ UUTs \ My UUT Name \ testplan1.tpa”;
runTestplan3(testplan);
testplan =“C:\ My TxSL Files \ UUTs \ My UUT Name \ testplan2.tpa”;
runTestplan3(testplan);
} _Question 2_:要选择单个测试项,可以使用object.Testplan.Tests.Item(index).Execute谢谢。
此致,辛西娅

以上来自于谷歌翻译


     以下为原文

  Hi Hemant,

_Question 1_:
You are able to run 1 testplan by 1 testplan. However, you should check the state of the testplan before loading the 2nd testplan using
object.Testplan.State

Here's an example how this can be done:

private void runTestplan3(string testplan)
        {
            if (TestExecSL1.LoadTestplan(testplan))
            {
                richTextBox1.AppendText(testplan + Environment.NewLine);
                string state = TestExecSL1.Testplan.State.ToString();
                richTextBox1.AppendText(state + Environment.NewLine);

                TestExecSL1.Testplan.Run();

                state = TestExecSL1.Testplan.State.ToString();
                richTextBox1.AppendText(state + Environment.NewLine);

                int a;
                a = string.Compare(state, "TestplanPassed");

                while (a != 0)
                {
                    Thread.Sleep(1000); // delay 1s
                    state = TestExecSL1.Testplan.State.ToString();
                    a = string.Compare(state, "TestplanPassed");
                    richTextBox1.AppendText(state + Environment.NewLine);
                }

                // It is a good practice to unload testplan first before loading another testplan
                //TestExecSL1.UnloadTestplan(); 
                richTextBox1.AppendText(Environment.NewLine);
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            richTextBox1.Clear();
            string testplan = "C:\My TxSL Files\UUTs\My UUT Name\testplan1.tpa";
            runTestplan3 (testplan);

            testplan = "C:\My TxSL Files\UUTs\My UUT Name\testplan2.tpa";
            runTestplan3 (testplan);
        }

_Question 2_:
To Select single test item, you may use
object.Testplan.Tests.Item(index).Execute

Thanks.

Regards,
Cynthia
举报

更多回帖

发帖
×
20
完善资料,
赚取积分