Compare 2 cucumber JSON reports with ruby
up vote
0
down vote
favorite
The problem is: I have 2 cucumber test reports in JSON format
I need to remove redundant key-value pairs from those reports and compare them, but I can't understand how to remove the unnecessary data from those 2 jsons because of their structure after JSON.parse (array or hash with many nested arrays/hashes). Please advice if there are some gems or known solutions to do this
JSON structure is e.g. :
[
{
"uri": "features/home_screen.feature",
"id": "as-a-user-i-want-to-explore-home-screen",
"keyword": "Feature",
"name": "As a user I want to explore home screen",
"description": "",
"line": 2,
"tags": [
{
"name": "@home_screen",
"line": 1
}
],
"elements": [
{
"keyword": "Background",
"name": "",
"description": "",
"line": 3,
"type": "background",
"before": [
{
"match": {
"location": "features/step_definitions/support/hooks.rb:1"
},
"result": {
"status": "passed",
"duration": 505329000
}
}
],
"steps": [
{
"keyword": "Given ",
"name": "I click OK button in popup",
"line": 4,
"match": {
"location": "features/step_definitions/registration_steps.rb:91"
},
"result": {
"status": "passed",
"duration": 2329140000
}
},
{
"keyword": "And ",
"name": "I click Allow button in popup",
"line": 5,
"match": {
"location": "features/step_definitions/registration_steps.rb:96"
},
"result": {
"status": "passed",
"duration": 1861776000
}
}
]
},
json ruby cucumber
|
show 1 more comment
up vote
0
down vote
favorite
The problem is: I have 2 cucumber test reports in JSON format
I need to remove redundant key-value pairs from those reports and compare them, but I can't understand how to remove the unnecessary data from those 2 jsons because of their structure after JSON.parse (array or hash with many nested arrays/hashes). Please advice if there are some gems or known solutions to do this
JSON structure is e.g. :
[
{
"uri": "features/home_screen.feature",
"id": "as-a-user-i-want-to-explore-home-screen",
"keyword": "Feature",
"name": "As a user I want to explore home screen",
"description": "",
"line": 2,
"tags": [
{
"name": "@home_screen",
"line": 1
}
],
"elements": [
{
"keyword": "Background",
"name": "",
"description": "",
"line": 3,
"type": "background",
"before": [
{
"match": {
"location": "features/step_definitions/support/hooks.rb:1"
},
"result": {
"status": "passed",
"duration": 505329000
}
}
],
"steps": [
{
"keyword": "Given ",
"name": "I click OK button in popup",
"line": 4,
"match": {
"location": "features/step_definitions/registration_steps.rb:91"
},
"result": {
"status": "passed",
"duration": 2329140000
}
},
{
"keyword": "And ",
"name": "I click Allow button in popup",
"line": 5,
"match": {
"location": "features/step_definitions/registration_steps.rb:96"
},
"result": {
"status": "passed",
"duration": 1861776000
}
}
]
},
json ruby cucumber
Did you look for a gems that compare json or hashes?
– Martin Zinovsky
2 days ago
1
You might tryiteraptor
the gem I have created exactly for this kind of tasks. It allows iterating, mapping and reducing the deeply nested structures.
– Aleksei Matiushkin
2 days ago
@AlekseiMatiushkin interesting, will try it now, I'll keep you posted on the result
– Mikhah
2 days ago
@AlekseiMatiushkin looks like this is exactly what I've needed, thanks a lot
– Mikhah
2 days ago
@Mikhah cool, welcome.
– Aleksei Matiushkin
2 days ago
|
show 1 more comment
up vote
0
down vote
favorite
up vote
0
down vote
favorite
The problem is: I have 2 cucumber test reports in JSON format
I need to remove redundant key-value pairs from those reports and compare them, but I can't understand how to remove the unnecessary data from those 2 jsons because of their structure after JSON.parse (array or hash with many nested arrays/hashes). Please advice if there are some gems or known solutions to do this
JSON structure is e.g. :
[
{
"uri": "features/home_screen.feature",
"id": "as-a-user-i-want-to-explore-home-screen",
"keyword": "Feature",
"name": "As a user I want to explore home screen",
"description": "",
"line": 2,
"tags": [
{
"name": "@home_screen",
"line": 1
}
],
"elements": [
{
"keyword": "Background",
"name": "",
"description": "",
"line": 3,
"type": "background",
"before": [
{
"match": {
"location": "features/step_definitions/support/hooks.rb:1"
},
"result": {
"status": "passed",
"duration": 505329000
}
}
],
"steps": [
{
"keyword": "Given ",
"name": "I click OK button in popup",
"line": 4,
"match": {
"location": "features/step_definitions/registration_steps.rb:91"
},
"result": {
"status": "passed",
"duration": 2329140000
}
},
{
"keyword": "And ",
"name": "I click Allow button in popup",
"line": 5,
"match": {
"location": "features/step_definitions/registration_steps.rb:96"
},
"result": {
"status": "passed",
"duration": 1861776000
}
}
]
},
json ruby cucumber
The problem is: I have 2 cucumber test reports in JSON format
I need to remove redundant key-value pairs from those reports and compare them, but I can't understand how to remove the unnecessary data from those 2 jsons because of their structure after JSON.parse (array or hash with many nested arrays/hashes). Please advice if there are some gems or known solutions to do this
JSON structure is e.g. :
[
{
"uri": "features/home_screen.feature",
"id": "as-a-user-i-want-to-explore-home-screen",
"keyword": "Feature",
"name": "As a user I want to explore home screen",
"description": "",
"line": 2,
"tags": [
{
"name": "@home_screen",
"line": 1
}
],
"elements": [
{
"keyword": "Background",
"name": "",
"description": "",
"line": 3,
"type": "background",
"before": [
{
"match": {
"location": "features/step_definitions/support/hooks.rb:1"
},
"result": {
"status": "passed",
"duration": 505329000
}
}
],
"steps": [
{
"keyword": "Given ",
"name": "I click OK button in popup",
"line": 4,
"match": {
"location": "features/step_definitions/registration_steps.rb:91"
},
"result": {
"status": "passed",
"duration": 2329140000
}
},
{
"keyword": "And ",
"name": "I click Allow button in popup",
"line": 5,
"match": {
"location": "features/step_definitions/registration_steps.rb:96"
},
"result": {
"status": "passed",
"duration": 1861776000
}
}
]
},
json ruby cucumber
json ruby cucumber
asked 2 days ago
Mikhah
619
619
Did you look for a gems that compare json or hashes?
– Martin Zinovsky
2 days ago
1
You might tryiteraptor
the gem I have created exactly for this kind of tasks. It allows iterating, mapping and reducing the deeply nested structures.
– Aleksei Matiushkin
2 days ago
@AlekseiMatiushkin interesting, will try it now, I'll keep you posted on the result
– Mikhah
2 days ago
@AlekseiMatiushkin looks like this is exactly what I've needed, thanks a lot
– Mikhah
2 days ago
@Mikhah cool, welcome.
– Aleksei Matiushkin
2 days ago
|
show 1 more comment
Did you look for a gems that compare json or hashes?
– Martin Zinovsky
2 days ago
1
You might tryiteraptor
the gem I have created exactly for this kind of tasks. It allows iterating, mapping and reducing the deeply nested structures.
– Aleksei Matiushkin
2 days ago
@AlekseiMatiushkin interesting, will try it now, I'll keep you posted on the result
– Mikhah
2 days ago
@AlekseiMatiushkin looks like this is exactly what I've needed, thanks a lot
– Mikhah
2 days ago
@Mikhah cool, welcome.
– Aleksei Matiushkin
2 days ago
Did you look for a gems that compare json or hashes?
– Martin Zinovsky
2 days ago
Did you look for a gems that compare json or hashes?
– Martin Zinovsky
2 days ago
1
1
You might try
iteraptor
the gem I have created exactly for this kind of tasks. It allows iterating, mapping and reducing the deeply nested structures.– Aleksei Matiushkin
2 days ago
You might try
iteraptor
the gem I have created exactly for this kind of tasks. It allows iterating, mapping and reducing the deeply nested structures.– Aleksei Matiushkin
2 days ago
@AlekseiMatiushkin interesting, will try it now, I'll keep you posted on the result
– Mikhah
2 days ago
@AlekseiMatiushkin interesting, will try it now, I'll keep you posted on the result
– Mikhah
2 days ago
@AlekseiMatiushkin looks like this is exactly what I've needed, thanks a lot
– Mikhah
2 days ago
@AlekseiMatiushkin looks like this is exactly what I've needed, thanks a lot
– Mikhah
2 days ago
@Mikhah cool, welcome.
– Aleksei Matiushkin
2 days ago
@Mikhah cool, welcome.
– Aleksei Matiushkin
2 days ago
|
show 1 more comment
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Since you are asking for a gem, you might try iteraptor
I have created exactly for this kind of tasks.
It allows iterating, mapping and reducing the deeply nested structures. For instance, to filter out all the keys called "name"
on all levels, you might do:
input.iteraptor.reject(/name/)
The more detailed description might be found on the github page linked above.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Since you are asking for a gem, you might try iteraptor
I have created exactly for this kind of tasks.
It allows iterating, mapping and reducing the deeply nested structures. For instance, to filter out all the keys called "name"
on all levels, you might do:
input.iteraptor.reject(/name/)
The more detailed description might be found on the github page linked above.
add a comment |
up vote
1
down vote
accepted
Since you are asking for a gem, you might try iteraptor
I have created exactly for this kind of tasks.
It allows iterating, mapping and reducing the deeply nested structures. For instance, to filter out all the keys called "name"
on all levels, you might do:
input.iteraptor.reject(/name/)
The more detailed description might be found on the github page linked above.
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Since you are asking for a gem, you might try iteraptor
I have created exactly for this kind of tasks.
It allows iterating, mapping and reducing the deeply nested structures. For instance, to filter out all the keys called "name"
on all levels, you might do:
input.iteraptor.reject(/name/)
The more detailed description might be found on the github page linked above.
Since you are asking for a gem, you might try iteraptor
I have created exactly for this kind of tasks.
It allows iterating, mapping and reducing the deeply nested structures. For instance, to filter out all the keys called "name"
on all levels, you might do:
input.iteraptor.reject(/name/)
The more detailed description might be found on the github page linked above.
answered 2 days ago
Aleksei Matiushkin
77k95087
77k95087
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53410337%2fcompare-2-cucumber-json-reports-with-ruby%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did you look for a gems that compare json or hashes?
– Martin Zinovsky
2 days ago
1
You might try
iteraptor
the gem I have created exactly for this kind of tasks. It allows iterating, mapping and reducing the deeply nested structures.– Aleksei Matiushkin
2 days ago
@AlekseiMatiushkin interesting, will try it now, I'll keep you posted on the result
– Mikhah
2 days ago
@AlekseiMatiushkin looks like this is exactly what I've needed, thanks a lot
– Mikhah
2 days ago
@Mikhah cool, welcome.
– Aleksei Matiushkin
2 days ago