The previous part of this article outlined the steps that will come in handy when testing an application using the tools necessary during software development. It was learning a few terminal commands that allow moving between directories, basic commands of the git version control system, the rules of this system and a look at a fragment of the GitLab environment interface. This part will be about getting to know the process of building a project locally through Xcode and practical examples related to learning how to work with and understand code to mocking data. This article is mainly aimed at iOS testers using macOS.
Tip:
You can make managing Xcode versions much easier for yourself by using the [xcversion tool](https://github.com/xcpretty/xcode-install#readme)
Steps to be followed to build and open a project in Xcode:
Once you have an open project in Xcode substantial to begin with, there are really only a few options. The first step after opening it should be to use the command⌘ + B shortcut to build the project and see if Xcode shows any errors. The second step is to select the simulator or connected device to the computer. The third step is to use the project launch button. The main options are described below in the picture.
Mocking data in the code (simulating a certain part of the code in such a way that it produces a result specified by you) - In this task it will be changing the default timeout value (15 minutes) to a shorter one (2 minutes). This will save a lot of time if you have to repeat the test multiple times.
**Description: **
The timer counts down the time the image is displayed. In the case of our project, the default is 15 minutes. This time is set in the application and not by the API, so we are able to change its value in the code for the test.
Expected Result:
While being at the beginning of the adventure with mocking data and having no programming knowledge, it is difficult to move around the project code on your own. So before you start testing, it's best if the developer gives you some helpful information about where in the code you need to change a value to get the desired effect. In this exercise these will be:
Tip:
An easy way to search is to use the shortcut Shift + command + O, which will open the "Open quickly" bar. By using this option, you can easily search for interesting files, objects and even functions etc. and open them immediately.
In our exercise, you need to change the value of the variable from fifteenMinutes to twoMinutes.
What this variable looks like in the code when you open the project:
private var timeRemainingAtTheStart:
TimeInterval = .fifteenMinutes
What this variable looks like after the swap:
private var timeRemainingAtTheStart:
TimeInterval = .twoMinutes
After making this change, you build the project (using the command⌘ + B shortcut) and then open it locally or in the simulator (using the project launch button on the top panel in Xcode). The timer should indicate 2 minutes to go and blink red. After 2 minutes, the image will disappear. Do not close Xcode and the terminal because you will need them for the next task.
Attention!
Naming in a project requires special attention. Folders, files, objects, methods, etc. should be named by developers in an understandable way that is consistent with their use. More importantly, the name must reflect the functionality for which it has been created. Once the tester starts using the code in their work, they should give feedback to the developers about the incomprehensible name, which should be changed.
A tester who wants to shorten the time of giving feedback to a developer about the quality of software, can test the version in the repository from the branch where the feature or bug fix is being worked on. However, remember to check these changes again when the version is released on a branch where complete functionality is ready for testing, such as "Develop". This is important because integration issues may arise with new, different code changes.
**Description: **
After locking the data in task one, currently the image in the application displays for 2 minutes. The clock blinks red and counts down this time.
Expected Result:
The first step you need to take is to open the GitHub platform. This project has never been released to a service that allows you to download testing versions of mobile applications like firebase. Therefore, you will only need the name of the branch (in case it has been released then you need the version number). With GitHub open with a given repository, in the code tab, select tab branches and then active branches. Under active branches you should find and copy the name of the branch, which contains the feature you need. Once you have it, open the console and, without changing anything, type "git checkout feat/surprise" and confirm with enter. The project should automatically update itself. Follow the same steps again as described in step 3 under "Xcode" to open the project. You end up seeing 2 minutes to go on the clock and blinking red. After 2 minutes, a gift is shown instead of a picture.
After testing, when you want to return to the location from which you moved to the feat/surprise branch, you need to type "git checkout master". At the very end, you can remove all your changes irretrievably by typing "git clean -fd". However, if you want to keep the changes temporarily in the clipboard, type "git stash" and to restore them, type "git stash pop".
All three parts of this article should help you get into the technical world of testing easily. The whole thing has been created as a part of the leadership at our company between a tester and an iOS developer. This section contains exercises and some tips to put into practice. Learning more about how the Xcode editor works and how to work with the code itself can allow you to test features in a different way than before. Additionally, the knowledge gained and the communication with the developer will increase the efficiency of the process itself.
If you haven't had a chance to read the previous parts of this article, you can make up for it by going to Part 1 or Part 2 of this article.