alexander-kulikovskii / toster

Licence: Apache-2.0 license
DSL framework for testing Android apps

Programming Languages

kotlin
9241 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to toster

Qtools
QTools collection of open source tools for embedded systems development on Windows, Linux and MacOS
Stars: ✭ 64 (+106.45%)
Mutual labels:  unit-testing, test-automation, testing-tools
Stryker4s
Mutation testing for Scala. Work in progress...
Stars: ✭ 118 (+280.65%)
Mutual labels:  unit-testing, test-automation, testing-tools
Wasmite
Now WebAssembly has proper testing, unit-testing and debugging 🤗
Stars: ✭ 20 (-35.48%)
Mutual labels:  unit-testing, test-automation, testing-tools
Zunit
A powerful testing framework for ZSH projects
Stars: ✭ 140 (+351.61%)
Mutual labels:  unit-testing, test-automation, testing-tools
extensiveautomation-server
Extensive Automation server
Stars: ✭ 19 (-38.71%)
Mutual labels:  adb, test-automation, testing-tools
eat
Json based scenario testing tool(which can have test for functional and non-functional)
Stars: ✭ 41 (+32.26%)
Mutual labels:  unit-testing, test-automation, testing-tools
Argus Eyes
A lightweight commandline tool for visual regression testing of UI components.
Stars: ✭ 158 (+409.68%)
Mutual labels:  screenshot, test-automation, testing-tools
Automation Arsenal
Curated list of popular Java and Kotlin frameworks, libraries and tools related to software testing, quality assurance and adjacent processes automation.
Stars: ✭ 105 (+238.71%)
Mutual labels:  unit-testing, test-automation
Runtimeunittesttoolkit
CLI/GUI Frontend of Unity Test Runner to test on any platform.
Stars: ✭ 150 (+383.87%)
Mutual labels:  unit-testing, testing-tools
allure-nunit
Archived - Allure adapter for NUnit framework.
Stars: ✭ 45 (+45.16%)
Mutual labels:  test-automation, testing-tools
Truth
Fluent assertions for Java and Android
Stars: ✭ 2,359 (+7509.68%)
Mutual labels:  unit-testing, testing-library
Junit Extensions
JUnit5 extensions library including JUnit5 equivalents of some of the common JUnit4 rules: ExpectedException, TemporaryFolder etc
Stars: ✭ 39 (+25.81%)
Mutual labels:  unit-testing, testing-tools
Acutest
Simple header-only C/C++ unit testing facility.
Stars: ✭ 170 (+448.39%)
Mutual labels:  unit-testing, testing-tools
Simple Headless Chrome
Simple abstraction to use Chrome as a Headless Browser with Node JS
Stars: ✭ 216 (+596.77%)
Mutual labels:  unit-testing, testing-tools
Vstest Docs
Documentation for the Visual Studio Test Platform.
Stars: ✭ 165 (+432.26%)
Mutual labels:  unit-testing, testing-tools
Mocktopus
Mocking framework for Rust
Stars: ✭ 179 (+477.42%)
Mutual labels:  unit-testing, testing-tools
Ghpr.nunit
Adapter for NUnit 3 (generate HTML report for NUnit 3)
Stars: ✭ 33 (+6.45%)
Mutual labels:  screenshot, test-automation
puppeteer-screenshot-tester
Small library that allows us to compare screenshots generated by puppeteer in our tests.
Stars: ✭ 50 (+61.29%)
Mutual labels:  screenshot, testing-tools
Droidcast
An experimental demo for capturing and displaying screenshot of an Android device without ROOT permission.
Stars: ✭ 116 (+274.19%)
Mutual labels:  screenshot, adb
Deepstate
A unit test-like interface for fuzzing and symbolic execution
Stars: ✭ 603 (+1845.16%)
Mutual labels:  unit-testing, testing-tools

License Build DSL Codecov Pitest

toster

Small test dsl based on adb commands that allows you to test the mobile application close to user actions

Toster

How to install

Add next fields in your root build.gradle file:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Add the dependency:

dependencies {
    implementation 'by.epicbot:toster:{version}'
}

Usage

To use Toster DSL you need to create unit tests extended from the TosterTest class and configure Config and Screens.

You can run it using console command:

./gradlew :project:test

If you want to run it from Android Studio, don't forgot to install Kotest plugin:

Here's a full list of available functionality of Toster:

