Skip to main content
Log in

APOGEN: automatic page object generator for web testing

  • Published:
Software Quality Journal Aims and scope Submit manuscript

Abstract

Modern web applications are characterized by ultra-rapid development cycles, and web testers tend to pay scant attention to the quality of their automated end-to-end test suites. Indeed, these quickly become hard to maintain, as the application under test evolves. As a result, end-to-end automated test suites are abandoned, despite their great potential for catching regressions. The use of the Page Object pattern has proven to be very effective in end-to-end web testing. Page objects are façade classes abstracting the internals of web pages into high-level business functions that can be invoked by the test cases. By decoupling test code from web page details, web test cases are more readable and maintainable. However, the manual development of such page objects requires substantial coding effort, which is paid off only later, during software evolution. In this paper, we describe a novel approach for the automatic generation of page objects for web applications. Our approach is implemented in the tool Apogen, which automatically derives a testing model by reverse engineering the target web application. It combines clustering and static analysis to identify meaningful page abstractions that are automatically turned into Java page objects for Selenium WebDriver. Our evaluation on an open-source web application shows that our approach is highly promising: Automatically generated page object methods cover most of the application functionalities and result in readable and meaningful code, which can be very useful to support the creation of more maintainable web test suites.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13

Similar content being viewed by others

Notes

  1. https://github.com/spring-projects/spring-petclinic.

  2. http://projects.spring.io/spring-framework/.

  3. http://docs.seleniumhq.org/projects/webdriver/.

  4. http://docs.seleniumhq.org/docs/02_selenium_ide.jsp#locating-elements.

  5. https://addons.mozilla.org/en-US/firefox/addon/firepath/.

  6. http://ohmap.virtuetech.de/.

  7. https://github.com/dzharii/swd-recorder.

  8. https://github.com/wiredrive/wtframework/wiki/WTF-PageObject-Utility-Chrome-Extension.

  9. https://github.com/patrickherrmann/Bumblebee.

  10. https://github.com/cheezy/page-object

  11. PageFactory is used to initialize the web elements and helps to remove boiler-plate code from the page objects methods. https://code.google.com/p/selenium/wiki/PageFactory.

  12. http://d3js.org/.

  13. A customization of http://bl.ocks.org/gmamaladze/9320969.

  14. http://www.xmlunit.org/.

  15. http://javaparser.github.io/javaparser/.

