<!-- 
RSS generated by JIRA (9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b) at Mon Feb 12 07:44:48 CET 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Magnolia - Issue tracker</title>
    <link>https://jira.magnolia-cms.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-uk</language>    <build-info>
        <version>9.4.2</version>
        <build-number>940002</build-number>
        <build-date>19-01-2023</build-date>
    </build-info>


<item>
            <title>[MGNLTEST-23] Cucumber using pageObjects requires dependency injection</title>
                <link>https://jira.magnolia-cms.com/browse/MGNLTEST-23</link>
                <project id="17084" key="MGNLTEST">Magnolia Test Framework</project>
                    <description>&lt;h3&gt;&lt;a name=&quot;TLDR&quot;&gt;&lt;/a&gt;TLDR&lt;/h3&gt;

&lt;p&gt;In Cucumber step-definition classes, we need the possibility to share the root pageObject among several methods. This requires&#160;&lt;em&gt;dependency injection&lt;/em&gt;.&lt;/p&gt;
&lt;hr /&gt;
&lt;h3&gt;&lt;a name=&quot;Cucumbercontext&quot;&gt;&lt;/a&gt;Cucumber context&lt;/h3&gt;

&lt;p&gt;In &lt;em&gt;cucumber&lt;/em&gt; within one &lt;a href=&quot;https://cucumber.io/docs/cucumber/step-definitions/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;step definition class&lt;/a&gt;,&#160;there are typically a bunch of step definition methods for multiple scenarios of the same feature or even for several features of the same domain.&lt;/p&gt;

&lt;p&gt;Each scenario consists of a set of methods. Sometimes one method can even be reused for more than one of the scenarios.&#160;The step def methods are executed in the order of how the scenario is defined in the feature file.&lt;/p&gt;