class DemoTest : TosterTest(
   Config {
       applicationName("Samples")
       applicationPackageName("fi.epicbot.toster.samples")
       apkUrl("build/outputs/apk/debug/samples-debug.apk")
       permissions {
           grant("PERMISSION")
           grant("ANOTHER_PERMISSION")
       }
       devices {
           emulator("Pixel_3a_API_31_arm64-v8a")
           phone("123456789")
       }
       fontScaleForAll(FontScale.LARGE)
       emulatorPath("android-sdk/emulator")
       clearDataBeforeEachRun()
       runShellsBeforeAllScreens("SHELL_COMMAND_BEFORE_ALL", "SHELL_COMMAND_BEFORE_ALL_2")
       runShellsAfterAllScreens("SHELL_COMMAND_AFTER_ALL", "SHELL_COMMAND_AFTER_ALL_2")
   }
   Screens{
       screen{
           name("First screen")
           url("fi.epicbot.toster.samples.SampleFontSizeActivity")
           shortUrl("SampleFontSizeActivity") // optional
           delayAfterOpenMillis(4500L)
           runShellsBefore("SOME_COMMAND", "ANOTHER_COMMAND")
           runShellsAfter("SOME_COMMAND", "ANOTHER_COMMAND")
           clearDataBeforeRun()
           activityParams {
               integer("int_value", 42)
               string("string_value", "42")
               long("long_value", 42L)
               boolean("boolean_value", true)
               float("float_value", 42.0f)
           }
           permissions {
               revoke("PERMISSION_1")
               grand("PERMISSION_2")
           }
           fontScale(FontScale.SMALL)
           resetGfxInfoBeforeStart()
           actions {
               delay(1000L)
               click(x, y)
               swipe(SwipeMove.BottomToTop, delayMillis = 500)
               takeMemoryAllocation()
               takeScreenshot("name")
               runShell("COMMAND")
               takeGfxInfo()
           }
       }
   }
)

Config

Application name

Set any name for your project. All output data will be in build/toster/APPLICATION_NAME

applicationName("Samples")

Application package name

Package name that you can find in manifest file.

Apk url

Path to your apk file.

Permissions

Toster doesn't install apk with flag -p and set them all because for some screens you can revoke them or call clear data.

In the block Config you can only grant permissions:

permissions {
   grant("PERMISSION")
   grant("ANOTHER_PERMISSION")
   ...
}

Block Screen allows grant and revoke permissions:

permissions {
   grant("PERMISSION")
   ...
   revoke("ANOTHER_PERMISSION")
   ...
}

Devices

Specify all devices, including their IDs, on which the tests will be performed.

To find ID for specific device you can use adb command adb devices.

devices {
   emulator("Pixel_3a_API_31_arm64-v8a")
   ...
   phone("123456789")
   ...
}

Note: You can use UUID if you have only one device.

Font scale for all

To set up the font scale for the whole screen you can use fontScale(value) command.

Available font scales:

  • SMALL (0.85)
  • DEFAULT (1.0)
  • LARGE (1.15)
  • LARGEST (1.3)

Density

To set up the screen density you can use setScreenDensity(value) command inside Config or Screen context.

Available densities:

  • LDPI (120 dpi)
  • MDPI (160 dpi)
  • HDPI (240 dpi)
  • XHDPI (320 dpi)
  • XXHDPI (480 dpi)
  • XXXHDPI (640 dpi)
  • TVDPI (213 dpi)
  • CUSTOM - for any custom dpi

Screen size

To set up the screen size you can use setScreenSize(width, height) command inside Config or Screen context.

Emulator path

Path to emulator in your sdk folder.

Clear data before each run

Clear application data before each run. All permissions will be removed.

Run shell before all screens

Run shell script before all screens. For example, you can build a special flavor of your app.

Run shell after all screens

Run shell script after all screens. For example, you can send some analytics to the backend or make work on CI.

Overdraw

To set up overdraw mode for the all screens you can use checkOverdraw() function.

Sample output for this mode:

Normal Overdraw

Screen

Name

Unique name for the screen.

Url

Full url for your activity including package name.

Delay after open

It's very important to set delays between actions, because the whole test system doesn't know about callbacks.

Run shell before

Same as shellBeforeAllScreens. It runs some script before this screen. For example, you can prepare some data for this screen.

Run shell after

Same as above. Runs after this screen.

Clear data before

Clear application data only before this screen.

Clear apps in tray

Clear all apps in tray before this screen

Output reports

By default, after all tests you will get a json file with all actions that test done. It is generated with a default reporter. You can disable it, changing it in block Config -> report:

Config {
   ...
   report {
       enable(true|false)
   }
   ...
}

Or you can even add your own reporter:

Config {
   ...
   report {
       addCustomReporter(MyAwesomeReporter)
   }
   ...
}

To implement your own reporter just extends from interface Reporter:

 
class MyAwesomeReporter : Reporter {
 
   override fun makeReport(reportOutput: ReportOutput, shellExecutor: ShellExecutor) {
       // Implementation
   }
}
 

You will get raw ReportOutput with all information about screens and actions, path to all screenshots, memory measurements (if applicable) and shellExecutor if it's necessary to run some commands (save report, send somewhere to backend, etc.).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].