TestLink Integration

Hello,

I’m interested in combining the power of robotframework with the open source test management software TestLink (https://testlink.org/).

There are several extensions for robotframework, which implement a Listener Interface, that can report test results to TestLink. However, my use case starts at the start of the TestSuite.

We do not want to split the implementation of the TestCases between TestLink and robotframework, so, is there an “easy” way to generate robotframework compatible TestCases from TestLink (or another test management software)?

I do not want to export the TestCases as .robot files, the TestCases should be generated “on the fly”.

I’ve never used TestLink, but out of curiosity iv’e has a look, I was quite underwhelmed by it’s documentation, I found in the documentation that a test case can be Manual or Automated but there was nothing about how to setup or configure TestLink to run an automated test case.

The best I could find was this forum post (Configuration example - TestLink) which seems to be an explanation on how to remote test execution, probably best you ask on the TestLink forum if you need more information, from RobotFramework’s side you need to somehow configure TestLink to run robot with the command line parameters, you will probably want figure out how pass field values as a variable to the command line, and then add a custom field in TestLink to the test case for the robot file and then pass that custom field as a variable to robot command.

Hopefully this was helpful,

Dave.

Hi Dave,

yes, there are indeed possibilities, that TestLink can execute automated tests.
We already have a lot of automated tests in TestLink which we could load into the robotframework by using a prerunmodifier.

But, I could not find any clear guideline, how I could create robotframework testcases dynamically by using a prerunmodifier.

As far as I know, a prerunmodifier should be used in favor of a listener, because the prerunmodifier has access to the testsuite itself before it is parsed, and therefore can manipulate or even create testcases on the fly, but , as said, I could not find any good documentation on how to create robotframework testcases by using a prerunmodifier.

Hi Kai,

Ok Seems I mis-understood your original question, I thought you were asking how to get TestLink to run robotframework. I’m assuming from this more recent comment you know how to do that?

So for a prerunmodifier as I understand it these are just a script that modifies/creates a .robot file and passes that dynamically generated file to RF. This is quite easy to do as a .robot file is just a structured plain text file, quite similar to a .ini file really, the structure to the file is quite well documented.

I saw that TestLink has test steps in a table similar to ALM/QC, so I’m guessing what you are wanting to do is read these steps and generate a .robot file from them? So I would suggest you start off simple (i’m referring to the screen shot below), create a very simple test case:

  • In the first test step action put:
${hi}=	Set Variable	Hello, world!
  • In the first test expected results put:
Should Be Equal	${hi}	Hello, world!
  • In the second test step action put:
${result}=	Evaluate	2 + 3
  • In the second test expected results put:
Should Be Equal As Integers 	${result}	5

Then create you prerunmodifier that reads the steps from a test case and generates a mytest.robot file that looks like this (note spaces/tabs are important in robot files just like in python):

*** Test Cases ***
My Test
	${hi}=	Set Variable	Hello, world!
	Should Be Equal	${hi}	Hello, world!
	${result}=	Evaluate	2 + 3
	Should Be Equal As Integers 	${result}	5

This is a pretty minimal working robot file, as all the keywords are builtin keywords so no there are no library dependancies, but if you can get TestLink to run a prerunmodifier that generates that file and run it with robot, then you’ll be well on your way.

The next step would be to add an end_test listener to catch the result and update the test execution with a pass/fail and possibly return any non empty message.

I Couldn’t tell from the documentation for TestLink if it records a pass/fail for each test step in a test execution or just simply a pass/fail for the Test Case? If TestLink if it records a pass/fail for each test step the next step would probably be to get the prerunmodifier to generate the file like this so that your listener can update the status of the individual steps:

*** Test Cases ***
My Test
	Step 1
	Step 2

*** Keywords ***
Step 1
	${hi}=	Set Variable	Hello, world!
	Should Be Equal	${hi}	Hello, world!

Step 2
	${result}=	Evaluate	2 + 3
	Should Be Equal As Integers 	${result}	5

I hope this is helpfull,

Dave.

1 Like

Ah, ok I see.

But, is there a way, that I can achieve this without writing the actual robot file? :thinking:
I’ve seen in the code for robotframework, that there are possibilities for adding parts of a TestCase programmatically, but this way is very tedious…

On the other hand, with your solution, I could map the actual Steps of a TestCase in TestLink to pseudo steps (User Keywords), which is something I haven’t think of before.

Hi Kai,

I have no idea about that one, I’ve never tried to use RF like that.

It is quite easy to write the .robot file to a temp location and then just tell robot where the .robot file is. the other advantage is when debugging you can dig out the robot file and work out why something is not working or use it in a forum post if you need help.

My next suggestions was going to be to have a keyword library of pre defined keywords specific to your application that your testers could use as their step actions. The user would then write test steps like

step action expected results
Open xyz application as accountsperson accountsperson logged in
create PO PO has PO number

Then your prerunner would include that keyword library, the keyword library would include all the libraries needed for automating your application and keywords that turned these phrases into a sequence of keywords that drive the application.

But if you go down this path with heavily abstracted keywords you will want to be able to grab that generated robot file when you need to debug these keywords.

Dave.

1 Like

Hi Kai,

I don’t know if you have considered performance testing yet?

As I am the author of rfswarm so this is another reason for generating the robot files as rfswam uses the robot file for creating performance tests. You could potentially down the track have a prerunner that generates the robot files for several test cases, then generates a rfswarm scenario (it’s just an ini file) and then run rfswarm with/without the gui to run a performance test on your application.

If this is all tied into your build process you’d have quite the impressive setup.

Dave.