Logo QF-Test

Finding valuable answers
in the Mailing List Archive.

 

Free Trial  Download  Buy

Thomas Max, QF-Test training and support

Use the full-text search on our web site to find helpful tips on the mailing list.

Thomas Max, 
Sr. Software Engineer & Trainer, QFS

2017 up to now  | 2016 | 2015 | 2014 | 2013 | 2012 | 2011 | 2010 | 2009 | 2008 | 2007

(older archive entries before 2007 are not shown here, but included in the onsite-search)

Mailing List - Entries from 2017 up to now


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[QF-Test] Implementing Enum in scripting


  • Subject: [QF-Test] Implementing Enum in scripting
  • From: "Liu, Kevin (DPTI)" <Kevin.Liu@?.au>
  • Date: Thu, 13 Jul 2017 01:13:39 +0000
  • Delivered-to: qftest-list@?.net

Hi,

 

I am very new to QF-Test and Jython and Groovy scripting language, and I have a java class containing an Enum as follows:

 

public class CashDrawer {

 

private static enum Denomination {

                den02, den05, den5,den10;

 

                double getDenomValue(){

                                switch(this) {

                                                case den05:

                                                                return 0.5d;

                                                case den5:

                                                                return 5.0d;

                                                case den10:

                                                                return 10.0d;

                                                default:

                                                                return 0.2d;

                                }

                }

               

                //return the row number of the denomination in cash drawer table

                int getDenomRowNum() {

                                switch(this) {

                                                case den10:

                                                                return 1;

                                                case den5:

                                                                return 2;

                                                case den05:

                                                                return 3;

                                                default:

                                                                return 4;

                                }

                }

 

                Denomination getNextDenom() {

                                switch(this) {

                                                case den02:

                                                                return den05;

                                                case den05:

                                                                return den5;

                                                case den5:

                                                                return den10;

                                                default:

                                                                return null;

                                }

                }

 

               

}

 

private Denomination currentDenom;

 

.

.

.

}

 

And I also had a look at the class CheckDataType at section 41.4.4 in the manual, still haven’t got a clue on the implementation. Please give me some example on how to write the above Enum in Jython or Groovy SUT script.

 

Thanks in advance

Kevin


Videos Downloads Documentation Buy Free Trial