Logo QF-Test

Im Archiv der Mailingliste
wertvolle Antworten finden.

 

Gratis Testen  Download  Kaufen

Thomas Max, QF-Test Training und Support

Tipp für die Recherche in der Mailingliste: Volltextsuche (oben) verwenden.

Thomas Max,
Sr. Software Engineer & Trainer, QFS

2017 bis heute 2016 2015 2014 | 2013 | 2012 | 2011 2010 2009 | 2008 | 2007

(ältere Archiveinträge vor 2007 nicht dargestellt, aber in der Suche enthalten)

Mailingliste - Einträge 2017 bis heute


[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 Dokumentation Kaufen Gratis Testen