sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #06594
Re: [Question #177536]: How to define constants in junit test script?
Question #177536 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/177536
Status: Open => Answered
RaiMan proposed the following answer:
If you want to make more sophisticated things in a unit test, step away
from the unit test feature in the IDE: it still is some nice toy, but
lacks many options you have in normal scripting.
the background:
like in Java, a test case is a class definition that inherits from some predefined unit test classes. Usage of self is specific for Pythons OO style of programming and has to be accepted as such: references to class attributes have to be qualified with the class name (e.g. MyClass.some_name) and references to instance attributes inside the class definition have to be qualified with self (e.g. self.some_instance_variable) and all instance methods have to have self as 1st parameter, but when called, this is omitted.
Little bit weird, but no way around ;-)
this wrapping is done as a convenience by Sikuli IDE, when using the unit test view, so you just define your test functions and press run.
But believe me: Everyone who seriously does testing with Sikuli either uses Jython/Python unit test or makes it in Java directly using Sikuli's Java API.
So since you say, you know Java's Junit, you might either walk the Java
road or learn how to use Python's unit test feature (some questions in
this forum are talking about that) in the normaL script mode.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.