With Python (3.6) Behave, using JUnit reports, how can one stop the step definitions from appearing in the...












0















I'm working with Behave in Python 3.6 - it's great, totally, love it, however, I have to use junit reports. The --junit switch works fine, but the output is really heavy because it includes all the feature gherkin definitions. I'd rather just eliminate the whole CDATA field, or at least stop behave from including the feature definitions.



Basically - how do you stop Behave from copying the feature file into the junit reports?:



   <system-out>
<![ CDATA[
@scenario.begin

Scenario: User fills zipcode on form
Given user is on a visitor site page ... passed in 0.749s
"""
/urlpath/
"""
When a user enters a zip code in a form ... passed in 0.193s
| action_method | action_params |
| move_to_element | #lead-zip |
| send_keys | 27610 |
| move_to_element | #lead-submit |
| click | |
Then a call is sent for a unique field value pair ... passed in 4.027s
| unique_field | unique_value |
| description | Service Request Flow entry button |
And the segment call contains parameters ... failed in 0.000s
| prop_key | prop_value |
| activityLocation | Visitor : Piffle |
| categoryId | 1002 |
| description | Service Request Flow entry button |
| marketId | 100001 |
| userId | |
| userSelectedZipCode | 27610 |
| visitorPageCategory | Rofing |
| visitorPageGeo | RALEIGH/DURHAM |
| visitorPageGeoCategory | RALEIGH/DURHAM - ROOFING |

@scenario.end
--------------------------------------------------------------------------------
]]>









