Skip to content

testing: introduce RobotFramework tests#10095

Closed
smlng wants to merge 5 commits intoRIOT-OS:masterfrom
smlng:pr/robot/init
Closed

testing: introduce RobotFramework tests#10095
smlng wants to merge 5 commits intoRIOT-OS:masterfrom
smlng:pr/robot/init

Conversation

@smlng
Copy link
Member

@smlng smlng commented Oct 1, 2018

Contribution description

This introduces the RobotFramework for writing and running RIOT test, it ships with some adapted tests. Integration into the build system is provided by a new make target: robot-test. Also adapted
the static tests, just call make robot-static-test.

Testing procedure

Simply build and execute a robot test, e.g. by calling:

make -C tests/bench_sizeof_coretypes all robot-test

tested on various boards such as arduino-mega2560, pba-d-01-kw2x, samr21-xpro and native.

Issues/PRs references

currently depends on #10038 (maybe adapted, see discussion there)

@smlng smlng added Area: tests Area: tests and testing framework Type: new feature The issue requests / The PR implemements a new feature for RIOT Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR State: waiting for other PR State: The PR requires another PR to be merged first labels Oct 1, 2018
@smlng smlng requested a review from cladmi October 1, 2018 20:16
@smlng smlng force-pushed the pr/robot/init branch 4 times, most recently from e48c1fb to 9129271 Compare October 11, 2018 07:55
@smlng smlng requested a review from MrKevinWeiss October 11, 2018 09:18
@smlng smlng force-pushed the pr/robot/init branch 3 times, most recently from f4b4e30 to 3421c9d Compare October 11, 2018 09:51
@MrKevinWeiss
Copy link
Contributor

Can you somehow add a tag into the output xml that contains the board, test, and commit hash?

@smlng
Copy link
Member Author

smlng commented Oct 11, 2018

in theory you "know" all this because you invoke it like BOARD=something make -C tests/test-app flash robot-test, but I guess you would like to see it in the HTML output, right?

@smlng
Copy link
Member Author

smlng commented Oct 11, 2018

@MrKevinWeiss I removed the robot-open bc it doesn't work on Linux as expected. I also added some logging output including all the stuff you wanted.

@MrKevinWeiss
Copy link
Contributor

MrKevinWeiss commented Oct 12, 2018

in theory you "know" all this because you invoke it like BOARD=something make -C tests/test-app flash robot-test, but I guess you would like to see it in the HTML output, right?

More useful in the xml output. If it is possible that it just makes everything easier and more modular. Lets say we feed the output.xml to a data agitator, then we don't need anything special to pass or parse, just the xml.

@smlng
Copy link
Member Author

smlng commented Oct 12, 2018

@MrKevinWeiss please try again I added the output you wanted

@smlng
Copy link
Member Author

smlng commented Oct 12, 2018

its now part of the suite setup

@smlng smlng force-pushed the pr/robot/init branch 2 times, most recently from e10c53b to 675ad08 Compare October 12, 2018 13:24
@MrKevinWeiss
Copy link
Contributor

its now part of the suite setup

Perfect, should be very easy to integrate!

cladmi
cladmi previously requested changes Oct 15, 2018
Copy link
Contributor

@cladmi cladmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As said several times before, I do not like the format of the .robot tests descriptions. I do not find them really clear and prefer the python tests. They could also be improved and refactored without changing the whole format.

However I like the direction of producing test results files (xunit) instead of only 0 and 1 output but it is not specific to robotframework.

It is personal opinion and I put a request changes so other maintainers/devs are asked for feedback on the format. If it is only me, it is my problem and will kick me in the butt to use it.

I also have other issues with the current integration and behavior but I do not want to nitpick on it before talking about the format.

@tcschmidt
Copy link
Member

@cladmi are you just saying that you don't like the robot way of describing tests, i.e., the framework? Or do you propose to express tests differently/more clearly in the robot keywords?

@tcschmidt
Copy link
Member

@cladmi I understand your concern. On the other hand, we are comparing apples with oranges: In the specific example, the python test is a very static, fixed example, while the robot test works dynamically for changing configurations.
All in all, python is a generic scripting language that most people are familiar with. So easy to approach, but things must be handcrafted individually. The robot framework is specifically designed for testing and solves many generic problems ... but is specific. However, robot keywords may be chosen according to the domain context and 'intuition'.
It should also be noted that robot is well established with a large community of users and developers ... so nothing out of a weird niche.