&lt;p&gt;step def methods can not have parameters to share objects between methods (with the exception of&#160;&lt;tt&gt;cucumber.api.Scenario&lt;/tt&gt;). Cucumber recommends &lt;em&gt;using dependency&lt;/em&gt; injection (DI) to share objects among different methods.&lt;/p&gt;

&lt;p&gt;Luckily, if a feature has multiple &lt;em&gt;scenarios&lt;/em&gt; , the cucumber test runner creates a new instance of the step definition class for each scenario;&#160;and for each row of a &lt;em&gt;scenario outline&lt;/em&gt;&#160; the cucumber test runner creates a new instance of the step definition class.&lt;br/&gt;
 (See&#160;&lt;a href=&quot;https://cucumber.io/blog/polymorphic-step-definitions/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://cucumber.io/blog/polymorphic-step-definitions/&lt;/a&gt;&#160;,&#160;&lt;a href=&quot;https://stackoverflow.com/questions/48726448/cucumber-step-definition-class-initialization&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://stackoverflow.com/questions/48726448/cucumber-step-definition-class-initialization&lt;/a&gt;)&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;SharingtherootpageObject%22ui%22amongthemethodsofthesamescenario...&quot;&gt;&lt;/a&gt;Sharing the root pageObject &quot;ui&quot; among the methods of the same scenario ...&lt;/h4&gt;

&lt;p&gt;Within one scenario the class must share the same instance of&#160;the root page object&#160;&lt;tt&gt;info.magnolia.testframework.PageObjects&lt;/tt&gt; (=&quot;ui&quot;) among the methods of this same scenario.&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;...but%C2%A0resettingtheuiwhenstartinganewscenario&quot;&gt;&lt;/a&gt;... but&#160; resetting the ui when starting a new scenario&lt;/h4&gt;

&lt;p&gt;When executing the 1st method of a scenario, the class must get a new, &quot;fresh&quot; instance of the ui.&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;Hooks%C2%A0&quot;&gt;&lt;/a&gt;Hooks&#160;&lt;/h4&gt;

&lt;p&gt;The cucumber API provide &quot;hooks&quot; which are executed before the 1st step and after the last step.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;tt&gt;cucumber.api.java.Before&lt;/tt&gt; hooks run before the first step of each scenario.&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;cucumber.api.java.After&lt;/tt&gt; hooks&#160;run after the last step of each scenario, even when steps are failed, undefined, pending, or skipped.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;See&#160;&lt;a href=&quot;https://cucumber.io/docs/cucumber/api/#hooks&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://cucumber.io/docs/cucumber/api/#hooks&lt;/a&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;h3&gt;&lt;a name=&quot;Acceptancecriteria&quot;&gt;&lt;/a&gt;Acceptance criteria&lt;/h3&gt;
&lt;ul&gt;
	&lt;li&gt;Provide a DI system to inject the root pageObjects, e.g. by injecting it into the constructor of the step def. class.&lt;/li&gt;
	&lt;li&gt;Provide method(s) which allow to &quot;destroy&quot; the shared root pageObject by using the &lt;tt&gt;After&lt;/tt&gt; hook and to get a new one by using the &lt;tt&gt;Before&lt;/tt&gt; hook, &lt;em&gt;if&lt;/em&gt; required.&lt;/li&gt;
&lt;/ul&gt;


&lt;hr /&gt;
&lt;h3&gt;&lt;a name=&quot;Moreresources&quot;&gt;&lt;/a&gt;More resources&lt;/h3&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;https://cucumber.io/docs/cucumber/state/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://cucumber.io/docs/cucumber/state/&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://picocontainer.com/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://picocontainer.com/&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://softwareengineering.stackexchange.com/questions/287823/how-to-pass-object-generated-by-certain-test-class-to-another-test-class-using-w&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://softwareengineering.stackexchange.com/questions/287823/how-to-pass-object-generated-by-certain-test-class-to-another-test-class-using-w&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.thinkcode.se/blog/2017/04/01/sharing-state-between-steps-in-cucumberjvm-using-picocontainer&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.thinkcode.se/blog/2017/04/01/sharing-state-between-steps-in-cucumberjvm-using-picocontainer&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/questions/51125346/dependency-injection-cucumber-pico-container&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://stackoverflow.com/questions/51125346/dependency-injection-cucumber-pico-container&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;hr /&gt;
&lt;h3&gt;&lt;a name=&quot;Mockedexample&quot;&gt;&lt;/a&gt;Mocked example&lt;/h3&gt;

&lt;p&gt;I have added another example covering all my &quot;cases&quot; (having multiple scenarios plus a &lt;em&gt;scenario outline&lt;/em&gt;).&lt;br/&gt;
 For the new example-test I have created the class &lt;tt&gt;info.magnolia.functionaltests.cucumberbasictests.DummyUI&lt;/tt&gt; to mock &lt;tt&gt;PageObjects&lt;/tt&gt;, to make sure I can run the test. &lt;tt&gt;DummyUI&lt;/tt&gt; gets injected by picocontainer.&lt;br/&gt;
 The examples are on my (latest) branch (currently named &lt;a href=&quot;https://git.magnolia-cms.com/projects/PLATFORM/repos/ce/browse?at=refs%2Fheads%2Ffeature%2FMGNLCE_164-page-objects-api_chm-version_vi&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;feature/MGNLCE_164-page-objects-api_chm-version_vi&lt;/a&gt;).&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;src/test/resources/info/magnolia/functionaltests/cucumberbasictests/configuration_app_availability_for_different_users.feature&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;info.magnolia.functionaltests.cucumberbasictests.ConfigAppAvailabilityTest_stepDef&lt;/tt&gt;&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;info.magnolia.functionaltests.cucumberbasictests.ConfigAppAvailabilityTest&lt;/tt&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;To trigger the test, run &lt;tt&gt;ConfigAppAvailabilityTest&lt;/tt&gt; via Maven&lt;/p&gt;</description>
                <environment></environment>
        <key id="78974">MGNLTEST-23</key>
            <summary>Cucumber using pageObjects requires dependency injection</summary>
                <type id="3" iconUrl="https://jira.magnolia-cms.com/secure/viewavatar?size=xsmall&amp;avatarId=10898&amp;avatarType=issuetype">Task</type>
                                            <priority id="6" iconUrl="https://jira.magnolia-cms.com/images/icons/priorities/neutral.gif">Neutral</priority>
                        <status id="6" iconUrl="https://jira.magnolia-cms.com/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Obsolete</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="cmeier">Christoph Meier</reporter>
                        <labels>
                            <label>QA&amp;amp;Testing</label>
                            <label>ui-test-fwk</label>
                    </labels>
                <created>Wed, 28 Aug 2019 05:38:58 +0200</created>
                <updated>Mon, 29 Nov 2021 11:09:46 +0100</updated>
                            <resolved>Mon, 29 Nov 2021 11:09:45 +0100</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                        <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                            <customfield id="customfield_14166" key="com.okapya.jira.checklist:checklist">
                        <customfieldname>Acceptance criteria</customfieldname>
                        <customfieldvalues>
                            
        <checklist>
        <![CDATA[
                            




                
                                    <div class="o-completion" style="display: flex; flex-shrink: 0;"><span  class="aui-lozenge aui-lozenge-complete" style="font-size: 12px; font-weight: normal; display: flex; flex-direction: row; align-items: center;" ><span style="padding-right: 4px; vertical-align: middle;"><svg width="15" height="15" viewBox="0 0 15 15" xmlns="http://www.w3.org/2000/svg" fill="white"><path clip-rule="evenodd" d="m10.41037,3.42544l-7.86501,0c-0.72395,0 -1.31084,0.58688 -1.31084,1.31084l0,7.86508c0,0.7239 0.58689,1.3108 1.31084,1.3108l7.86501,0c0.724,0 1.3109,-0.5869 1.3109,-1.3108l0,-7.86508c0,-0.72396 -0.5869,-1.31084 -1.3109,-1.31084zm-7.86501,-0.65542c-1.08593,0 -1.96626,0.88032 -1.96626,1.96626l0,7.86508c0,1.0859 0.88033,1.9662 1.96626,1.9662l7.86501,0c1.086,0 1.9663,-0.8803 1.9663,-1.9662l0,-7.86508c0,-1.08594 -0.8803,-1.96626 -1.9663,-1.96626l-7.86501,0z" fill-rule="evenodd"/><path d="m5.09049,10.18526l-1.82767,-1.82766l-0.78479,0.78479l2.61246,2.61246l5.38758,-5.38754l-0.78483,-0.78479l-4.60275,4.60274z"/></svg></span><span>Empty</span></span></div>
                        ]]>
    </checklist>


                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10111" key="com.atlassian.jira.toolkit:reporterdomain">
                        <customfieldname>Company</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>magnolia-cms.com</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_12730" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_14151" key="com.atlassian.jira.toolkit:message">
                        <customfieldname>Docu info</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10246" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>MGNLTEST-2</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10061" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comm is not jira-dev</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10071" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last participant</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>mmichel</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_13136" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            4 years, 24 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10020" key="com.atlassian.jira.toolkit:attachments">
                        <customfieldname>Number of attachments</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10150" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname>Number of comments</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>cmeier</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_10833" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|y054t8:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10244" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_14167" key="com.okapya.jira.checklist:checklist">
                        <customfieldname>Task DoR</customfieldname>
                        <customfieldvalues>
                            
        <checklist>
        <![CDATA[
                            




                
                                    <div class="o-completion" style="display: flex; flex-shrink: 0;"><span  class="aui-lozenge aui-lozenge-complete" style="font-size: 12px; font-weight: normal; display: flex; flex-direction: row; align-items: center;" ><span style="padding-right: 4px; vertical-align: middle;"><svg width="15" height="15" viewBox="0 0 15 15" xmlns="http://www.w3.org/2000/svg" fill="white"><path clip-rule="evenodd" d="m10.41037,3.42544l-7.86501,0c-0.72395,0 -1.31084,0.58688 -1.31084,1.31084l0,7.86508c0,0.7239 0.58689,1.3108 1.31084,1.3108l7.86501,0c0.724,0 1.3109,-0.5869 1.3109,-1.3108l0,-7.86508c0,-0.72396 -0.5869,-1.31084 -1.3109,-1.31084zm-7.86501,-0.65542c-1.08593,0 -1.96626,0.88032 -1.96626,1.96626l0,7.86508c0,1.0859 0.88033,1.9662 1.96626,1.9662l7.86501,0c1.086,0 1.9663,-0.8803 1.9663,-1.9662l0,-7.86508c0,-1.08594 -0.8803,-1.96626 -1.9663,-1.96626l-7.86501,0z" fill-rule="evenodd"/><path d="m5.09049,10.18526l-1.82767,-1.82766l-0.78479,0.78479l2.61246,2.61246l5.38758,-5.38754l-0.78483,-0.78479l-4.60275,4.60274z"/></svg></span><span>Empty</span></span></div>
                        ]]>
    </checklist>


                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_14145" key="com.intenso.jira.issue-templates:issue-templates-customfield">
                        <customfieldname>Template</customfieldname>
                        <customfieldvalues>
                            


                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_15131" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Time in Discovery</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10032" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time in Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>