References

  • Akaike, H. (1981). Likelihood of a model and information criteria. Journal of Econometrics, 16(1), 3–14.

    Article  MathSciNet  MATH  Google Scholar 

  • Arthur, D., & Vassilvitskii, S. (2007). K-means++: The advantages of careful seeding. In Proceedings of the 18th annual ACM-SIAM symposium on discrete algorithms, SODA 2007 (pp. 1027–1035). Philadelphia, PA, USA: Society for Industrial and Applied Mathematics.

  • Binder, R. V. (1996). Testing object-oriented software: A survey. Software Testing, Verification and Reliability, 6(3–4), 125–252.

    Article  Google Scholar 

  • Blanco, L., Dalvi, N., & Machanavajjhala, A. (2011). Highly efficient algorithms for structural clustering of large websites. In Proceedings of the 20th international conference on world wide web, WWW ’11 (pp. 437–446). New York, NY, USA: ACM.

  • Choudhary, S. R., Prasad, M. R., & Orso, A. (2012). Crosscheck: Combining crawling and differencing to better detect cross-browser incompatibilities in web applications. In Proceedings of the 5th IEEE international conference on software testing, verification and validation, ICST 2012 (pp. 171–180). Washington, DC, USA: IEEE Computer Society.

  • Choudhary, S. R., Versee, H., & Orso, A. (2010). Webdiff: Automated identification of cross-browser issues in web applications. In Proceedings of the 26th IEEE international conference on software maintenance, ICSM 2010 (pp. 1–10). IEEE Computer Society.

  • Choudhary, S. R., Zhao, D., Versee, H., & Orso, A. (2011). WATER: Web application test repair. In Proceedings of the 1st international workshop on end-to-end test script engineering, ETSE 2011 (pp. 24–29). ACM.

  • Christophe, L., Stevens, R., Roover, C. D., & Meuter, W. D. (2014). Prevalence and maintenance of automated functional tests for web applications. In Proceedings of 30th international conference on software maintenance and evolution, ICSME, IEEE.

  • Crescenzi, V., Merialdo, P., & Missier, P. (2005). Clustering web pages based on their structure. Data Knowledge Engineering, 54(3), 279–299.

    Article  Google Scholar 

  • Di Lucca, G. A., Fasolino, A. R., & Tramontana, P. (2004). Reverse engineering web applications: The WARE approach. Journal of Software Maintenance and Evolution, 16(1–2), 71–101.

    Article  Google Scholar 

  • Fewster, M., & Graham, D. (1999). Software test automation: Effective use of test execution tools. Boston, MA, USA: Addison-Wesley Longman Publishing Co. Inc.

    MATH  Google Scholar 

  • Fowler, M. (2013). PageObject. http://martinfowler.com/bliki/PageObject.html.

  • Gao, Z., Fang, C., & Memon, A. M. (2015). Pushing the limits on automation in gui regression testing. In 2015 IEEE 26th international symposium on software reliability engineering (ISSRE) (pp. 565–575).

  • Hammoudi, M., Rothermel, G., & Stocco, A. (2016a). WATERFALL: An incremental approach for repairing record-replay tests of web applications. In Proceedings of 24th ACM SIGSOFT international symposium on the foundations of software engineering, FSE 2016.

  • Hammoudi, M., Rothermel, G., & Tonella, P. (2016b). Why do record/replay tests of web applications break? In Proceedings of 9th international conference on software testing, verification and validation, ICST page (to appear). IEEE.

  • Kaufman, L., & Rousseeuw, P. J. (1990). Finding groups in data: An introduction to cluster analysis. Wiley series in probability and mathematical statistics. New York: A Wiley-Interscience publication.

    Book  MATH  Google Scholar 

  • Ketchen, D., Boyd, B., & Bergh, D. (2008). Research methodology in strategic management: Past accomplishments and future challenges. Organizational Research Methods, 11(4), 643–658.

    Article  Google Scholar 

  • Leotta, M., Clerissi, D., Ricca, F., & Spadaro., C. (2013a). Improving test suites maintainability with the page object pattern: An industrial case study. In Proceedings of 6th international conference on software testing, verification and validation workshops, ICSTW 2013 (pp. 108–113). IEEE.

  • Leotta, M., Clerissi, D., Ricca, F., & Tonella, P. (2013b). Capture-replay vs. programmable web testing: An empirical assessment during test case evolution. In Proceedings of 20th working conference on reverse engineering, WCRE, 2013 (pp. 272–281). IEEE.

  • Leotta, M., Clerissi, D., Ricca, F., & Tonella, P. (2014a). Visual vs. DOM-based web locators: An empirical study. In Proceedings of 14th international conference on web engineering (ICWE 2014), volume 8541 of LNCS (pp. 322–340). Springer.

  • Leotta, M., Clerissi, D., Ricca, F., & Tonella, P. (2016a). Approaches and tools for automated end-to-end web testing. Advances in Computers, 101, 193–237.

    Article  Google Scholar 

  • Leotta, M., Stocco, A., Ricca, F., & Tonella, P. (2014b). Reducing web test cases aging by means of robust XPath locators. In Proceedings of 25th international symposium on software reliability engineering workshops (ISSREW 2014) (pp. 449–454). IEEE.

  • Leotta, M., Stocco, A., Ricca, F., & Tonella, P. (2015). Using multi-locators to increase the robustness of web test cases. In Proceedings of 8th international conference on software testing, verification and validation, ICST 2015 (pp. 1–10). IEEE.

  • Leotta, M., Stocco, A., Ricca, F., & Tonella, P. (2016b). ROBULA+: An algorithm for generating robust XPath locators for web testing. Journal of Software: Evolution and Process, 28(3), 177–204.

    Google Scholar 

  • Lucia, A. D., Risi, M., Scanniello, G., & Tortora, G. (2009). An investigation of clustering algorithms in the identification of similar web pages. Journal of Web Engineering, 8(4), 346–370.

    Google Scholar 

  • Marchetto, A., Tonella, P., & Ricca, F. (2008). State-based testing of Ajax web applications. In Proceedings of 1st international conference on software testing, verification and validation, ICST 2008 (pp. 121–130). IEEE.

  • Mesbah, A., & Prasad, M. R. (2011). Automated cross-browser compatibility testing. In Proceedings of the 33rd international conference on software engineering, ICSE 2011 (pp. 561–570). New York, NY, USA: ACM.

  • Mesbah, A., van Deursen, A., & Lenselink, S. (2012a). Crawling Ajax-based web applications through dynamic analysis of user interface state changes. ACM Transactions on the Web (TWEB), 6(1), 3:1–3:30.

    Google Scholar 

  • Mesbah, A., van Deursen, A., & Roest, D. (2012b). Invariant-based automatic testing of modern web applications. IEEE Transaction on Software Engineering (TSE), 38(1), 35–53.

    Article  Google Scholar 

  • Nguyen, B. N., Robbins, B., Banerjee, I., & Memon, A. (2014). Guitar: An innovative tool for automated testing of gui-driven software. Automated Software Engineering, 21(1), 65–105.

    Article  Google Scholar 

  • Ramler, R., & Wolfmaier, K. (2006). Economic perspectives in test automation: Balancing automated and manual testing with opportunity cost. In Proceedings of the 1st international workshop on automation of software test, AST 2006 (pp. 85–91). New York, NY, USA: ACM.

  • Ricca, F. (2004). Analysis, testing and re-structuring of web applications. In Proceedings of the 20th IEEE international conference on software maintenance (pp. 474–478).

  • Ricca, F., Pianta, E., Tonella, P., & Girardi, C. (2008). Improving web site understanding with keyword-based clustering. Journal of Software Maintenance, 20(1), 1–29.

    Article  Google Scholar 

  • Ricca, F., & Tonella, P. (2001). Analysis and testing of web applications. In Proceedings of the 23rd international conference on software engineering, ICSE ’01 (pp. 25–34). Washington, DC, USA: IEEE Computer Society.

  • Rousseeuw, P. (1987). Silhouettes: A graphical aid to the interpretation and validation of cluster analysis. Journal of Computational and Applied Mathematics, 20(1), 53–65.

    Article  MATH  Google Scholar 

  • Sacramento, C., & Paiva, A. (2014). Web application model generation through reverse engineering and UI pattern inferring. In Proceedings of the 9th international conference on the quality of information and communications technology, QUATIC 2014 (pp. 105–115). IEEE.

  • Sampath, S. (2012). Advances in user-session-based testing of web applications. Advances in Computers, 86, 87–108.

    Article  Google Scholar 

  • Schwarz, G. (1978). Estimating the dimension of a model. The Annals of Statistics, 6(2), 461–464.

    Article  MathSciNet  MATH  Google Scholar 

  • Selenium Wiki. (2013). Page objects. https://code.google.com/p/selenium/wiki/pageobjects.

  • Stocco, A., Leotta, M., Ricca, F., & Tonella, P. (2015). Why creating web page objects manually if it can be done automatically? In Proceedings of 10th IEEE/ACM international workshop on automation of software test, AST 2015 (pp. 70–74). IEEE.

  • Stocco, A., Leotta, M., Ricca, F., & Tonella, P. (2016). Clustering-aided page object generation for web testing. In Proceedings of 16th international conference on web engineering, ICWE 2016, volume 9671 of LNCS (pp. 132–151). Springer.

  • Thummalapenta, S., Devaki, P., Sinha, S., Chandra, S., Gnanasundaram, S., Nagaraj, D. D., & Sathishkumar, S. (2013). Efficient and change-resilient test automation: An industrial case study. In Proceedings of the 35th international conference on software engineering, ICSE 2013 (pp. 1002–1011). IEEE.

  • Tombros, A., & Ali, Z. (2005). Factors affecting web page similarity. In Proceedings of the 27th European conference on advances in information retrieval research, ECIR 2005 (pp. 487–501). Berlin: Springer.

  • Tonella, P., Ricca, F., & Marchetto, A. (2014). Recent advances in web testing. Advances in Computers, 93, 1–51.

    Article  Google Scholar 

  • Tonella, P., Ricca, F., Pianta, E., & Girardi, C. (2003a). Using keyword extraction for web site clustering. In Proceedings of the 5th international workshop on web site evolution, WSE 2003 (pp. 41–48).

  • Tonella, P., Ricca, F., Pianta, E., Girardi, C., Lucca, G. A. D., & Fasolino, A. R. et al. (2003b). Evaluation methods for web application clustering. In Proceedings of the 5th international workshop on web site evolution, WSE 2003 (pp. 33–40).

  • van Deursen, A. (2015a). Beyond page objects: Testing web applications with state objects. Queue, 13(6), 20:20–20:37.

    Google Scholar 

  • van Deursen, A. (2015b). Testing web applications with state objects. Communications of ACM, 58(8), 36–43.

    Article  Google Scholar 

  • Witten, I . H., Frank, E., & Hall, M . A. (2011). Data mining: Practical machine learning tools and techniques (3rd ed.). San Francisco, CA, USA: Morgan Kaufmann Publishers Inc.

    Google Scholar 

  • Yandrapally, R., Thummalapenta, S., Sinha, S., & Chandra, S. (2014). Robust test automation using contextual clues. In Proceedings of the 25th international symposium on software testing and analysis, ISSTA 2014 (pp. 304–314). ACM.

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Andrea Stocco.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Stocco, A., Leotta, M., Ricca, F. et al. APOGEN: automatic page object generator for web testing. Software Qual J 25, 1007–1039 (2017). https://doi.org/10.1007/s11219-016-9331-9

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11219-016-9331-9

Keywords

Navigation