Code Monkey home page Code Monkey logo

bitrise-step-android-unit-test's Introduction

Android Unit Test

Runs your Android project's unit tests.

How to use this Step

Can be run directly with the bitrise CLI, just git clone this repository, cd into it's folder in your Terminal/Command Line and call bitrise run test.

Check the bitrise.yml file for required inputs which have to be added to your .bitrise.secrets.yml file!

Step by step:

  1. Open up your Terminal / Command Line
  2. git clone the repository
  3. cd into the directory of the step (the one you just git cloned)
  4. Create a .bitrise.secrets.yml file in the same directory of bitrise.yml - the .bitrise.secrets.yml is a git ignored file, you can store your secrets in
  5. Check the bitrise.yml file for any secret you should set in .bitrise.secrets.yml
  • Best practice is to mark these options with something like # define these in your .bitrise.secrets.yml, in the app:envs section.
  1. Once you have all the required secret parameters in your .bitrise.secrets.yml you can just run this step with the bitrise CLI: bitrise run test

An example .bitrise.secrets.yml file:

envs:
- A_SECRET_PARAM_ONE: the value for secret one
- A_SECRET_PARAM_TWO: the value for secret two

How to create your own step

  1. Create a new git repository for your step (don't fork the step template, create a new repository)
  2. Copy the step template files into your repository
  3. Fill the step.sh with your functionality
  4. Wire out your inputs to step.yml (inputs section)
  5. Fill out the other parts of the step.yml too
  6. Provide test values for the inputs in the bitrise.yml
  7. Run your step with bitrise run test - if it works, you're ready

For Step development guidelines & best practices check this documentation: https://github.com/bitrise-io/bitrise/blob/master/_docs/step-development-guideline.md.

NOTE:

If you want to use your step in your project's bitrise.yml:

  1. git push the step into it's repository
  2. reference it in your bitrise.yml with the git::PUBLIC-GIT-CLONE-URL@BRANCH step reference style:
- git::https://github.com/user/my-step.git@branch:
   title: My step
   inputs:
   - my_input_1: "my value 1"
   - my_input_2: "my value 2"

You can find more examples of step reference styles in the bitrise CLI repository.

How to contribute to this Step

  1. Fork this repository
  2. git clone it
  3. Create a branch you'll work on
  4. To use/test the step just follow the How to use this Step section
  5. Do the changes you want to
  6. Run/test the step before sending your contribution
  • You can also test the step in your bitrise project, either on your Mac or on bitrise.io
  • You just have to replace the step ID in your project's bitrise.yml with either a relative path, or with a git URL format
  • (relative) path format: instead of - original-step-id: use - path::./relative/path/of/script/on/your/Mac:
  • direct git URL format: instead of - original-step-id: use - git::https://github.com/user/step.git@branch:
  • You can find more example of alternative step referencing at: https://github.com/bitrise-io/bitrise/blob/master/_examples/tutorials/steps-and-workflows/bitrise.yml
  1. Once you're done just commit your changes & create a Pull Request

Share your own Step

You can share your Step or step version with the bitrise CLI. If you use the bitrise.yml included in this repository, all you have to do is:

  1. In your Terminal / Command Line cd into this directory (where the bitrise.yml of the step is located)
  2. Run: bitrise run test to test the step
  3. Run: bitrise run audit-this-step to audit the step.yml
  4. Check the share-this-step workflow in the bitrise.yml, and fill out the envs if you haven't done so already (don't forget to bump the version number if this is an update of your step!)
  5. Then run: bitrise run share-this-step to share the step (version) you specified in the envs
  6. Send the Pull Request, as described in the logs of bitrise run share-this-step

That's all ;)

Trigger a new release

  • merge every code changes to the master branch
  • push the new version tag to the master branch

bitrise-step-android-unit-test's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bitrise-step-android-unit-test's Issues

Failed to fetch variants, error: Incremental java compilation is an incubating feature.

Hi there,

I am having a bit of a problem. I get the following error during the android build


Variants:
Failed to fetch variants, error: Incremental java compilation is an incubating feature.
FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':app'.

java.lang.NullPointerException (no error message)

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

I tried the stacktrace option and it does not give me any extra information.

Please help.

Failed to fetch variants

Issue description

Recent build are not fetching variants. Also we didn't change anything on configuration. Please help to us.

Bitrise info


| (5) Run Unit Tests & Jacoco                                                  |
+------------------------------------------------------------------------------+
| id: android-unit-test                                                        |
| version: 1.0.6                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: go                                                                  |
| time: 2022-06-27T02:33:34Z                                                   |
+------------------------------------------------------------------------------+
|                                                                              |
Configs:
- ProjectLocation: .
- HTMLResultDirPattern: *build/reports/tests
- XMLResultDirPattern: *build/test-results
- Variant: StagingDebug
- Module: 
- Arguments: jacocoTestReport
- CacheLevel: only_deps
- IsDebug: false
- DeployDir: /bitrise/deploy
- TestResultDir: /tmp/test_results374987698/test_result927390709
Variants:
Run: failed to fetch variants, error: Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01

[Feature Request] Support for testing multiple variants on the same step

Currently we can either not pass a variantFilter, in which case all variants are tested, or pass a filter to test a single variant.
In our case we have multiple product flavors and each has a debug and release build. I'd like to be able to test all the debug variants for my product, right now I use the test step multiple times.
I'd would be nice if instead of passing a single filter, I could pass a list of variants or a regex.

Failed to fetch variants

Hello. I have a problem:

+------------------------------------------------------------------------------+
| (5) [email protected]                                                  |
+------------------------------------------------------------------------------+
| id: android-unit-test                                                        |
| version: 0.9.0                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: go                                                                  |
| time: 2018-04-20T17:36:56Z                                                   |
+------------------------------------------------------------------------------+
|                                                                              |
Configs:
- ProjectLocation: Project
- ReportPathPattern: *build/reports
- ResultPathPattern: *build/test-results
- Variant: devDebug
- Module: app
- Deploy dir: /bitrise/deploy
Variants:
Failed to fetch variants, error: FAILURE: Build failed with an exception.
* What went wrong:
Project 'app' not found in root project 'src'.

Please help.

Build failing with the latest version

After updating to 0.10.0 the step fails at the end with:

Export test results for test addon:
panic: runtime error: index out of range
goroutine 1 [running]:
main.getUniqueDir(0xc00030dc20, 0x56, 0xc00001e1a8, 0x2f, 0xc000020600, 0xd)
	/tmp/bitrise-go-toolkit393823558/src/github.com/bitrise-steplib/bitrise-step-android-unit-test/testaddon.go:30 +0x628
main.main()
	/tmp/bitrise-go-toolkit393823558/src/github.com/bitrise-steplib/bitrise-step-android-unit-test/main.go:215 +0x142a

Works fine on 0.9.6

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.