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

27 views
Skip to first unread message

Ashok Kumar

unread,
May 15, 2018, 3:55:50 AM5/15/18
to testng-users
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

⇜Krishnan Mahadevan⇝

unread,
May 15, 2018, 4:03:18 AM5/15/18
to testng...@googlegroups.com
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. 

--
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 testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
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/

Ashok Kumar

unread,
May 15, 2018, 6:19:29 AM5/15/18
to testng-users
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. 

Krishnan Mahadevan

unread,
May 16, 2018, 12:14:58 AM5/16/18
to testng...@googlegroups.com

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/

--

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


To post to this group, send email to

Ashok Kumar

unread,
May 17, 2018, 2:04:47 AM5/17/18
to testng-users
Thanks Krishnan. Will track the link for its fix. Appreciate if any tentative date provided. :) 
Reply all
Reply to author
Forward
0 new messages