YAML - Provide inputs at method level (using includedMethods:)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

YAML - Provide inputs at method level (using includedMethods:)

Ashok Kumar-2
Hi, 
The below is my YAML structure. 

name: Teq Test
tests:
  - name: ConfigureAllTeq
    parameters: { teqUid: Teq1 }
    classes:
      - name: com.teq.InitializeTeq
        includedMethods:
          - configureTeq
          - initTraffic
          - setProtSwitchCriteria

I see the support of parameters is available only at the test level. (highlighted above)

May i know whether the parameter support is available at method level. (as available in XML)

<class name="com.teq.InitializeTeq">
<methods>
<include name="configureTeq">
<parameter name="teqUid" value="Teq1" />
</include>
</methods>
</class>

Example: 
name: Sncp Alarms Test
tests:
  - name: ConfigureAllTeq
    parameters: { teqUid: Teq1 }

    classes:
      - name: com.teq.InitializeTeq
        includedMethods:
          - configureTeq
            parameters: { teqUid: Teq1 }
          - initTraffic
            parameters: { teqUid: Teq2 }
          - setProtSwitchCriteria
            parameters: { teqUid: Teq3 }

Regards,
Ashok

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: YAML - Provide inputs at method level (using includedMethods:)

Krishnan Mahadevan
Can you please try using TestNG V6.14.3 (latest released version as of today) and let us know ?

If the problem continues to exist please also share a sample that can be used to reproduce the problem. 

On Tue 15 May, 2018, 13:25 Ashok Kumar, <[hidden email]> wrote:
Hi, 
The below is my YAML structure. 

name: Teq Test
tests:
  - name: ConfigureAllTeq
    parameters: { teqUid: Teq1 }
    classes:
      - name: com.teq.InitializeTeq
        includedMethods:
          - configureTeq
          - initTraffic
          - setProtSwitchCriteria

I see the support of parameters is available only at the test level. (highlighted above)

May i know whether the parameter support is available at method level. (as available in XML)

<class name="com.teq.InitializeTeq">
<methods>
<include name="configureTeq">
<parameter name="teqUid" value="Teq1" />
</include>
</methods>
</class>

Example: 
name: Sncp Alarms Test
tests:
  - name: ConfigureAllTeq
    parameters: { teqUid: Teq1 }

    classes:
      - name: com.teq.InitializeTeq
        includedMethods:
          - configureTeq
            parameters: { teqUid: Teq1 }
          - initTraffic
            parameters: { teqUid: Teq2 }
          - setProtSwitchCriteria
            parameters: { teqUid: Teq3 }

Regards,
Ashok

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: YAML - Provide inputs at method level (using includedMethods:)

Ashok Kumar-2
Hi Krishnan,

Version details:
Test NG: 6.14.3
Snake YAML: 1.21

Below is my Test NG XML.

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="TEQ Test">
<test name="TeqInit Test">
<classes>
<class
name="com.teq.InitializeTeq">
<methods>
<include name="configureTeq">
<parameter name="teqUid" value="Teq1" />
</include>
<include name="initTraffic">
<parameter name="teqUid" value="Teq2" />
</include>
<include name="setProtSwitchCriteria">
<parameter name="teqUid" value="Teq3" />
</include>
</methods>
</class>
</classes>
</test>
</suite>

I tried creating YAML file using the below code snippet. 
StringBuilder yaml = org.testng.internal.Yaml.toYaml(suite.getXmlSuite());
System.out.println(yaml);

Output generated: [YAML]
name: TEQ Test
configFailurePolicy: skip
parameters: { junit: false, configfailurepolicy: skip, thread-count: 5, data-provider-thread-count: 10, guice-stage: DEVELOPMENT, skipfailedinvocationcounts: false, allow-return-values: false, preserve-order: true, parallel: none, dataProviderSequence: sequential, name: TEQ Test, group-by-instances: false, dataProvider: false }
listeners:
  - com.eci.raft.tests.shadetree.listeners.BaseNodeListener
