Software Quality Journal

, Volume 25, Issue 3, pp 1007–1039 | Cite as

APOGEN: automatic page object generator for web testing

  • Andrea Stocco
  • Maurizio Leotta
  • Filippo Ricca
  • Paolo Tonella
Article

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.

Keywords

Web testing End-to-end testing Page object pattern Reverse engineering Selenium WebDriver Clustering 

References

  1. Akaike, H. (1981). Likelihood of a model and information criteria. Journal of Econometrics, 16(1), 3–14.MathSciNetCrossRefMATHGoogle Scholar
  2. 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.Google Scholar
  3. Binder, R. V. (1996). Testing object-oriented software: A survey. Software Testing, Verification and Reliability, 6(3–4), 125–252.CrossRefGoogle Scholar
  4. 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.Google Scholar
  5. 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.Google Scholar
  6. 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.Google Scholar
  7. 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.Google Scholar
  8. 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.Google Scholar
  9. Crescenzi, V., Merialdo, P., & Missier, P. (2005). Clustering web pages based on their structure. Data Knowledge Engineering, 54(3), 279–299.CrossRefGoogle Scholar
  10. 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.CrossRefGoogle Scholar
  11. Fewster, M., & Graham, D. (1999). Software test automation: Effective use of test execution tools. Boston, MA, USA: Addison-Wesley Longman Publishing Co. Inc.MATHGoogle Scholar
  12. Fowler, M. (2013). PageObject. http://martinfowler.com/bliki/PageObject.html.
  13. 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).Google Scholar
  14. 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.Google Scholar
  15. 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.Google Scholar
  16. 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.CrossRefMATHGoogle Scholar
  17. Ketchen, D., Boyd, B., & Bergh, D. (2008). Research methodology in strategic management: Past accomplishments and future challenges. Organizational Research Methods, 11(4), 643–658.CrossRefGoogle Scholar
  18. 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.Google Scholar
  19. 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.Google Scholar
  20. 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.Google Scholar
  21. 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.CrossRefGoogle Scholar
  22. 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.Google Scholar
  23. 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.Google Scholar
  24. 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
  25. 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
  26. 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.Google Scholar
  27. 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.Google Scholar
  28. 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
  29. 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.CrossRefGoogle Scholar
  30. 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.CrossRefGoogle Scholar
  31. 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.Google Scholar
  32. 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).Google Scholar
  33. 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.CrossRefGoogle Scholar
  34. 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.Google Scholar
  35. 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.CrossRefMATHGoogle Scholar
  36. 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.Google Scholar
  37. Sampath, S. (2012). Advances in user-session-based testing of web applications. Advances in Computers, 86, 87–108.CrossRefGoogle Scholar
  38. Schwarz, G. (1978). Estimating the dimension of a model. The Annals of Statistics, 6(2), 461–464.MathSciNetCrossRefMATHGoogle Scholar
  39. Selenium Wiki. (2013). Page objects. https://code.google.com/p/selenium/wiki/pageobjects.
  40. 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.Google Scholar
  41. 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.Google Scholar
  42. 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.Google Scholar
  43. 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.Google Scholar
  44. Tonella, P., Ricca, F., & Marchetto, A. (2014). Recent advances in web testing. Advances in Computers, 93, 1–51.CrossRefGoogle Scholar
  45. 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).Google Scholar
  46. 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).Google Scholar
  47. van Deursen, A. (2015a). Beyond page objects: Testing web applications with state objects. Queue, 13(6), 20:20–20:37.Google Scholar
  48. van Deursen, A. (2015b). Testing web applications with state objects. Communications of ACM, 58(8), 36–43.CrossRefGoogle Scholar
  49. 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
  50. 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.Google Scholar

Copyright information

© Springer Science+Business Media New York 2016

Authors and Affiliations

  1. 1.DIBRIS - Università degli Studi di GenovaGenoaItaly
  2. 2.Fondazione Bruno KesslerTrentoItaly

Personalised recommendations