Mission: You will learn how to test your application using automated testing.
Specification: In this lab, you will implement automated testing in your app so you will not have to do everything manually when testing your application.
- If you are starting this lab from scratch, download the initial file and get your API key from your appcelerator dashboard and added it to the tiapp.xml. Then, config your Node ACS Server, refer to Lab 8, steps 7,8 and 9 for more information.
- In Studio, select your project, and then you want to launch it with the "Test" option and choose the device or emulator you want to run it on.
- Follow the directions to start testing your app, and you will be presented with a screen like the one below on your emulator or device.
- Go to the Appcelerator Dashboard and choose the app you want to test. Then go to "Test" section.
- Go to the "Clips" section, and now we will record a clip that we will be able to play back later. Click the "New test clip" option and that will take you to the clip editor screen.
- Now click the record options drop down and select "Record mobile app". You will be asked to select a device, and an app to test. Select the device or emulator you registered earlier, and select "My Stocks" from the list of apps.
- The My Stocks application should now appear on the device or emulator. We want to make a clip for the login functionality. Click the top left button and the login screen should appear. Enter your username and password and then an alert should be shown, telling you that you are logged in. Back on the clip editor screen we want to make sure that alert is displayed so we can verify that the user is logged in.
- You should see the actions you took in the app in the clip editor screen on the dashboard. Click the last action (it should be where you clicked the "login" button) and then click the green checkmark that appears. We want to verify that the proper alert was displayed, so the command should be "verify element present". Now select the first option next to locator that looks like a popup. This lets you select the text in the alert dialog so it can verify the text says "You are logged in".
- Now end the recording by pressing the record button again.
- You can play this clip back by pressing the green play button next to the record button to verify that the clip works (make sure you are logged out in the app before trying it).
- Experiment with recording other actions in the application.
- After recording and laying out clips, your screen should look something like this.
- You can use the compositions page to set up and play multiple clips in a row. After playing these clips, you will be able to see if they passed or failed, and if something did fail, you will see exactly what went wrong.