User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Points for Confirmed Friends

    Calculate Permutations

    I'm not really sure what forum to put this one in but it's pretty much unit level stuff. Basically I'm wondering if anyone knows how to write a Java program that would do permutations for functional test cases or unit test cases if we have them labeled in a simple fashion, like A1, B1, C1. I'm not worried about which test cases are relevant with each other but rather the permutations. This is really only to be used for variable combinations, not just test cases. (I just thought I might be able to squeeze that in too!) But we've got a series of variables that I'm writing test cases on (mainly for unit testing I guess) and I want to see permutations of those but do this automatically. Am I making any sense?


  2. #2
    Points for Confirmed Friends

    Re: Calculate Permutations

    Try James Bachs Allpairs program.

    GUI automation is GUI automation. It is not testing.

  3. #3
    Senior Member
    Join Date
    Dec 1999
    Post Thanks / Like
    0 Post(s)
    1 Thread(s)
    Total Downloaded

    Re: Calculate Permutations

    I also like the Allpairs program that wooks mentions. However, it is written in Perl script and you specifically asked for Java. There are different ways you could get what you need. Here is one of the simplest that I can think of:

    Note: The "LESSTHAN" references should, of course, be a < character. The reason I did not do that in the code was because some versions of UBB will not allow what it perceives to be an HTML opening tag within parentheses.

    The idea is to replace testString="a b c d e f" with whatever you want. Notice that I did not really optimize this code for disregarding the spaces, which you should do if you want to use it for test cases. It still gives accurate results but in a cumbersome way. Also note that you can use this to find simple permutations of a word (or combinations of letters within a word). Also note that you should not do something like "A1 B1 C1 D1 E1 F1" with this because the letters and the numbers will each be treated as possible permuters. Again, you could change around the code if you wanted to.

    When doing things like this rather than just relying on programs, we can also look at the algorithms so we understand why things work. So that means you could consider that the number of combinations of K objects chosen from a set of N objects is equal to N!/K!(N-K)!, while the number of permutations is N!/(N-K)! (I trust that the notion of factorials is understood.)




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 12.00%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:44 PM.

Copyright BetaSoft Inc.