testng.xml file not execute all the method - testng.xml

I am trying to run a testng.suite but it is not running all methods from each class. It just ran first few methods from each class.I broke my .xml file into two .xml files. In one file I added first four classes and ran it successfully, testng.xml file ran every method from each class and did not miss even one method. Then I created a second .xml and ran my last class,
""
it was also successful and ran every method from this class. But when I run all five test classes in one .xml file it only run few methods form each class. Is there any limit of class/methods that we can run in one .xml file. How many classes/method we can run in one .xml file?
I did not understand this, I will really appreciate if some one help me here.
Below is my testng.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="finalSuite">
<test name="final Test">
<classes>
<class name="com.qa.MurcryTour.Tests.HomePageTest"/>
<class name="com.qa.MurcryTour.Tests.LoginPageTest"/>
<class name="com.qa.MurcryTour.Tests.RegisterPageTest"/>
<class name="com.qa.MurcryTour.Tests.FlightsPageTest"/>
<class name="com.qa.MurcryTour.Tests.DataDriven_RegisterPageTest"/>
</classes>
</test> <!-- final Test -->
</suite> <!-- finalSuite -->

Related

Groovy Script to remove the xml declaration and parent nodes and display only childnodes

I am trying to transform xml using groovy script but failing, Any help will be highly appreciated
My input is xml is below
<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="ok" version="1.0">
<result>
<total_results>700</total_results>
<emailClick>
<id>993</id>
<created_at>2023-02-14 00:00:10</created_at>
</emailClick>
<emailClick>
<id>995</id>
<created_at>2023-02-14 00:00:10</created_at>
</emailClick>
</result>
</rsp>
My output will display only childnodes without xml declaration and parent xml tags
<emailClick>
<id>993</id>
<created_at>2023-02-14 00:00:10</created_at>
</emailClick>
<emailClick>
<id>995</id>
<created_at>2023-02-14 00:00:10</created_at>
</emailClick>
I tried getting the nodelist using xmlparser and then convert that into string but it is resulting in error

How to add xmi:version="2.0" attribute to an element

I am creating a xml file. i am done with the root element creation and i am able to define xml declaration. But i need to create anther tag, which looks like
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:TalendProperties="http://www.talend.org/properties">
# i am unable to replicate the above
### some subelements..
</xmi:XMI>
i am done with adding xmlns URIs, but unable to get the xmi:version="2.0".
I am not familiar with XML, so getting confused, read about namespace and all, not quite getting it. Can somebody show me how to do that or share a related weblink. That woul dbe great help. Because i found mostly the XML parsing stuff on internet but very few resource on XML generaton.
xmlns_uris_dict = {'xmi':'http://..', 'subprocess':'http://xyz...'}
root = ET.Element("talendfile:ProcessType")
ET.register_namespace('xmi', 'version="2.0"') # This part gives a wrong presentation.
# i am able to add URIs here
for prefix, uri in xmlns_uris_dict.items():
root.attrib['xmlns:' + prefix] = uri
A good way to create namespaced elements and attributes is to use QName.
import xml.etree.ElementTree as ET
NS = "http://www.omg.org/XMI"
ET.register_namespace("xmi", NS)
# Create xmi:XMI element
root = ET.Element(ET.QName(NS, "XMI"))
# Add xmi:version attribute
root.set(ET.QName(NS, "version"), "2.0")
print(ET.tostring(root).decode())
Result:
<xmi:XMI xmlns:xmi="http://www.omg.org/XMI" xmi:version="2.0" />
register_namespace() ensures that the xmi prefix (not the default ns0) is used when serializing the XML document.

DynamicFrame resolve choice between Array and Struct

I'm using AWS Glue to crawl XML files and add them to a Glue database table. The DynamicFrame I'm using identifies several choices in the XML schema. I can resolve most of them, but there's one case that I can't figure out.
The relevant part of the XML structure is:
<root>
<order>
<lineitems>
<lineitem>
...
</lineitem>
</lineitems>
</order>
</root>
The DynamicFrame shows lineitems as a struct and lineitems/lineitem as a choice between array or struct, I suspect because some orders have one lineitem, whereas other orders have multiple lineitems. I've tried calling resolveChoice with project:array, but that results in element:unknown so I can no longer see the structure of the lineitem. I'm not sure what else to try here, any ideas?

Loop and merge XML files in a folder to one HTML file using Groovy script?

I am using ReadyAPI and trying to fetch my reports generation, so I'm at the point where all the xml files for each test case are generated, and I need to merge them.
So basically I only have a path where the files are, let's say "C:\Path", where XML files lie.
I have found parsers for single files, and ways to append some information of one XML file into another XML file, but I have not found the way to loop through all XML files and dump their content into a new file...
Any help or indication could be much appreciated...
Jackson.
There is a working example of this answer here.
Let's assume that we have XML files of this form:
<composer>
<name>Wolfgang Mozart</name>
<born>1756</born>
</composer>
Then, we could build a list of parsed XML documents from each .xml file in the current directory (or whichever you need):
def composers = []
new File(".").eachFile { def file ->
if (file.name ==~ /.*\.xml/) {
composers << new XmlSlurper().parse(file)
}
}
Then, we could use a StreamingMarkupBuilder to create a unified XML document. Note this mixes markup with the composers list built above:
def xml = new StreamingMarkupBuilder().bind {
root {
composers.each { c ->
mkp.yield c
}
}
}.toString()
That is, the document looks like:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<composer>
<name>Wolfgang Mozart</name>
<born>1756</born>
</composer>
<composer>
<name>JS Bach</name>
<born>1685</born>
</composer>
...
</root>
Altering the solution for your local goals should be straight-forward.

How to avoid duplicating column headers in nlog CSVLayout?

I'm using a nlog's CSV layout file for data logging.
<target xsi:type="File" [...]>
<layout xsi:type="CSVLayout">
<column name="Value1" layout="${event-context:item=Value1}"/>
[...]
I'm getting column headers appended to the file every time I run the logging application. Is there a way to only get the column headers created when a new log file is created?
Thanks

Resources