100 likes | 233 Views
Narcissus Check how you look like!. Jadoulle Jérôme RVP-ONP April 2011. Presentation goals. Why is it needed? What is Narcissus? In relation to Selenium; In relation to the web browser; In relation to Theseos; How are Narcissus tests written: The Unit test part; The « Selenium » part;
E N D
Narcissus Check how you look like! Jadoulle Jérôme RVP-ONP April 2011
Presentation goals • Why is it needed? • What is Narcissus? • In relation to Selenium; • In relation to the web browser; • In relation to Theseos; • How are Narcissus tests written: • The Unit test part; • The « Selenium » part; • Errors display with Narcissus-UI • State of advancement • Demo (Pension cadaster Narcissus tests by Ollie)
Why is it needed? • Wanting to test Web applications user interfaces in an easy way. • No similar tool present of the market • Selenium allows UI interface testing through interactions but nothing testing the « face » of the application itself • It is possible to take a screenshot of the full pages but not of page elements themselves. It is also not possible to compare the screenshots with previous version • Initial requirement: « Take a screenshot of a table full of data and compare it with the same screenshots taken the day before ».
What is Narcissus (1/2)? • A Web UI testing tool: • Takes screenshots of elements on any web page and compares them, pixel by pixel, to the originals Original Taken screenshot Result
What is Narcissus (2/2)? • Deeply related to Selenium • Use selenium for usual Web GUI testing; • Resort to Narcissus when wanting to compare element’s UI • Can be used for any web application tested with Selenium • Internals have wider use: • Possible uses: • Use project’s core to compare PDF pages generated by multiple versions of a PDF generation application • actually already implemented in narcissus-tools sub-project. • Automatically take screenshots of elements in a web interface and integrate them in a report
How does it work (1/2)? • As simple as a Selenium UnitTest Extend NarcissusTestCase Use Selenium for page navigation • Call Narcissus for screenshot comparison • Params: • Id of HTML element to take a screenshot of; • Name of the screenshot. From the outside world, Narcissus is just ONE line of code to add to your tests!
How does it work (2/2)? • Use Narcissus-UI to see the differences
State of advancement (1/3) • Core: • Already possible to take screenshots of elements: • Directly in page; • Bigger than the page : • With scrolling if necessary; • With multiple screenshots assembled if necessary; • Inside scrollable elements (scrolled and with multi-screenshot capture if necessary!) • Scrollable elements themselves are not yet working • Just a « time » issue => doable.
State of advancement (2/3) • UI: • Already possible to display the differences in multiple modes (see demo); • Exclusion zones are displayed as well • Exclusion zone = expected difference we do not care about. • Not yet possible to • add / edit / remove exclusion zones; • Replace a reference by a screenshot (in case of application evolution); • Some more work on usability required.
State of advancement (3/3) • Server/Client mode: • Narcissus can work in a server/client mode (the « build environment » case • Screenshots taken by remote server; • Serialization and send back on local; • Comparison as usual. • Open-source released: • http://code.google.com/p/narcissus-webtests/ • Initial commit performed. • Need to work on the documentation; • Should test NarcissususingNarcissusitself as well.