tests:
  - name: TeqInit Test
    parameters: { junit: false, dataProviderSequence: sequential, name: TeqInit Test, group-by-instances: false, dataProvider: false, skipfailedinvocationcounts: false, allow-return-values: false, preserve-order: true }
    classes:
      - name: com.eci.raft.tests.shadetree.steps.teq.InitializeTeq
        includedMethods:
          - configureTeq
          - initTraffic
          - setProtSwitchCriteria

We can see here the parameter "teqUid" is not available as part of the generated output. 

Please let me know if more information is needed in this context.

Regards,
Ashok 

P.S: I am aware that i can work around the problem by creating 3 tests with same parameter (different values) and get it done with relevant method in each test. But this is not what i am looking for. 

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: YAML - Provide inputs at method level (using includedMethods:)

Krishnan Mahadevan

Ashok,

It looks like it’s a problem in TestNG. I have filed a bug on your behalf: https://github.com/cbeust/testng/issues/1787

 

Please watch the above bug for a fix. I have a fix for this. I will be raising a PR for this shortly.

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

From: <[hidden email]> on behalf of Ashok Kumar <[hidden email]>
Reply-To: <[hidden email]>
Date: Tuesday, May 15, 2018 at 3:49 PM
To: testng-users <[hidden email]>
Subject: Re: [testng-users] YAML - Provide inputs at method level (using includedMethods:)

 

Hi Krishnan,

 

Version details:

Test NG: 6.14.3

Snake YAML: 1.21

 

Below is my Test NG XML.

 

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="TEQ Test">

                <test name="TeqInit Test">

                                <classes>

                                                <class

                                                                name="com.teq.InitializeTeq">

                                                                <methods>

                                                                                <include name="configureTeq">

                                                                                                <parameter name="teqUid" value="Teq1" />

                                                                                </include>

                                                                                <include name="initTraffic">

                                                                                                <parameter name="teqUid" value="Teq2" />

                                                                                </include>

                                                                                <include name="setProtSwitchCriteria">

                                                                                                <parameter name="teqUid" value="Teq3" />

                                                                                </include>

                                                                </methods>

                                                </class>

                                </classes>

                </test>

</suite>

 

I tried creating YAML file using the below code snippet. 

StringBuilder yaml = org.testng.internal.Yaml.toYaml(suite.getXmlSuite());

System.out.println(yaml);

 

Output generated: [YAML]

name: TEQ Test

configFailurePolicy: skip

parameters: { junit: false, configfailurepolicy: skip, thread-count: 5, data-provider-thread-count: 10, guice-stage: DEVELOPMENT, skipfailedinvocationcounts: false, allow-return-values: false, preserve-order: true, parallel: none, dataProviderSequence: sequential, name: TEQ Test, group-by-instances: false, dataProvider: false }

listeners:

  - com.eci.raft.tests.shadetree.listeners.BaseNodeListener

tests:

  - name: TeqInit Test

    parameters: { junit: false, dataProviderSequence: sequential, name: TeqInit Test, group-by-instances: false, dataProvider: false, skipfailedinvocationcounts: false, allow-return-values: false, preserve-order: true }

    classes:

      - name: com.eci.raft.tests.shadetree.steps.teq.InitializeTeq

        includedMethods:

          - configureTeq

          - initTraffic

          - setProtSwitchCriteria

 

We can see here the parameter "teqUid" is not available as part of the generated output. 

 

Please let me know if more information is needed in this context.

 

Regards,

Ashok 

 

P.S: I am aware that i can work around the problem by creating 3 tests with same parameter (different values) and get it done with relevant method in each test. But this is not what i am looking for. 

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
[hidden email].
To post to this group, send email to
[hidden email].
Visit this group at
https://groups.google.com/group/testng-users.
For more options, visit
https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: YAML - Provide inputs at method level (using includedMethods:)

Ashok Kumar-2
Thanks Krishnan. Will track the link for its fix. Appreciate if any tentative date provided. :) 

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.