Testing - ivancrg/vis.it GitHub Wiki

Page description

This page explains testing conducted on vis.it project. Brief explanation for each test is provided.

Test - register information validation (issue #82)

Tests informationValidation method located in RegisterFragment.java.

Bugs found

Bug linked to not checking whether any of the 5 EditText arguments is null - resolved by adding editText == null to if statements

CSV file content

CSV file contains arguments for validation method and the expected result from validator method considering the given arguments.

File is structured as follows: firstName,lastName,email,username,password,expectedResult

  • Lines [2, 7]
    • Manually added test files
  • Lines [8, 507]
    • Generated test files via codebeutify with expected true result
    • Some cases were intentionally meddled with to generate some false results (for example deleting some values, deleting all numbers from passwords, changing expected results etc.)
  • Lines [508, 707]
    • Checks invalid password entries generated via codebeutify with expected false results
    • Some entries have other fields intentionally invalidated too
  • Lines [708, 807]
    • Entries with faulty e-mails (no @ sign) with expected false results
    • Some entries have other fields intentionally invalidated too
  • Lines [808, 907]
    • Entries with faulty e-mails (no dot after @ sign) with expected false results
    • Some entries have other fields intentionally invalidated too
  • Lines [908, 1007]
    • Entries with faulty e-mails (no content before @ sign) with expected false results
    • Some entries have other fields intentionally invalidated too

Test - connection to backend (issue #83)

Tests whether connection to backend can be established with Retrofit2.

Bugs found

No bugs found in used connection process

CSV file content

CSV file contains argument for connection testing method and the expected result from connection testing method considering the given argument.

File is structured as follows: string sent to server,expected string to be received from server

  • Lines [2, 102]
    • 4-char length connection test strings
  • Lines [102, 202]
    • 8-char length connection test strings
  • Lines [202, 302]
    • 16-char length connection test strings
  • Lines [302, 402]
    • 32-char length connection test strings
  • Lines [402, 502]
    • 64-char length connection test strings
  • Lines [502, 1002]
    • 128-char length connection test strings

Test - converting city names to geographical coordinates (issue #84)

Tests whether coordinates correspond to cities by using a pre-defined .csv file and Geocoder.

Bugs found

During testing, I naturally expected some offsets between expected and converted coordinates. However, while the threshold was set to 25km, some citie's coordinates were missed by thousands of kilometers. That being said, adding the country to the Geocoder request makes conversion much more precise and it solved all my problems. We should maybe think about adding the country to queries in our application as well.

CSV file content and test outline

CSV file contains arguments for city-coordinates conversion testing method (cityCoordConversionTest). City-coordinates conversion method uses testDataRead method to read the test data from CSV file located in assets folder. As the test was set up as Parameterized, each line of the CSV file makes a separate test. I couldn't get @CsvFileSource tag to work, so I made my own CSV reading function. Test data was provided by simplemaps.

CSV file is structured as follows: city,country,lat,lng

  • Lines [2, 209]
    • Capital city, appropriate country, appropriate latitude, appropriate longitude

Test - inserting trips to database (issue #85)

Tests whether trips are inserted to the database in a correct way by inserting and reading trips from the database using Retrofit2.

Bugs found

No bugs found in used trip insertion process

CSV file content and test outline

CSV file contains arguments for trip insertion testing method (databaseTripInsertion). Trip insertion method uses checkTripById method to check whether the inserted trip actually corresponds to the trip object we sent to the server. afterAll method deletes all tests inserted to database during the test.

CSV file is structured as follows: country,city,location,travelling_mode,date_of_departure_year,date_of_departure_month,date_of_departure_day,necessities,creator,participants_description

  • Lines [2, 76]
    • Random country, random city, random string representing location, radnom travelling mode, random date of departure year, random date of departure month, random date of departure day, random string representing necessities, creator username "testUser", random string representing participants description