+ All Categories
Home > Documents > Mobile Application Development MyRent Tester …...2016/11/01  · Mobile Application Development...

Mobile Application Development MyRent Tester …...2016/11/01  · Mobile Application Development...

Date post: 25-Jun-2020
Category:
Upload: others
View: 3 times
Download: 0 times
Share this document with a friend
14
Mobile Application Development MyRent Tester (JUnit) Waterford Institute of Technology November 1, 2016 John Fitzgerald Waterford Institute of Technology, Mobile Application Development MyRent Tester (JUnit) 1/14
Transcript
Page 1: Mobile Application Development MyRent Tester …...2016/11/01  · Mobile Application Development MyRent Tester (JUnit) WaterfordInstituteofTechnology November1,2016 JohnFitzgerald

Mobile Application DevelopmentMyRent Tester (JUnit)

Waterford Institute of Technology

November 1, 2016

John Fitzgerald

Waterford Institute of Technology, Mobile Application Development MyRent Tester (JUnit) 1/14

Page 2: Mobile Application Development MyRent Tester …...2016/11/01  · Mobile Application Development MyRent Tester (JUnit) WaterfordInstituteofTechnology November1,2016 JohnFitzgerald

JUnit TesterLearning objectives

• How to create basic JUnit test app?• How to use Retrofit to enable tester-service communication?

Waterford Institute of Technology, Mobile Application Development MyRent Tester (JUnit) 2/14

Page 3: Mobile Application Development MyRent Tester …...2016/11/01  · Mobile Application Development MyRent Tester (JUnit) WaterfordInstituteofTechnology November1,2016 JohnFitzgerald

MyRent service appJUnit test - service

Waterford Institute of Technology, Mobile Application Development MyRent Tester (JUnit) 3/14

Page 4: Mobile Application Development MyRent Tester …...2016/11/01  · Mobile Application Development MyRent Tester (JUnit) WaterfordInstituteofTechnology November1,2016 JohnFitzgerald

MyRent test appUse to test service before client dev

• Create a Play app.• Customize models

and test classes.• No user interface.• No JPA relationships.• Service uses Gson

converters:• Json to Residence.• Residence to Json.

Waterford Institute of Technology, Mobile Application Development MyRent Tester (JUnit) 4/14

Page 5: Mobile Application Development MyRent Tester …...2016/11/01  · Mobile Application Development MyRent Tester (JUnit) WaterfordInstituteofTechnology November1,2016 JohnFitzgerald

ModelRefactor Residence model class

• Override Object.equals

Waterford Institute of Technology, Mobile Application Development MyRent Tester (JUnit) 5/14

Page 6: Mobile Application Development MyRent Tester …...2016/11/01  · Mobile Application Development MyRent Tester (JUnit) WaterfordInstituteofTechnology November1,2016 JohnFitzgerald

HTTP ClientRetrofit integration requires API & proxy classes

• API & Proxy classes

Waterford Institute of Technology, Mobile Application Development MyRent Tester (JUnit) 6/14

Page 7: Mobile Application Development MyRent Tester …...2016/11/01  · Mobile Application Development MyRent Tester (JUnit) WaterfordInstituteofTechnology November1,2016 JohnFitzgerald

HTTP ClientRetrofit integration requires API & proxy classes

• API class

Waterford Institute of Technology, Mobile Application Development MyRent Tester (JUnit) 7/14

Page 8: Mobile Application Development MyRent Tester …...2016/11/01  · Mobile Application Development MyRent Tester (JUnit) WaterfordInstituteofTechnology November1,2016 JohnFitzgerald

HTTP ClientRetrofit integration requires API & proxy classes

• API class

Waterford Institute of Technology, Mobile Application Development MyRent Tester (JUnit) 8/14

Page 9: Mobile Application Development MyRent Tester …...2016/11/01  · Mobile Application Development MyRent Tester (JUnit) WaterfordInstituteofTechnology November1,2016 JohnFitzgerald

HTTP ClientRetrofit integration requires API & proxy classes

• Proxy class

Waterford Institute of Technology, Mobile Application Development MyRent Tester (JUnit) 9/14

Page 10: Mobile Application Development MyRent Tester …...2016/11/01  · Mobile Application Development MyRent Tester (JUnit) WaterfordInstituteofTechnology November1,2016 JohnFitzgerald

MyRent service appRoutes - API

Test client app communicates with service using these patterns:

Waterford Institute of Technology, Mobile Application Development MyRent Tester (JUnit) 10/14

Page 11: Mobile Application Development MyRent Tester …...2016/11/01  · Mobile Application Development MyRent Tester (JUnit) WaterfordInstituteofTechnology November1,2016 JohnFitzgerald

MyRent test codeSkeleton class

public class ResidenceTest {

@Beforepublic void setup() throws Exception {

}

@Afterpublic void teardown() throws Exception {

}

@Testpublic void getResidences() throws Exception {

}. . .

}

Waterford Institute of Technology, Mobile Application Development MyRent Tester (JUnit) 11/14

Page 12: Mobile Application Development MyRent Tester …...2016/11/01  · Mobile Application Development MyRent Tester (JUnit) WaterfordInstituteofTechnology November1,2016 JohnFitzgerald

MyRent test codeSample test method

Retrieve all residence records over network & test

Waterford Institute of Technology, Mobile Application Development MyRent Tester (JUnit) 12/14

Page 13: Mobile Application Development MyRent Tester …...2016/11/01  · Mobile Application Development MyRent Tester (JUnit) WaterfordInstituteofTechnology November1,2016 JohnFitzgerald

ReferencesPlay Framework JUnit Test application

1.Play: Testing your applicationhttps://goo.gl/1gbzlH [Accessed 2016-10-30]

Waterford Institute of Technology, Mobile Application Development MyRent Tester (JUnit) 13/14

Page 14: Mobile Application Development MyRent Tester …...2016/11/01  · Mobile Application Development MyRent Tester (JUnit) WaterfordInstituteofTechnology November1,2016 JohnFitzgerald

Waterford Institute of Technology, Mobile Application Development MyRent Tester (JUnit) 14/14


Recommended