Test-Driven Development Issues for Right to Left Language Applications FARHAN M AL OBISAT Computer and Information Technology Department Tafila Technical University P. O. Box 179, Tafila 66110 JORDAN fobisat@ttu.edu.jo Abstract: - Using Right to Left Languages (RLL) in software development necessitates switching the direction of many different components in the user interface. Keeping the original interface layout, and changing only the language may result in different semantics or interpretations for the content. Unfortunately, this aspect is often dismissed. Test-driven development (TDD) for RLL, such as Arabic Language, should be considered in testing methodologies and software development. Similarly, non-left-to-right languages have to follow the same model. In this work, we describe number of guidelines that should be taken into consideration when developing software for RLL or non-left-to-right languages. Key-Words: -software, testing, languages, right to left, development, application 1 Introduction Test-Driven Development (TDD) is the main part of the agile development drives from Extreme Programming (XP) and the values of the Agile Manifesto. TDD is not original; an early mention to the use of TDD is the NASA Project Mercury in the 1960's [1]. Some encouraging properties have been reported to be reachable with TDD. While it is usually seems to be, TDD is inherently not only a testing method; it is also a design and development method where the tests are written before the code in order to confirm obtaining an error-free code. In TDD, tests are added to the code. When the test is passed, the code is restructured to get better internal structure of the code. This process is usually iterated several times until all functions are verified to be well implemented. Often, any software development process encompasses the following major activities: 1. Analysis (Specification) 2. Design 3. Implementation 4. Testing 5. Maintenance 6. Operation The TDD in general consists of following basic steps: 1. Write a test for a particular of function. 2. Run all tests to ensure test fails. 3. Write the code that passes the tests, 4. Re-runs and keep updating until test passes, 5. Rewrite the code and 6. Run all tests to see the updated code did not alter the external behavior [2]. The first step, is known as test writing, simply includes writing a piece of code for the purpose of testing the function (functionality) of tasks. The second one is required to confirm that the test is works correctly (i.e., the test must not pass at this point it should fail, because the functionality has not been implemented yet). If the test passes at this phase, the test is not correct and it requires to be rewritten again. The third step involves writing the code in as short segments as possible in order to pass the test. Finally, all tests must be run in order to confirm whether any desired functionality is implemented or not yet. Once all tests pass, the inside structure of the code should be improved through rewriting it again[3]. So, Why TDD (test first)? The trivial question that comes to someone s mind now is why TDD test should come first? To answer this question, one should consider the key advantages behind adopting this model. To summarize, TDD test: ISBN: 978-1-61804-307-8 148
1. Allows capturing the intent of the developer or domain expert (e.g., about RTL languages) 2. Allows thinking about program design 3. Ensures that tests are written (are real) 4. Provides higher quality code and long run: faster (due to having fewer integration problems) 5. Ping Pong Pair Programming-style TDD leads to better distribution of knowledge in team => reduces the truck factor (worst case) Figure 1 show the test driven development cycle diagram[4]. Figure1. Test driven development cycle diagram. TDDs are mostly coded for left to right languages with no consideration for other languages directions like Right to Left languages or top down languages. In this paper, we suggest several issues that would be taken in consideration to develop software applications for RLLs. 2. Literature review Test-driven development (TDD) is a software development process that consist of the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. [4] Software testing is an activity intended for assessing features of a code and guarantees that code meets the essential output. It is often difficult to find all the errors (semantic or syntaxes) in the program. The choice of correct approach at the correct time will make the software testing efficient and effective. [5] A process of running a code with the objective of finding errors is Software Testing. A Software Testing Approach helps to adapt test case designs into a well-planned execution steps that will result in the construction of successful software. Software testing aims at uncovering the errors in software. So the primary goal of test cases is to derive set of tests that have highest probability of uncovering the errors. Software testing is a series of process which is designed to make sure that the computer code does what it was designed to do. Software testing is a destructive process of trying to find the errors. The main purpose of testing can be quality assurance, reliability estimation, validation or verification. [6] Software testing is the process of assessing the code with purpose to check out error in it. Software testing is a method aimed at evaluating an attribute or capability of a code or product and determining that it meets its quality. Software testing is similarly used to test the code for other software quality factors like reliability, usability, integrity, security, capability, efficiency, portability, maintainability, compatibility etc.. [7] Software production includes developing code according to a set of requirements. Software testing is needed to verify and validate that the code built to meet these specifications. [8] Software testing for right to left languages Apps is not deeply and hardly worked by many researchers, so we try on this work to establish for software testing for right to left languages. 3. Problem statement All the TDDs are coded for left to right languages with no consideration for other languages directions like RLLs or top down languages. In this study we will focus on TDD for RTL such as Arabic, Hebrew, Farsi, Urdu, and others. Right-toleft text is supported in common consumer software. Often this support is supposed to be explicitly enabled. Thus, mixing RTL with left-to-right text (bidirectional) is necessary. There are many user interface (UI) points to consider with RTL languages. These components involve the following: Arrow direction ISBN: 978-1-61804-307-8 149
Forms Text fields Dropdown fields (list/menu/jump menu) Scrollbars Data entry fields Checkbox fields Radio buttons Bulleted & numbered lists Buttons Labels Pocket Code: Bricks and formulas Facebook (direction of the post. i.e arrow) 3.1 Why Tests for RTL features? Developers often have little knowledge about how RTL languages are rendered Later changes in the source code (i.e., refactoring) can result in layout problems in other languages, especially RTL, that were already solved in earlier versions Tests are important to document coding decisions relevant to these other languages Automatic tests allow quick locating problems and also to hedge against reoccurring bugs (i.e., regression tests) Figure 3 interface and direction of the text Figure 3 show the interface for mathematical operation in pocket code where the place of x and y is in the left of the interface and it should be in the right position. Figure 4 and 5 show the interface with mathematical operation 4. Test case: An experience report (about facebook, Pocket Code and Scratch) Figure 2 shows a snapshot of pocket code for RLL. Figure 4. User interface for pocket code with mathematic sin() function and the place of x and y is in the left of the interface and it should be in the right position. Pocket code is software used to create applications and games especially for students who use smart phones in school as shown in figure 2. ISBN: 978-1-61804-307-8 150
Figure 5 Researchers and software developers in general as we discussed early, did not consider testing for right to left languages applications. In this work we establish new issues for right to left languages applications that should be considered for testing new developed applications. Using these issues to develop additional new techniques to test RLLs applications is our future goal. 7. Conclusions In figure 5 the pocket code accepts the equation as it appears in the snapshot. As you can see, there is just one opened parenthesis while there are three closed parenthesises, the place of x and y is in the left of the interface, the correct place should be in the right position. Figure 6 shows snapshots from the facebook. The goal of this research is to establish and to consider Test-driven development Issues of right to left language apps as we showed there are many points that should be considered when we develop software for RTL or non left-to-right languages. In this work we discus cases from real working software like pocket code and Facebook, so we have to consider forms, text fields, dropdown fields (list/menu/jump menu), scrollbars, arrow direction, data entry fields,checkbox fields, radio buttons, bulleted, numbered lists, buttons, photo position, labels and places of any object in the interface. References: [1] http://projekter.aau.dk/projekter/files/ 204129305/Report_swd903e13_.pdf (2014) In figure 6, shows the wrong direction of the arrows for RTL and the position of the photo for the left snapshot should be also in the right of the post. 6. Future Work [2] Shrivastava and Jain, "Metrics for Test Case Design in Test Driven Development", International Journal of Computer Theory and Engineering, Vol.2, No.6, December, 2010, Pg: 1793-8201. [3] Shaweta Kumar, Sanjeev Bansal, Comparative Study of Test Driven Development with Traditional Techniques, International Journal of Soft Computing and Engineering (IJSCE) ISSN: 2231-2307, Volume-3, Issue-1, March 2013. [4] http://en.wikipedia.org/wiki/ Test-driven_development. [5] Mohd. Ehmer Khan," Different Forms of Software Testing Techniques for Finding",International Journal of Computer Science Issues, Vol. 7, Issue 3, No 1, May 2010 ISBN: 978-1-61804-307-8 151
[6] Sheetal Thakare, Savita Chavan, Prof. P. M. Chawan," Software Testing Strategies and Techniques ", International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, Volume 2, Issue 4, April 2012) [7] Abhijit A. Sawant, Pranit H. Bari and P. M. Chawan," Software Testing Techniques and Strategies ", International Journal of Engineering Research and Applications (IJERA) ISSN: 2248-9622 www.ijera.com Vol. 2, Issue 3, May-Jun 2012, pp.980-986. [8] Sahil Batra and Dr. Rahul Rishi, "IMPROVING QUALITY USING TESTING STRATEGIES, Journal of Gobal Research in Computer Science, Volume 2,No.6,June 2011. ISBN: 978-1-61804-307-8 152