0

Are there any Java test frameworks which allows to check (assert) some visual properties of tested applications?

For example, that some button displayed, or that text fit into frame and so on?

1 Answer 1

2

There is Jemmy Java test library which allows to capture images of controls, compare it with golden screenshot (strictly and unstrictrly), verify java entities borders, etc.

Sign up to request clarification or add additional context in comments.

5 Comments

What is golden screenshot?
golden (or master, or reference) screenshot is one which you expect your application to produce. Thus comparing current screenshot with golden one you can find out if application works correctly.
How screenshots can be compared portable? For example on Mac and Win?
Oh, this is complex problem. You either make comparison non-strict (e.g. allow slight differences in rendering, see AverageDistanceImageComparator in jemmy) or you provide different set of images for each platform (which increases maintenance costs)
There are 3 algorithms implemented in Jemmy, besides strict pixel-to-pixel comparison. 1: Allow some percentage of pixels to go wrong in actual image, comparing to a reference (golden) image. 2: Maximum from pixel-to-pixel color distance for given two images. 3: Average color distance over all pixels in given two images. For two colors (r1, g1, b1) and (r2, g2, b2), "color distance" is equal to sqrt((r2-r1)^2 + (g2-g1)^2 + (b2-b1)^2) Despite the simplicity, all three algorithms work well in different cases.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.