Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

13.4.17

Evaluation of Automation Tools

Sometimes it feels so good to just past judgments! In fact I wanted to title the post judgement on tools, but people get real sentimental these days.

So, with all due respect to whomsoever it may concern....lets see what some of the OS tools prevalent in the market are good at, or mostly, lack.

  1. External Libraries
    1. Web Scrappers - Can these help read the html page, and give the data you want, in key:value pair?
      1. JSoup
        1. This is the only good option for Java, which is just a jar
      2. BeautifulSoup
        1. This is only for Python, but very capable
    2. XML Parsers
      1. Can these help read the XML, and give the tag:data you want, in key:value pair?
  2. White Framework
    1. supposedly to automate desktop apps, written in Java
    2. http://codoid.com/white-framework-cheat-sheet/
  3. YML Files for Test Data
  4. Protractor for AngularJS 
    1. Works with Se as well, and may have better Sync options. 
    2. Also, it is useful in building object locators for those custom tags in AngularJS
  5. Capybara 
    1. this works only with ruby
  6. Zeus
  7. Liverload
  8. Zephyr 
    1. Looks like this only provides flashy QA metrics, no other real use
  9. TestingWhiz Community edition
  10. Guice with Se
  11. VelocityDep
  12. CodedUI
    1. Comes bunndled with VS from MS, needs C# and OOOPs, can work on Web and Windows forms
    2. May have better Obj ID process, but Obj Management is difficult as no OR
  13. Freemarker library
  14. Wrappers - Discarded [DO NOT WASTE TIME ON WRAPPERS. They do not add anything new to the core Se code base, just propose to make it easier. If the wrapper goes out of business, so do you. Instead, focus on learning new generic and widely used Libraries [jars] that can add more features and make your life easier.]
    1. Robot framework
      1. This is making a lot of noise these days, may be some good, but not keen on using this
    2. SeLion - 
      1. Enabling Test Automation in Java. 
      2. SeLion builds on top of TestNG and Selenium to provide a set of capabilities that get you up and running with WebDriver in a short time. 
      3. It can be used for testing web and mobile applications. 
      4. Seems to be Free, not sure
      5. http://paypal.github.io/SeLion/html/documentation.html#getting-started
    3. Tellurium - Discarded
      1. Its NOT Free!
    4. Fluentlenium - Discarded
      1. A wrapper framework for Se
      2. Looks like it supports only CSS not XPath
      3. http://awesome-testing.blogspot.in/2016/01/introducing-fluentlenium-1.html
    5. Selenide - Discarded
      1. This is one more wrapper, and not widely used, has very different commands from my current PO framework
    6. Bromine - Discarded
      1. Bromine is an open source QA tool that uses selenium RC as its testing engine. It is a test management tool for Se, and more so only for SeRC Tests, and aims to replace HPQC!
      2. Tests have to be written in java, and then uploaded to Bromine, which provides just the execution env for all the uploaded tests
      3. Bromine is a web application, and needs to be hosted on a separate server - yeah, good luck getting a new server just for this!
      4. http://www.methodsandtools.com/tools/tools.php?bromine

19.5.14

Convert QTP Results XML to HTML

QTP generate it's results in an XML format. We can use the inbuilt result convertor to convert these into any format we want, but for that we need to have the RunResultsViewer installed on the system. But we can also convert these results into an HTML file manually. In order to convert this XML to any other format we need to use the XSL style sheet to define the conversion.
XSL is a Stylesheet language which can be used to transform an XML according to the specification. The output could be a HTML file, a text file, a XML file etc...To do this transformation at run-time we need to load the XML, and then the XSL into that, and save the output.

QTP comes with 3 different XSL files which would be located in the following folder - "C:\Program Files (x86)\HP\QuickTest Professional\dat\"

    PDetails.xsl - for getting the detailed results in HTML format
    PShort.xsl - for getting the short results in HTML format
    PSelection.xsl - for getting the selective results in HTML format

The PSelection.xsl file requires input arguments for the XSL and the other 2 can be directly loaded into the XML.

We can either refer these XSL files from the default directory [dat] or copy them to any folder we like, and then reference from there. Also, in order for the results to be displayed correctly the PResults.css [also located in the dat folder] file should be present in the same folder as the output HTML file. Hence, in order to avoid creating all the new result HTML files in the dat folder itself, its better to copy all the required files to a different directory and then work off of that one.

Below is the function that would do this conversion.


'''--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'' Function Name:         funcConvertResultsXMLtoHTML
'' Description:         This function will convert the QTP Results.xml into HTML format, with Detailed or Short versions.
''                         This can be called from within QTP, or an external VbScript
'' Input Parameters:     sInputResultsXML - The path of the QTP Results.xml
''                         sXSLType - The XSL type, based on which the results will be converted to either Detailed or Short version
''                         sOutputHTMLPath - The complete path where the HTML result file needs to be created
'' Output Parameters:     None
'' Author:                 Ashish Jaiswal
'''--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Function funcConvertResultsXMLtoHTML (sInputResultsXML, sXSLType, sOutputHTMLPath)

    ''Creating an instance for the DOMDocument Class of the MS XML Parser [MSXML.dll]
    Set oXMLDoc = CreateObject("MSXML.DOMDocument")
    Set oXSLDoc = CreateObject("MSXML.DOMDocument")

    ''Since a file is loaded asynchronously by default by the parser, we set it to false
    ''By setting the document's Async property to False, the parser will not return control to your code until the document is completely loaded and ready for manipulation. If you leave it set to True, you will need to either examine the ReadyState property before accessing the document or use the DOMDocument's events to have your code notified when the document is ready. Using the default value may cause issues during reading and writing to file, hence, its best to keep things simple, and let it be False.
    oXMLDoc.ASync = False
    oXSLDoc.ASync = False

    ''Opening the document via the Load method, by specifying the path of the input XML and XSL
    ''The XML parser can load XMLs from the local disk, over the network using the UNC path, or via a URL
    oXSLDoc.Load sXSLType
    oXMLDoc.Load sInputResultsXML

    ''Processing the entire XML (it processes all the nodes and the children) using the specified XSL Style Sheet, and then returning the transformation
    sTransformedXML = oXMLDoc.transformNode(oXSLDoc.documentElement)

    ''Creating a new file to hold the transformed XML data - the output HTML file, and enabling overwriting the file with True
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    Set oOutputHTML = oFSO.CreateTextFile(sOutputHTMLPath,True)

    ''Writing the transformed text to the HTML file
    oOutputHTML.Write sTransformedXML

    ''Saving the file finally
    oOutputHTML.Close

    ''Destroying the objects
    Set oOutputHTML = Nothing
    Set oFSO = Nothing
    Set oXMLDoc = Nothing
    Set oXSLDoc = Nothing

End Function
'''--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Now to use the function...

''Path of the Results file which needs to be converted
sResultsXMLPath = "C:\auto\Results.xml"

''Path of the XSL for detailed version
sDetailedXSLPath = "C:\auto\PDetails.xsl"

''Path of the XSL for short version
sShortXSLPath = "C:\auto\PDetails.xsl"

Call funcConvertResultsXMLtoHTML (sResultsXMLPath, sDetailedXSLPath, "C:\auto\Results_Detailed.html")
Call funcConvertResultsXMLtoHTML (sResultsXMLPath, sShortXSLPath, "C:\auto\Results_Short.html")