Unable to add a assertion by custom scripting

LegacyForumLegacyForum Posts: 1,669 ✭✭
edited December 2016 in SOAtest
I am trying to check if a number if positive or not by using XML asserter.

After I have written the code I should get the function name in the Method drop down. But I am not able to see that. The drop down is empty. I have attached a screen shot for the same.

Can someone please help me in resolving this?

Regards
Archana
Tagged:

Comments

  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    Hi Archana,

    I notice two things about the script:

    1) The indents are inconsistent, which is actually invalid syntax in Python. In particular, the if-else statement should be indented consistently. Python uses indentation to determine program structure.

    2) The else statement should have a colon ( : ) after it.

    Note that an easier implementation would be something like this:
    CODE
    def checkid(input, context):
        id = float(input)
        return id > 0
  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    Thanks a lot. I am new to Pyhton so did not know that there would be errors due to indntations.The code is working fien now.

    Thanks
  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    You don't need to use scripting. You can create a Numeric Assertion with:

    Element must be: >
    Expected value (Fixed): 0
Sign In or Register to comment.