Skip to main content

Erlang Code Evolution Control

  • Conference paper
  • First Online:
  • 237 Accesses

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 10855))

Abstract

In the software lifecycle, a program can evolve several times for different reasons such as the optimisation of a bottle-neck, the refactoring of an obscure function, etc. These code changes often involve several functions or modules, so it can be difficult to know whether the correct behaviour of the previous releases has been preserved in the new release. Most developers rely on a previously defined test suite to check this behaviour preservation. We propose here an alternative approach to automatically obtain a test suite that specifically focusses on comparing the old and new versions of the code. Our test case generation is directed by: a sophisticated combination of several already existing tools such as TypEr, CutEr, and PropEr; the choice of an expression of interest whose behaviour must be preserved; and the recording of the sequences of values this expression is evaluated to. All the presented work has been implemented in an open-source tool that is publicly available on GitHub.

This work has been partially supported by MINECO/AEI/FEDER (EU) under grant TIN2016-76843-C4-1-R and by the Generalitat Valenciana under grant PROMETEO-II/2015/013 (SmartLogic). Salvador Tamarit was partially supported by the Conselleria de Educación, Investigación, Cultura y Deporte de la Generalitat Valenciana under grant APOSTD/2016/036.

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

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    While our current implementation limits the POI to variables, nothing prevents the technique from accepting any expression as the POI.

  2. 2.

    We show the process for only one input function. In case the user defined more than one input function, the process described here would be repeated for each of them.

  3. 3.

    Note that having ITCs that do not match with any function clause is not a problem. This scenario is common when TypEr returns the any type for some of the function’s parameters. However, these ITCs are useless since they will produce an empty trace. This explains our effort to avoid them.

  4. 4.

    We could also send its actual value, i.e., 3. This is just a design decision, but we think that including the value that produced the mismatch could be more useful to find the source of a discrepancy.

  5. 5.

    Function clauses need an additional transformation that consists in storing all the parameters inside a tuple so that they could be used in the case expressions introduced by these rules.

  6. 6.

    In SecEr, a timeout is also used as a way to stop the test case generation.

  7. 7.

    According to the definition of function tgen, the selection of the ITC that is going to be mutated is completely random. However, in our tool we give more priority to the inputs belonging to discrepancies(map) since they are more susceptible of revealing new discrepancies between versions.

  8. 8.

    The format for this list is [FUN1/ARITY1, FUN2/ARITY2 ...]. If the user does not provide it, all functions exported by the module are used as input functions.

References

  1. Bozó, I., Tóth, M., Simos, T.E., Psihoyios, G., Tsitouras, C., Anastassi, Z.: Selecting Erlang test cases using impact analysis. In: AIP Conference Proceedings, vol. 1389, pp. 802–805. AIP (2011)

    Google Scholar 

  2. Cronqvist, M.: redbug (2017). https://github.com/massemanet/redbug

  3. Ericsson AB: dbg (2017). http://erlang.org/doc/man/dbg.html

  4. Ericsson AB: Trace tool builder (2017). http://erlang.org/doc/apps/observer/ttb_ug.html

  5. Giantsios, A., Papaspyrou, N., Sagonas, K.: Concolic testing for functional languages. Sci. Comput. Program. 147, 109–134 (2017). https://doi.org/10.1016/j.scico.2017.04.008

    Article  Google Scholar 

  6. Insa, D., Pérez, S., Silva, J., Tamarit, S.: Erlang code evolution control (use cases). CoRR, abs/1802.03998 (2018)

    Google Scholar 

  7. Jumpertz, E.: Using QuickCheck and semantic analysis to verify correctness of Erlang refactoring transformations. Master’s thesis, Radboud University Nijmegen (2010)

    Google Scholar 

  8. Korel, B., Al-Yami, A.M.: Automated regression test generation. ACM SIGSOFT Softw. Eng. Notes 23(2), 143–152 (1998)

    Article  Google Scholar 

  9. Li, H., Thompson, S.: Testing Erlang refactorings with QuickCheck. In: Chitil, O., Horváth, Z., Zsók, V. (eds.) IFL 2007. LNCS, vol. 5083, pp. 19–36. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-85373-2_2

    Chapter  Google Scholar 

  10. Lindahl, T., Sagonas, K.: TypEr: a type annotator of Erlang code. In: Sagonas, K., Armstrong, J. (eds.) Proceedings of the 2005 ACM SIGPLAN Workshop on Erlang, Tallinn, Estonia, 26–28 September 2005, pp. 17–25. ACM (2005). http://doi.acm.org/10.1145/1088361.1088366

  11. Mongiovi, M.: Safira: a tool for evaluating behavior preservation. In: Proceedings of the ACM International Conference Companion on Object Oriented Programming Systems Languages and Applications Companion, pp. 213–214. ACM (2011)

    Google Scholar 

  12. Papadakis, M., Sagonas, K.: A PropEr integration of types and function specifications with property-based testing. In: Rikitake, K., Stenman, E. (eds.) Proceedings of the 10th ACM SIGPLAN Workshop on Erlang, Tokyo, Japan, 23 September 2011, pp. 39–50. ACM (2011). http://doi.acm.org/10.1145/2034654.2034663

  13. Rajal, J.S., Sharma, S.: Article: a review on various techniques for regression testing and test case prioritization. Int. J. Comput. Appl. 116(16), 8–13 (2015)

    Google Scholar 

  14. Soares, G., Gheyi, R., Massoni, T.: Automated behavioral testing of refactoring engines. IEEE Trans. Softw. Eng. 39(2), 147–162 (2013)

    Article  Google Scholar 

  15. Taylor, R., Hall, M., Bogdanov, K., Derrick, J.: Using behaviour inference to optimise regression test sets. In: Nielsen, B., Weise, C. (eds.) ICTSS 2012. LNCS, vol. 7641, pp. 184–199. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-34691-0_14

    Chapter  Google Scholar 

  16. Till, A.: erlyberly (2017). https://github.com/andytill/erlyberly

  17. Bozó, I., Tóth, M., Horváth, Z.: Reduction of regression tests for Erlang based on impact analysis (2013)

    Google Scholar 

  18. Tóth, M., et al.: Impact analysis of Erlang programs using behaviour dependency graphs. In: Horváth, Z., Plasmeijer, R., Zsók, V. (eds.) CEFP 2009. LNCS, vol. 6299, pp. 372–390. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-17685-2_11

    Chapter  Google Scholar 

  19. Yoo, S., Harman, M.: Regression testing minimization, selection and prioritization: a survey. Softw. Test. Verif. Reliab. 22(2), 67–120 (2012)

    Article  Google Scholar 

  20. Yu, K., Lin, M., Chen, J., Zhang, X.: Practical isolation of failure-inducing changes for debugging regression faults. In: Proceedings of the 27th IEEE/ACM International Conference on Automated Software Engineering, pp. 20–29. ACM (2012)

    Google Scholar 

  21. Zhang, L., Zhang, L., Khurshid, S.: Injecting mechanical faults to localize developer faults for evolving software. In: ACM SIGPLAN Notices, vol. 48, pp. 765–784. ACM (2013)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Salvador Tamarit .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer International Publishing AG, part of Springer Nature

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Insa, D., Pérez, S., Silva, J., Tamarit, S. (2018). Erlang Code Evolution Control. In: Fioravanti, F., Gallagher, J. (eds) Logic-Based Program Synthesis and Transformation. LOPSTR 2017. Lecture Notes in Computer Science(), vol 10855. Springer, Cham. https://doi.org/10.1007/978-3-319-94460-9_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-94460-9_8

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-94459-3

  • Online ISBN: 978-3-319-94460-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics