Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

SOAtest assert on partial date/timestamp

dgoedh
dgoedh Posts: 63

Hi,

I like to assert on a DB value containing a time stamp e.g. 2019-06-13 09:04:23.338024, by only considering the date part 2019-06-13 and neglecting the time.

Can this be accomplished with a build in assertion of SOAtest or should this be implemented with a custom assertion?

Thanks in advance .

Regards ,

Daniel

Tagged:

Comments

  • dgoedh
    dgoedh Posts: 63

    This worked for me for now in a custom assertion:

    from java.lang import *
    from java.text import *
    from java.util import *
    from soaptest.api import *
    from com.parasoft.api import *

    DATASOURCENAME = "Select_Tabel_DS"

    def compareValue(input, context):
    valueFromDS = context.getValue(DATASOURCENAME,"TS_START")
    subDate = input[0:10]
    #Application.showMessage ("TS_START was: " + input)
    #Application.showMessage ("TS_START wordt: " + subDate)

    if (valueFromDS == subDate):
        return 1
    else:
        return 0