Hi everyone,
I started experimenting with YAML as an addition to TestNG's XML format. The initial results are pretty promising and they result in files that are much smaller and more readable than testng.xml.
For example:
<!DOCTYPE suite SYSTEM "
http://beust.com/testng/testng-1.0.dtd" >
<suite name="SingleSuite" verbose="2" parallel="false" thread-count="4"
data-provider-thread-count="3">
<parameter name="n" value="42" />
<test name="Regression2">
<groups>
<run>
<exclude name="broken" />
</run>
</groups>
<parameter name="count" value="10"/>
<classes>
<class name="test.listeners.ResultEndMillisTest" />
</classes>
</test>
</suite>
becomes:
name: SingleSuite
verbose: 2
threadCount: 4
parameters: { n: 42 }
tests:
- name: Regression2
verbose: 2
parameters: { count: 10 }
excludedGroups: [ broken ]
classes:
- test.listeners.ResultEndMillisTest
The result is even more telling on bigger files:
-rw-r--r-- 1 cbeust 502 17638 Aug 6 11:07 src/test/resources/testng.xml
-rw-r--r-- 1 cbeust 502 10732 Aug 12 16:03 src/test/resources/testng.yaml
And if you want to see what this means for bigger files, here is
testng.xml and
testng.yaml.
If you want to try this on your own XML file, I wrote a converter. Start by downloading:
and then:
java -classpath testng-5.13.2beta.jar org.testng.internal.Yaml a.xml
This will output the .yaml file on the console.
You should be able to feed this yaml file directly back into TestNG (using the same jar file) and see the same test results (it's working with TestNG's 456 tests). The only missing feature that I know of right now is suite-files.
This is still experimental: I am working on a separate branch and I haven't decided whether I was going to make this a part of the distribution or not, but the idea of being able to use such a simple format to maintain suite files is very appealing. Oh and of course, the XML format is not going away, this would be purely an alternate way of specifying suite files.
Please let me know what you think.
--
Cédric