Set of utilities to extend the espresso testing framework
Word origin: Crema is the foam that makes espresso delicious.
STEP 1: Download crema.jar from Releases and paste to your lib folder.
STEP 2: Next, you need to add a test compile dependency to your app's build.gradle
dependencies {
// Testing-only dependencies
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile files('libs/crema-1.0.jar')
}
STEP 3: Finally, add EspressoPlus.* matchers in your test.
import static com.checkdroid.crema.EspressoPlus.*;
With Crema, we want to bring a library of new matchers and assertions to espresso.
As of now, crema has the following:
- XPath Matchers: Crema has 2 implementations of xPath Matchers
withXPath(String xPath)
withXPath2(String xPath)
- Taking screenshots in tests: Saves screenshots as
/sdcard/{filename}_{timestamp}.png
takeScreenshot()
- default file name is package nametakeScreenshot(String filename)
takeScreenshot(boolean timestamp)
- timestamp is not added if falsetakeScreenshot(String file, boolean addTimestamp)
- Fetchers
TextFetcher
class to get the text contained in a particular nodeViewTreeFetcher
class to get the espresso view tree (different from UIAutomator view tree)- More coming soon..
- Got any issues/problems with crema?
- Any other matchers/assertious you would like?
Please create new issues on github to reach out to us!
Signup for updates here: http://checkdroid.com/updates