-
Notifications
You must be signed in to change notification settings - Fork 438
Refactor testrunner to use JSON as test descriptor. #669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor testrunner to use JSON as test descriptor. #669
Conversation
tools/test_runner.js
Outdated
| Runner.prototype.run = function() { | ||
| if (this.attr.skip && (this.attr.skip.indexOf('all') >= 0 || | ||
| this.attr.skip.indexOf(this.driver.os) >= 0)) { | ||
| if (skip = this.test['skip']) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope to declare skip variable for the function scope, or this skip, which someone might use this name on later, let him/her be very hard to seek to find where it is used.
konradlipner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general I see no benefit to use json over js. Moreover I think this limits our use case:
- json is more restrictive, does not allow functions
- we have to load it in 3 lines, instead of 1 require, and the result is exactly the same in both cases - JS object with tests description.
tools/test_runner.js
Outdated
| Runner.prototype.run = function() { | ||
| if (this.attr.skip && (this.attr.skip.indexOf('all') >= 0 || | ||
| this.attr.skip.indexOf(this.driver.os) >= 0)) { | ||
| if (skip = this.test['skip']) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- skip is undeclared, this is against coding rules
- assignment in if is a bad practice, please don't do this :)
|
The benefit of changing to JSON is for maintenance. Actually this JS file is not code but more like data. @kolipka, do you have any requirement to describe function to this file? |
|
@yichoi Currently no. In the future maybe - if we will support running tests on multiple platforms, we would possibly want to skip certain tests, not the whole file. For this purpose I would prefer to tests in test file decide does it need execution (based on some env values), rather than skipping whole file. This is just a question. Every JSON is valid JS, so switching back cost nothing if needed. There is just one thing to fix in code, and whole change is fine for me. |
|
The motivation for this is sharing this data with other environments like python. This is needed for automated testing IoT.js on devices. |
|
@kolipka, @chokobole: Thanks for your notices. As @zherczeg wrote, JSON like syntax is more general, many programming languages can deal with it easily. We have implemented an automatized test environment in Python (for stm32f4 board) and we would like the test information to be in a common format. |
bed184f to
297cbd0
Compare
|
I've updated the PR. |
|
@rtakacs Thanks. If we want to use it in python, advantage of json is clear :) |
IoT.js-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.u-szeged@partner.samsung.com
297cbd0 to
cba6530
Compare
LaszloLango
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
LGTM |
No description provided.