Jonur / pi-cucumber-reports

Visual representation of the Test Automation Overview Report from Cucumber
0 stars 0 forks source link

Display api reports #16

Closed konstantinosmakris2 closed 5 years ago

konstantinosmakris2 commented 5 years ago

I want to be able to only see information related to the API tests. The below information should not be displayed on the Web report for the API tests:

Browser | Version | Platform | Resolution The API tests are tagged with the @api flag. The tagname is: "tags":[{"name":"@api"},{"name":"@api-amend"} Any "tag" that Starts with @api AND (&&) "name" that starts with @api, should not display the browser information in the report. The condition should be true for both to skip the browser information. I attach a json sample below

konstantinosmakris2 commented 5 years ago

cucumber.txt

Jonur commented 5 years ago

Hi @konstantinosmakris2 , I have pushed a change which makes the application compatible with the JSON files like the ones you shared, which lack the "output" node. Now, it won't break. But, to implement the change you're asking for, I will need the "api" information to be available at a higher level on the JSON. At the moment it is rooted very deep and I will have to iterate through all features, scenarios, steps, etc. to mine it. This is resource heavy if we have many nodes.

Could you have the information of whether or not this is an API test, as a sibling to the "project", "environment", etc. keys?

konstantinosmakris2 commented 5 years ago

{"apifeatures":[{"line":2,"elements":[{"before":[{"result":{"duration":419357,"status":"passed"},"match":{"location":"Hooks.startScenario(Scenario)"}}],"line":28,"name":"Business booker user is able to retrieve company details","description":"","id":"as-a-business-booker-user-i-want-to-be-make-sure-that-the-apis-consumed-by-the-application-work-as-expected;business-booker-user-is-able-to-retrieve-company-details;;4","after":[{"result":{"duration":403205,"status":"passed"},"match":{"location":"Hooks.logResults(Scenario)"}}],"type":"scenario","keyword":"Scenario Outline","steps":[{"result":{"duration":342404458,"status":"passed"},"line":20,"name":"I am logged in the bb application as \"booker\"","match":{"arguments":[{"val":"booker","offset":38}],"location":"ApiStepDefs.java:31"},"keyword":"Given "},{"result":{"duration":278471052,"status":"passed"},"line":21,"name":"I request company details","match":{"location":"ApiStepDefs.java:63"},"keyword":"When "},{"result":{"duration":47751027,"status":"passed"},"line":22,"name":"the company details are returned","match":{"location":"ApiStepDefs.java:67"},"keyword":"Then "}],"tags":[{"name":"@api"},{"name":"@api-amend"}]},{"before":[{"result":{"duration":379755,"status":"passed"},"match":{"location":"Hooks.startScenario(Scenario)"}}],"line":39,"name":"Business booker user is able to retrieve hotel information details","description":"","id":"as-a-business-booker-user-i-want-to-be-make-sure-that-the-apis-consumed-by-the-application-work-as-expected;business-booker-user-is-able-to-retrieve-hotel-information-details;;2","after":[{"result":{"duration":363389,"status":"passed"},"match":{"location":"Hooks.logResults(Scenario)"}}],"type":"scenario","keyword":"Scenario Outline","steps":[{"result":{"duration":342053261,"status":"passed"},"line":33,"name":"I am logged in the bb application as \"travel-manager\"","match":{"arguments":[{"val":"travel-manager","offset":38}],"location":"ApiStepDefs.java:31"},"keyword":"Given "},{"result":{"duration":74295783,"status":"passed"},"line":34,"name":"I request hotel info details","match":{"location":"ApiStepDefs.java:72"},"keyword":"When "},{"result":{"duration":1319082,"status":"passed"},"line":35,"name":"the hotels details are returned","match":{"location":"ApiStepDefs.java:76"},"keyword":"Then "}],"tags":[{"name":"@api"},{"name":"@api-amend"}]},{"before":[{"result":{"duration":3354348,"status":"passed"},"match":{"location":"Hooks.startScenario(Scenario)"}}],"line":60,"name":"Amend room requests for newly created booking as self booker","description":"","id":"as-a-business-booker-user-i-want-to-be-make-sure-that-the-apis-consumed-by-the-application-work-as-expected;amend-room-requests-for-newly-created-booking-as-self-booker;;2","after":[{"result":{"duration":314978,"status":"passed"},"match":{"location":"Hooks.logResults(Scenario)"}}],"type":"scenario","keyword":"Scenario Outline","steps":[{"result":{"duration":1951370816,"status":"passed"},"line":46,"name":"I am logged in the bb application as \"self-booker\"","match":{"arguments":[{"val":"self-booker","offset":38}],"location":"ApiStepDefs.java:31"},"keyword":"Given "},{"result":{"duration":1661489705,"status":"passed"},"line":47,"name":"a hotel is available for \"Flex\" rate \"Visa Credit\" card \"1\" rooms and \"1\" nights","match":{"arguments":[{"val":"Flex","offset":26},{"val":"Visa Credit","offset":38},{"val":"1","offset":57},{"val":"1","offset":71}],"location":"ApiStepDefs.java:83"},"keyword":"And "},{"result":{"duration":554100186,"status":"passed"},"line":48,"name":"I set hotel reservation data for \"self-booker\"","match":{"arguments":[{"val":"self-booker","offset":34}],"location":"ApiStepDefs.java:94"},"keyword":"And "},{"result":{"duration":390282645,"status":"passed"},"line":49,"name":"I search for that available hotel","match":{"location":"ApiStepDefs.java:98"},"keyword":"And "},{"result":{"duration":1039632276,"status":"passed"},"line":50,"name":"I create a hotel reservation","match":{"location":"ApiStepDefs.java:125"},"keyword":"And "},{"result":{"duration":394349145,"status":"passed"},"line":51,"name":"I can create a booking as \"self-booker\" user","match":{"arguments":[{"val":"self-booker","offset":27}],"location":"ApiStepDefs.java:129"},"keyword":"And "},{"result":{"duration":661067002,"status":"passed"},"line":52,"name":"I can retrieve booking details for user","match":{"location":"ApiStepDefs.java:133"},"keyword":"And "},{"result":{"duration":277611490,"status":"passed"},"line":53,"name":"I am logged in the bb application as \"self-booker\"","match":{"arguments":[{"val":"self-booker","offset":38}],"location":"ApiStepDefs.java:31"},"keyword":"And "},{"result":{"duration":3184693088,"status":"passed"},"line":54,"name":"I perform a new search availability for the given hotel for \"0\" children \"1\" adults \"false\" cot \"DB\" type and \"1\" rooms","match":{"arguments":[{"val":"0","offset":61},{"val":"1","offset":74},{"val":"false","offset":85},{"val":"DB","offset":97},{"val":"1","offset":111}],"location":"ApiStepDefs.java:102"},"keyword":"When "},{"result":{"duration":729353898,"status":"passed"},"line":55,"name":"I can trigger a new amend","match":{"location":"ApiStepDefs.java:137"},"keyword":"And "},{"result":{"duration":1468199310,"status":"passed"},"line":56,"name":"I can execute amend booking on \"amend-booking-1room.json\"","match":{"arguments":[{"val":"amend-booking-1room.json","offset":32}],"location":"ApiStepDefs.java:141"},"keyword":"Then "}],"tags":[{"name":"@api"},{"name":"@api-amend"},{"name":"@api"}]},{"before":[{"result":{"duration":2554206,"status":"passed"},"match":{"location":"Hooks.startScenario(Scenario)"}}],"line":13,"name":"Business booker user is able to search for an employee by providing the company id and the employee name","description":"","id":"as-a-business-booker-user-i-want-to-be-make-sure-that-the-apis-consumed-by-the-application-work-as-expected;business-booker-user-is-able-to-search-for-an-employee-by-providing-the-company-id-and-the-employee-name;;2","after":[{"result":{"duration":307629,"status":"passed"},"match":{"location":"Hooks.logResults(Scenario)"}}],"type":"scenario","keyword":"Scenario Outline","steps":[{"result":{"duration":5784407082,"status":"passed"},"line":7,"name":"I am logged in the bb application as \"travel-manager\"","match":{"arguments":[{"val":"travel-manager","offset":38}],"location":"ApiStepDefs.java:31"},"keyword":"Given "},{"result":{"duration":267232776,"status":"passed"},"line":8,"name":"I search for an employee","match":{"location":"ApiStepDefs.java:47"},"keyword":"When "},{"result":{"duration":47079,"status":"passed"},"line":9,"name":"The employee details are returned","match":{"location":"ApiStepDefs.java:52"},"keyword":"Then "}],"tags":[{"name":"@api"},{"name":"@api-amend"}]},{"before":[{"result":{"duration":3016932,"status":"passed"},"match":{"location":"Hooks.startScenario(Scenario)"}}],"line":14,"name":"Business booker user is able to search for an employee by providing the company id and the employee name","description":"","id":"as-a-business-booker-user-i-want-to-be-make-sure-that-the-apis-consumed-by-the-application-work-as-expected;business-booker-user-is-able-to-search-for-an-employee-by-providing-the-company-id-and-the-employee-name;;3","after":[{"result":{"duration":298979,"status":"passed"},"match":{"location":"Hooks.logResults(Scenario)"}}],"type":"scenario","keyword":"Scenario Outline","steps":[{"result":{"duration":1951476264,"status":"passed"},"line":7,"name":"I am logged in the bb application as \"self-booker\"","match":{"arguments":[{"val":"self-booker","offset":38}],"location":"ApiStepDefs.java:31"},"keyword":"Given "},{"result":{"duration":800705901,"status":"passed"},"line":8,"name":"I search for an employee","match":{"location":"ApiStepDefs.java:47"},"keyword":"When "},{"result":{"duration":61940,"status":"passed"},"line":9,"name":"The employee details are returned","match":{"location":"ApiStepDefs.java:52"},"keyword":"Then "}],"tags":[{"name":"@api"},{"name":"@api-amend"}]},{"before":[{"result":{"duration":3041277,"status":"passed"},"match":{"location":"Hooks.startScenario(Scenario)"}}],"line":15,"name":"Business booker user is able to search for an employee by providing the company id and the employee name","description":"","id":"as-a-business-booker-user-i-want-to-be-make-sure-that-the-apis-consumed-by-the-application-work-as-expected;business-booker-user-is-able-to-search-for-an-employee-by-providing-the-company-id-and-the-employee-name;;4","after":[{"result":{"duration":422123,"status":"passed"},"match":{"location":"Hooks.logResults(Scenario)"}}],"type":"scenario","keyword":"Scenario Outline","steps":[{"result":{"duration":1951315755,"status":"passed"},"line":7,"name":"I am logged in the bb application as \"booker\"","match":{"arguments":[{"val":"booker","offset":38}],"location":"ApiStepDefs.java:31"},"keyword":"Given "},{"result":{"duration":896699316,"status":"passed"},"line":8,"name":"I search for an employee","match":{"location":"ApiStepDefs.java:47"},"keyword":"When "},{"result":{"duration":44384,"status":"passed"},"line":9,"name":"The employee details are returned","match":{"location":"ApiStepDefs.java:52"},"keyword":"Then "}],"tags":[{"name":"@api"},{"name":"@api-amend"}]},{"before":[{"result":{"duration":3236661,"status":"passed"},"match":{"location":"Hooks.startScenario(Scenario)"}}],"line":40,"name":"Business booker user is able to retrieve hotel information details","description":"","id":"as-a-business-booker-user-i-want-to-be-make-sure-that-the-apis-consumed-by-the-application-work-as-expected;business-booker-user-is-able-to-retrieve-hotel-information-details;;3","after":[{"result":{"duration":561222,"status":"passed"},"match":{"location":"Hooks.logResults(Scenario)"}}],"type":"scenario","keyword":"Scenario Outline","steps":[{"result":{"duration":1951387775,"status":"passed"},"line":33,"name":"I am logged in the bb application as \"self-booker\"","match":{"arguments":[{"val":"self-booker","offset":38}],"location":"ApiStepDefs.java:31"},"keyword":"Given "},{"result":{"duration":509589586,"status":"passed"},"line":34,"name":"I request hotel info details","match":{"location":"ApiStepDefs.java:72"},"keyword":"When "},{"result":{"duration":7540721,"status":"passed"},"line":35,"name":"the hotels details are returned","match":{"location":"ApiStepDefs.java:76"},"keyword":"Then "}],"tags":[{"name":"@api"},{"name":"@api-amend"}]},{"before":[{"result":{"duration":3442068,"status":"passed"},"match":{"location":"Hooks.startScenario(Scenario)"}}],"line":26,"name":"Business booker user is able to retrieve company details","description":"","id":"as-a-business-booker-user-i-want-to-be-make-sure-that-the-apis-consumed-by-the-application-work-as-expected;business-booker-user-is-able-to-retrieve-company-details;;2","after":[{"result":{"duration":501537,"status":"passed"},"match":{"location":"Hooks.logResults(Scenario)"}}],"type":"scenario","keyword":"Scenario Outline","steps":[{"result":{"duration":1951169036,"status":"passed"},"line":20,"name":"I am logged in the bb application as \"travel-manager\"","match":{"arguments":[{"val":"travel-manager","offset":38}],"location":"ApiStepDefs.java:31"},"keyword":"Given "},{"result":{"duration":893741860,"status":"passed"},"line":21,"name":"I request company details","match":{"location":"ApiStepDefs.java:63"},"keyword":"When "},{"result":{"duration":326655584,"status":"passed"},"line":22,"name":"the company details are returned","match":{"location":"ApiStepDefs.java:67"},"keyword":"Then "}],"tags":[{"name":"@api"},{"name":"@api-amend"}]},{"before":[{"result":{"duration":2235382,"status":"passed"},"match":{"location":"Hooks.startScenario(Scenario)"}}],"line":27,"name":"Business booker user is able to retrieve company details","description":"","id":"as-a-business-booker-user-i-want-to-be-make-sure-that-the-apis-consumed-by-the-application-work-as-expected;business-booker-user-is-able-to-retrieve-company-details;;3","after":[{"result":{"duration":460519,"status":"passed"},"match":{"location":"Hooks.logResults(Scenario)"}}],"type":"scenario","keyword":"Scenario Outline","steps":[{"result":{"duration":1951045739,"status":"passed"},"line":20,"name":"I am logged in the bb application as \"self-booker\"","match":{"arguments":[{"val":"self-booker","offset":38}],"location":"ApiStepDefs.java:31"},"keyword":"Given "},{"result":{"duration":797171851,"status":"passed"},"line":21,"name":"I request company details","match":{"location":"ApiStepDefs.java:63"},"keyword":"When "},{"result":{"duration":423386064,"status":"passed"},"line":22,"name":"the company details are returned","match":{"location":"ApiStepDefs.java:67"},"keyword":"Then "}],"tags":[{"name":"@api"},{"name":"@api-amend"}]},{"before":[{"result":{"duration":2737407,"status":"passed"},"match":{"location":"Hooks.startScenario(Scenario)"}}],"line":41,"name":"Business booker user is able to retrieve hotel information details","description":"","id":"as-a-business-booker-user-i-want-to-be-make-sure-that-the-apis-consumed-by-the-application-work-as-expected;business-booker-user-is-able-to-retrieve-hotel-information-details;;4","after":[{"result":{"duration":559221,"status":"passed"},"match":{"location":"Hooks.logResults(Scenario)"}}],"type":"scenario","keyword":"Scenario Outline","steps":[{"result":{"duration":1951457154,"status":"passed"},"line":33,"name":"I am logged in the bb application as \"booker\"","match":{"arguments":[{"val":"booker","offset":38}],"location":"ApiStepDefs.java:31"},"keyword":"Given "},{"result":{"duration":509574807,"status":"passed"},"line":34,"name":"I request hotel info details","match":{"location":"ApiStepDefs.java:72"},"keyword":"When "},{"result":{"duration":7503452,"status":"passed"},"line":35,"name":"the hotels details are returned","match":{"location":"ApiStepDefs.java:76"},"keyword":"Then "}],"tags":[{"name":"@api"},{"name":"@api-amend"}]}],"name":"As a Business Booker user I want to be make sure that the apis consumed by the application work as expected","description":"","id":"as-a-business-booker-user-i-want-to-be-make-sure-that-the-apis-consumed-by-the-application-work-as-expected","keyword":"Feature","uri":"/Users/Tester/Documents/KM/new-framework/src/test/resources/features/BB/amend-apis.feature","tags":[{"name":"@api","type":"Tag","location":{"line":1,"column":1}}]}],"project":"BB","environment":"ODE","runTime":"26-11-2018 16:48","errorsFound":false}

konstantinosmakris2 commented 5 years ago

above is a sample json. use the "apifeatures" to skip the web related information

Jonur commented 5 years ago

Hi @konstantinosmakris2 this should be fixed now. Please git pull.