@kaspar030
Copy link
Contributor

it ships with some adapted tests.

Did you try modeling our release specs with the robot framework?

I'm curious how compilation/flashing/handling of multiple nodes would look like. I remember finding it not trivial to implement a generic way to e.g., ping the link-local address of the 802154 interface of node A from node B without knowing it beforehand, or testing node A with examples/gnrc_networking compiled with "GNRC_SETTING_FOO=whiskybar", node B with "GNRC_SETTING_FOO=milkybar".

@smlng smlng force-pushed the pr/robot/init branch 4 times, most recently from fc395d3 to 45f1a91 Compare October 24, 2018 11:53
This introduces a new environment variable for a common directory
that holds all output of the build process, such as application or
package binaries. This would also allow to easily redirect output
to any other location, e.g. for out-of-source builds.
@tcschmidt
Copy link
Member

tcschmidt commented Oct 25, 2018

Now that the issue #10241 is out, the discussion about the general beauty and usefulness of Robot FW as well as its customization should go there.
This PR is currently only contributing the hook for the (urgently needed) HIL testing suite, which is done with Robot for simplicity. If the discussion in #10241 will lead to a different testing tool, we can switch with the HIL testing later.
@cladmi please review the technical appropriateness here, only, and take further aspects to #10241.

@kaspar030
Copy link
Contributor

The current build system just executes every executable in the tests/ folder.
Can the robot scripts be executed like that? Why is a seperate make target necessary?

@smlng smlng force-pushed the pr/robot/init branch 2 times, most recently from 284e8fc to 2b31819 Compare October 26, 2018 08:09
@smlng
Copy link
Member Author

smlng commented Oct 29, 2018

The current build system just executes every executable in the tests/ folder.
Can the robot scripts be executed like that? Why is a separate make target necessary?

TL;DR

no it is not possible to make the robot scripts executable.


Longer answer

1.) making the robot test scripts executable will not work, as it is necessary to run them either with robot binary or python -m robot.run. Further, several parameters are necessary, e.g. where to find libraries and resource files, but also to set output directory and so on.

2.) the extra make target is not required and the tests could be integrated into the current make test target ... that would even be possible without making them executable. However, the idea was to make this first introduction of RF tests non-intrusive which also means not to interfere with the testing currently done by Murdock. So it is more a precaution for now and make robot tests available to users without breaking existing stuff. If this works out and we are happy with RF, we can integrate with make test and remove robot-test target.

@miri64
Copy link
Member

miri64 commented Oct 29, 2018

1.) making the robot test scripts executable will not work, as it is necessary to run them either with robot binary or python -m robot.run. Further, several parameters are necessary, e.g. where to find libraries and resource files, but also to set output directory and so on.

Contrary to what you probably wanted to say this sounds to me that you can make them executable, as they are just scripts to the robot binary / robot module. Have you tried setting a she-bang in line one and setting the x flag?

@MrKevinWeiss
Copy link
Contributor

@cladmi Any update on the blocking comment? It seems some progress has been made on the RFC.

This introduces a new way to write RIOT tests using the RobotFramework,
starting by adding new make targets for easy usage.
This adds a couple of tests already ported to RobotFramework.
Add simple wrapper to run static-tests using RobotFramework, this adds
some nice HTML-output for free.
Copy link
Contributor

@MrKevinWeiss MrKevinWeiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find too much. A few recommendations on the keyword names but I think generally they are fine.

${count} = Get Number of Lines Matching Pattern ${pattern}
Should Be Equal As Integers ${count} ${number}

Verify Lines Matching Pattern Greater
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keyword recommendations (though it is pretty long):
Number of Lines Matching Pattern Should Equal
Number of Lines Matching Pattern Should Be Greater
Number of Lines Matching Pattern Should Be Less

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As stated elsewhere (can't find it right now): I would prefer if don't re-implementing pexpect in RobotFramework keywords. As far as I understand it should be possible to have a thin wrapper around pexpect with RobotFramework. This would give us a far more stable and future proof implementation.

@smlng
Copy link
Member Author

smlng commented Jan 22, 2019

superseded by #10843

@smlng smlng closed this Jan 22, 2019
@smlng smlng deleted the pr/robot/init branch June 25, 2019 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: tests Area: tests and testing framework Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR State: waiting for other PR State: The PR requires another PR to be merged first Type: new feature The issue requests / The PR implemements a new feature for RIOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants