Write GDSL script
status:update 25 nov 2024
After defining a functional journey, it’s time to write!
Download the template available on Gitlab Greenspector Studio/ Examples
Choose the appropriate file for your project: Web, Android, iOS
Move them in a project folder
Modify
[PACKAGE]
by the package name of your application, as the example below:
applicationKill,com.facebook.katana
applicationStart,com.facebook.katana
To learn about GDSL script structure, go on Introduction to GDSL
To launch the application
Measure reference inactivity on home screen
Launch the application
Wait for the last element to display (
waitUntil
)
measureStart,PAUSE_reference
pause,${PAUSEDURATION}
measureStop
measureStart,CHRGT_homePage
applicationStart,com.google.android.youtube
waitUntilText,Home
pause,${PAUSEAFTERLOAD}
measureStop
To launch a website:
Launch the browser (
setBrowser
)Prepare the browser by clearing cache and history (
browserPrepareAndOpenForReference
)Measure the reference inactivity of an empty tab
Writing of URL (
browserGoToUrl
)Measure the load of the website validating the URL (
pressEnter
)Wait for the last element to display (
waitUntil
)
setBrowser,chrome
applicationKill,com.android.chrome
browserPrepareAndOpenForReference
measureStart,PAUSE_referenceBrowser
pause,${PAUSEDURATION}
measureStop
browserGoToUrl,https://metropole.nantes.fr
measureStart,CHRGT_homePage
pressEnter
waitUntilText,accept all
pause,${PAUSEAFTERLOAD}
measureStop
If, on installation, the application displays windows that do not appear in the follo
Solution 1 : It is mandatory to automate this process if you are going to use the testbench.
Solution 2 : switch to testrunner mode with local device to avoid reinstalling the application at each iteration
For each new view/page :
Do the action allowing to change view (
clickBy
)Wait for the last element to display (
waitUntil
)Verify the element waited doesn’t already exist before change view (
assertNotExists
)Implement a pause step to measure inactive state
assertNotExistsText,Enjoy your favourite videos
measureStart,CHRGT_libraryTab
clickByTextExact,Library
waitUntilTextExact,Enjoy your favourite videos
pause,${PAUSEAFTERLOAD}
measureStop
measureStart,PAUSE_libraryTab
pause,${PAUSEDURATION}
measureStop
To get element characteristics in a view, go on Get elements of a view (Android)
For an action (click, write text, ..) or scroll :
Do 3 actions maximum in one measure
Separate them by appropriate pause (
PAUSEAFTERACTION
andPAUSEAFTERSCROLL
)
Action :
measureStart,ACTION_homePage_writeResearch
clickByPercent,80,5
pause,${PAUSEAFTERACTION}
enterText,greenspector
pause,${PAUSEAFTERLOAD}
measureStop
Scroll :
measureStart,SCROLL_videos
swipeVertical,90,10,50
pause,${PAUSEAFTERSCROLL}
swipeVertical,10,90,50
pause,${PAUSEAFTERLOAD}
measureStop
For end technical steps (reliable for apps)
Come back on device home to measure app activity in background in a pause (
pressHome
)Measure app activity after user close in a pause (
applicationCloseAll
)Measure app activity after forced close (process close) in a pause (
applicationKill
)
pressHome
measureStart,PAUSE_appBackground
pause,${PAUSEDURATION}
measureStop
applicationCloseAll
measureStart,PAUSE_afterUserClose
pause,${PAUSEDURATION}
measureStop
applicationKill,com.android.chrome
measureStart,PAUSE_afterForcedClose
pause,${PAUSEDURATION}
measureStop
To implement good practices check : Best practices and tips