简体   繁体   中英

Test Suite creation in robotframework-eclipse-python

I am using robot framework-python-eclipse package for my functional test automation. I have put all test cases in one folder and running those by putting below command on command line and its running fine and giving the result.

robot --timestampoutputs --log TestLog.html  --report TestReport.html --outputdir D:\TestProject_Regression_Screenshots\TestAutomationResult   -T TesttTestSuite_5Oct

But Few things I am stuck with.

  1. If I use robot test suite in eclipse then I need to put the code of all the test script in one file but I have 50 test scripts and I want to keep and run them independently and not to add in one file then how to create a test suite ? I am using robotframework-metrics to get the result on dashboard. As I am not using test suite from eclipse hence my dashboard of robotframework-metrics is showing test case name as test suite

  2. How to run single test case for multiple times using different parameters in single run. eg If I want to test login functionality with 5 different credentials then how to parameterized it to check with them one by one

  3. As I am running it using eclipse then the test cases are set in alphabetical order. How to set the order as per requirement without renaming?

4.I have 50 test scripts in 50 different .robot files then is there any way to call (not paste) them in one .robot file which will be a test suite and can run?

  1. Below is my project structure in eclipse. There is single test script in every .robot file and I have put it in a folder named TestSuite11Oct . I am running this as folder as below.

    robot --timestampoutputs --log TestLog.html --report TestReport.html --outputdir D:\\TestProject_Regression_Screenshots\\TestAutomationResult -T TestSuite11Oct 在此处输入图片说明

Now if I create robot test suite in eclipse by going to the path New>Other>Robot Framework>Robot Test Suite then it will create one new .robot file and that would be a test suite then how these two test scripts which shown in the image above should I call in that .robot test suite file to run. I dont want to paste the code from these two files in that test suite .robot file.

1 and 4 are addressed the same way - you can specify a directory, and (by default) all suite files in it will be ran, recursivly. Say you have a directory structure like this:

.
└── Suits/
    ├── UI/
    │   ├── Login
    │   └── Admin
    └── API

If you call the runner script robot Suites , all suite files in all directories will be ran. If it's robot UI , the files in the UI, Login and Admin folder will be executed, while the API - not.

So organize your suites in the way you think is the most logical, and pass the directory or files you need. Naturally, calls like robot Suites/UI/Login Suites/API are also possible.

I would suggest to read the documentation/user guide (throughly, it is really good), the section Executing test cases explains all different options for picking what to run. The tagging is also an extremely powerful feature - you can specify to run only cases with a specific tag (sanity & smoke cases sets is the easiest example) .


For 3 - how to set the execution order, by default the order is the placement of the case inside the suite. So if the cases are named "Z case", "Case one", "A case" and "Test case" they will be executed in that order, regardless that is not alphabetically ordered.


And for 2 - running the same case but with different arguments - the [Template] comes precisely for that. With it you specify a keyword - a set of steps & verifications that accepts one or more arguments, and each call to it - different argument values - becomes a separate case. You can read about it here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM