Friday, May 25, 2012

 

XML test case definitions

If your test framework reads XML files to load a list of suites and test cases, it's defective.

XML is not a human writable format. It's for systems to communicate with other systems. Why would you select XML for a file that's supposed to be created by humans?

I take issue with the entire premise of having a configuration file in the first place. The rationale usually goes something like this:
  1. We'll create test cases that have parameters that make them flexible
  2. An XML file will allow us to call those test cases in new and unusual combinations
  3. We'll use different XML files for different types of test runs
This should all be in code. Suppose I have a test case like this:
def test_creating_directories(depth):    # Some test code
I might have an XML file containing:
<test>
    <function>test_creating_directories</function>
    <params>3</params>
</test>
<test>
    <function>test_creating_directories</function>
    <params>4</params>
</test>
<test>
    <function>test_creating_directories</function>
    <params>5</params>
</test>
But why? This XML file is going to get loaded up and added to data structures at test time. Why not just create those data structures in the test language? What's the point of using XML here at all? Create these data structures in your code directly:
tests = [
    (test_creating_directories, 3),
    (test_creating_directories, 4),
    (test_creating_directories, 5),
    ]
My point here is not just that this is easier to read and write. Once you start seeing this as a data structure, you realize you can do something like this:
tests = [] for i in xrange(3,6):     tests.append((test_creating_directories, i))
Without doing something seriously hacky, you'll never have loops and other programatic test case definition in an XML file.

The only slight exception to this rule is for compiled test cases - so this would apply to folks writing in C, C++, C#, Java, etc. In those cases you might want to change the list of tests near runtime rather than at compile time. But for a language like Python, where you can just edit the files, there's no reason to use these external test suite data files.

Comments:
It’s the best time to make some plans for the future and it is time to be happy. I’ve read this post and if I could I want to suggest you few interesting things or suggestions.You can write next articles referring to this article. I desire to read even more things about it..
Office Interiors in Chennai
 
It’s the best time to make some plans for the future and it is time to be happy. I’ve read this post and if I could I want to suggest you few interesting things or suggestions.You can write next articles referring to this article. I desire to read even more things about it..
RFID Solutions
Sports Analytic Software
Logistic ERP
Athletic Management Software
 
The Mobile Accessories is a largest mobile retail Chain dealing in leading international and Indian Brands of mobile phones and accessories headquartered with using special offers and low cost of the latest branded mobile phones. This is amazing offers with some of days.

Mobile Showrooms in OMR

 
Thanks for sharing this excellent article.

dhl courier in chennai
 
THanks for sharing this excellent article.

https://boobalan.me/
 
THanks for sharing thsi interesting article.

https://worksheetschool.com/addition-worksheets/
 
Thanks for sharing this awesome article!
https://medium.com/@alicealdaine/top-10-api-testing-tools-rest-soap-services-5395cb03cfa9
 
Very nice post here thanks for it I always like and search such topics and everything connected to them.Excellent and very cool idea and the subject at the top of magnificence and I am happy to comment on this topic through which we address the idea of positive reaction.
Manuscript writing services
Journal Of Zoology
Journal Of Medical Sciences
Botany Journal
Journal Of Agricultural Science
 


I enjoyed over read your blog post. Your blog have nice information, I got good ideas from this amazing blog. I am always searching like this type blog post. I hope I will see again.
Best Ice Fishing Gloves Best Ice Fishing Gloves Best Ice Fishing Gloves



 
This comment has been removed by the author.
 
What an inspirational post! It prompts me that occasionally we consume to halt and appearance at our exists
DHL IN CHENNAI - CALL US [+91 98415 01122 / +91 81247 01234]
DHL IN EGMORE - CALL US [+91 98415 01122 / +91 81247 01234]
DHL IN KOLATHUR - CALL US [+91 98415 01122 / +91 81247 01234]
 
Why we are not able to see any latest articles from ur side?
 
Thanks for sharing such a nice information with us...
Interior Design Sketches in Bangalore

 
If you are finding a good driving school Deer Park. Gill Driving School Deer Park is one of the few driving schools that provide top quality driving test in Deer Park. We have both Male and Female instructors who will provide you comfortable and enjoyable learning time. And also we offer you both automatic and manual driving lessons in Deer Park along with all Suburbs of Melbourne. We are very passionate in our job and we love to teaching car driving and road safety to our students. Gill driving schools have one of the best and highly qualified driving instructors Deer Park as well as Australia.
 
Great content & Thanks for sharing with oflox.
 
I genuinely appreciated understanding it. Sitting tight for some more incredible articles like this from you in the nearing days.

Online Training for Big Data
Big Data Hadoop Online Training
 
먹튀검증 만을 위한 사이트 추천
먹튀를 검증하여 안전한 토토사이트를 제공합니다.
먹튀사냥꾼
 
This comment has been removed by the author.
 
Sir, I got so much knowledge from reading this post.Thank you so much for such a wonderful information

Pharmaceutics Question Paper
 
Sir, I got so much knowledge from reading this post.Thank you so much for such a wonderful information

Pharmacology Question Paper
 
Thanks for The Amazing Blog.
We’re one of The Best Food Business Consultant in Hyderabad.

 
Thanks for the amazing information. For Best Wedding Invitation Templates After Effect.
Visit : editpointindia.com
 
This is a great inspiring GEO Kahani Dramas. I am pretty much pleased with your work as well.
 
I believe this is a great SEO Firm Chicago, You are working great on the content and quality of this.
 
Best house lifting services in Chennai
 
Thank You for an amazing blog.
Study visa consultant in Haryana
 
Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?