I am trying to implement a keyword driven framework using test complete, and can anyone help me as to how to go about it , and what approach should i take to achieve this .

有帮助吗?

解决方案

Here's what I did:

1-Create small "helper" scripts with functions you use all the time

2-One test case equals one keyword test

3-Call the small scripts in order to go through all your test case steps

This way, if you need to change something in the future, instead of going through all the tests to make that change, you can just change the helper script.

What I mean by helper scripts? Here's the example for a login page ('login.sj' file). I just made this in 5 minutes, if there's any error I'm sorry...

var passTxtBx;

function login(username, password)
{
    setUsername(username);
    setPassword(password);

    passTxtBx = Sys.Browser().Page().Find("objectIdentifier", "passwordTxtBx", 50, true);

    passTxtBx.keys("[Enter]");

    if(checkWarning)
        Log.Error("Login Error")

}

function setUsername(username)
{
    Sys.Browser().Page().Find("objectIdentifier", "usernameTxtBx", 50, true).setText(username);
}


function setPassword(password)
{
    passTxtBx.setText(pasword);
}

function checkWarning()
{
    if(Sys.Browser().Page().Find("objectIdentifier", "warning", 50, true).Exists)
        return true;
    else
        return false;
}

其他提示

  1. Create a list of common actions in your application, ie. login, logout, set date.
  2. Create a library script in your project.
  3. Write small helper functions for the list of actions you defined in step 1 and place them in your library script created in step 2.
  4. Write a test script that imports the library script and calls the helper functions in the order you want to drive your application.

I extended this by writing a function that read 'keywords' and their arguments in from a spreadsheet using the DDT Object in TestComplete and called the corresponding helper function.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top