share|improve this question





























    0















    I'm working with Behave in Python 3.6 - it's great, totally, love it, however, I have to use junit reports. The --junit switch works fine, but the output is really heavy because it includes all the feature gherkin definitions. I'd rather just eliminate the whole CDATA field, or at least stop behave from including the feature definitions.



    Basically - how do you stop Behave from copying the feature file into the junit reports?:



       <system-out>
    <![ CDATA[
    @scenario.begin

    Scenario: User fills zipcode on form
    Given user is on a visitor site page ... passed in 0.749s
    """
    /urlpath/
    """
    When a user enters a zip code in a form ... passed in 0.193s
    | action_method | action_params |
    | move_to_element | #lead-zip |
    | send_keys | 27610 |
    | move_to_element | #lead-submit |
    | click | |
    Then a call is sent for a unique field value pair ... passed in 4.027s
    | unique_field | unique_value |
    | description | Service Request Flow entry button |
    And the segment call contains parameters ... failed in 0.000s
    | prop_key | prop_value |
    | activityLocation | Visitor : Piffle |
    | categoryId | 1002 |
    | description | Service Request Flow entry button |
    | marketId | 100001 |
    | userId | |
    | userSelectedZipCode | 27610 |
    | visitorPageCategory | Rofing |
    | visitorPageGeo | RALEIGH/DURHAM |
    | visitorPageGeoCategory | RALEIGH/DURHAM - ROOFING |

    @scenario.end
    --------------------------------------------------------------------------------
    ]]>









    share|improve this question



























      0












      0








      0








      I'm working with Behave in Python 3.6 - it's great, totally, love it, however, I have to use junit reports. The --junit switch works fine, but the output is really heavy because it includes all the feature gherkin definitions. I'd rather just eliminate the whole CDATA field, or at least stop behave from including the feature definitions.



      Basically - how do you stop Behave from copying the feature file into the junit reports?:



         <system-out>
      <![ CDATA[
      @scenario.begin

      Scenario: User fills zipcode on form
      Given user is on a visitor site page ... passed in 0.749s
      """
      /urlpath/
      """
      When a user enters a zip code in a form ... passed in 0.193s
      | action_method | action_params |
      | move_to_element | #lead-zip |
      | send_keys | 27610 |
      | move_to_element | #lead-submit |
      | click | |
      Then a call is sent for a unique field value pair ... passed in 4.027s
      | unique_field | unique_value |
      | description | Service Request Flow entry button |
      And the segment call contains parameters ... failed in 0.000s
      | prop_key | prop_value |
      | activityLocation | Visitor : Piffle |
      | categoryId | 1002 |
      | description | Service Request Flow entry button |
      | marketId | 100001 |
      | userId | |
      | userSelectedZipCode | 27610 |
      | visitorPageCategory | Rofing |
      | visitorPageGeo | RALEIGH/DURHAM |
      | visitorPageGeoCategory | RALEIGH/DURHAM - ROOFING |

      @scenario.end
      --------------------------------------------------------------------------------
      ]]>









      share|improve this question
















      I'm working with Behave in Python 3.6 - it's great, totally, love it, however, I have to use junit reports. The --junit switch works fine, but the output is really heavy because it includes all the feature gherkin definitions. I'd rather just eliminate the whole CDATA field, or at least stop behave from including the feature definitions.



      Basically - how do you stop Behave from copying the feature file into the junit reports?:



         <system-out>
      <![ CDATA[
      @scenario.begin

      Scenario: User fills zipcode on form
      Given user is on a visitor site page ... passed in 0.749s
      """
      /urlpath/
      """
      When a user enters a zip code in a form ... passed in 0.193s
      | action_method | action_params |
      | move_to_element | #lead-zip |
      | send_keys | 27610 |
      | move_to_element | #lead-submit |
      | click | |
      Then a call is sent for a unique field value pair ... passed in 4.027s
      | unique_field | unique_value |
      | description | Service Request Flow entry button |
      And the segment call contains parameters ... failed in 0.000s
      | prop_key | prop_value |
      | activityLocation | Visitor : Piffle |
      | categoryId | 1002 |
      | description | Service Request Flow entry button |
      | marketId | 100001 |
      | userId | |
      | userSelectedZipCode | 27610 |
      | visitorPageCategory | Rofing |
      | visitorPageGeo | RALEIGH/DURHAM |
      | visitorPageGeoCategory | RALEIGH/DURHAM - ROOFING |

      @scenario.end
      --------------------------------------------------------------------------------
      ]]>






      python junit python-behave






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 29 '18 at 17:39









      natn2323

      633217




      633217










      asked Nov 27 '18 at 20:57









      AnachronousAnachronous

      412




      412
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I found a solution that works for me, though it seems like you should still be able to squelch the default output (which basically copies the feature file into the CDATA -- kind of useless)



          If you want more control over what goes into the CDATA section, here is a solution:
          Copy junit.py from env/lib/python3.6/site-packages/behave/reporter/junit.py to a directory you will maintain as a custom reporter. I put mine in a folder called reporters



          (the above path assumes you have a virtualenv called 'env' and you are using python3.6 -- adjust based on your environment)



          In that file, find the method, def CDATA(text=None):
          modify the text variable as you wish - apply filters or just set text = '' if you don't need it.



          Then in your environments.py, add this to the imports area:
          from reporters.junit import JUnitReporter



          Finally, in the before_all(context) method, add this:



          junit_reporter = JUnitReporter(context.config)
          context.config.reporters.append(junit_reporter)


          Now you have your very own custom JUnit xml report generator!






          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53508036%2fwith-python-3-6-behave-using-junit-reports-how-can-one-stop-the-step-definit%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I found a solution that works for me, though it seems like you should still be able to squelch the default output (which basically copies the feature file into the CDATA -- kind of useless)



            If you want more control over what goes into the CDATA section, here is a solution:
            Copy junit.py from env/lib/python3.6/site-packages/behave/reporter/junit.py to a directory you will maintain as a custom reporter. I put mine in a folder called reporters



            (the above path assumes you have a virtualenv called 'env' and you are using python3.6 -- adjust based on your environment)



            In that file, find the method, def CDATA(text=None):
            modify the text variable as you wish - apply filters or just set text = '' if you don't need it.



            Then in your environments.py, add this to the imports area:
            from reporters.junit import JUnitReporter



            Finally, in the before_all(context) method, add this:



            junit_reporter = JUnitReporter(context.config)
            context.config.reporters.append(junit_reporter)


            Now you have your very own custom JUnit xml report generator!






            share|improve this answer






























              0














              I found a solution that works for me, though it seems like you should still be able to squelch the default output (which basically copies the feature file into the CDATA -- kind of useless)



              If you want more control over what goes into the CDATA section, here is a solution:
              Copy junit.py from env/lib/python3.6/site-packages/behave/reporter/junit.py to a directory you will maintain as a custom reporter. I put mine in a folder called reporters



              (the above path assumes you have a virtualenv called 'env' and you are using python3.6 -- adjust based on your environment)



              In that file, find the method, def CDATA(text=None):
              modify the text variable as you wish - apply filters or just set text = '' if you don't need it.



              Then in your environments.py, add this to the imports area:
              from reporters.junit import JUnitReporter



              Finally, in the before_all(context) method, add this:



              junit_reporter = JUnitReporter(context.config)
              context.config.reporters.append(junit_reporter)


              Now you have your very own custom JUnit xml report generator!






              share|improve this answer




























                0












                0








                0







                I found a solution that works for me, though it seems like you should still be able to squelch the default output (which basically copies the feature file into the CDATA -- kind of useless)



                If you want more control over what goes into the CDATA section, here is a solution:
                Copy junit.py from env/lib/python3.6/site-packages/behave/reporter/junit.py to a directory you will maintain as a custom reporter. I put mine in a folder called reporters



                (the above path assumes you have a virtualenv called 'env' and you are using python3.6 -- adjust based on your environment)



                In that file, find the method, def CDATA(text=None):
                modify the text variable as you wish - apply filters or just set text = '' if you don't need it.



                Then in your environments.py, add this to the imports area:
                from reporters.junit import JUnitReporter



                Finally, in the before_all(context) method, add this:



                junit_reporter = JUnitReporter(context.config)
                context.config.reporters.append(junit_reporter)


                Now you have your very own custom JUnit xml report generator!






                share|improve this answer















                I found a solution that works for me, though it seems like you should still be able to squelch the default output (which basically copies the feature file into the CDATA -- kind of useless)



                If you want more control over what goes into the CDATA section, here is a solution:
                Copy junit.py from env/lib/python3.6/site-packages/behave/reporter/junit.py to a directory you will maintain as a custom reporter. I put mine in a folder called reporters



                (the above path assumes you have a virtualenv called 'env' and you are using python3.6 -- adjust based on your environment)



                In that file, find the method, def CDATA(text=None):
                modify the text variable as you wish - apply filters or just set text = '' if you don't need it.



                Then in your environments.py, add this to the imports area:
                from reporters.junit import JUnitReporter



                Finally, in the before_all(context) method, add this:



                junit_reporter = JUnitReporter(context.config)
                context.config.reporters.append(junit_reporter)


                Now you have your very own custom JUnit xml report generator!







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 29 '18 at 19:34









                natn2323

                633217




                633217










                answered Nov 28 '18 at 4:12









                AnachronousAnachronous

                412




                412
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53508036%2fwith-python-3-6-behave-using-junit-reports-how-can-one-stop-the-step-definit%23new-answer', 'question_page');
                    }
                    );

                    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







                    Popular posts from this blog

                    Contact image not getting when fetch all contact list from iPhone by CNContact

                    count number of partitions of a set with n elements into k subsets

                    A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks