Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feature/agoda-andr…
Browse files Browse the repository at this point in the history
…oid-76

# Conflicts:
#	buildSrc/src/main/kotlin/Versions.kt
  • Loading branch information
karthyks committed Jan 22, 2024
2 parents e69c212 + 034a996 commit ddb3313
Show file tree
Hide file tree
Showing 1,182 changed files with 36,550 additions and 8,693 deletions.
4 changes: 2 additions & 2 deletions .buildsystem/deploy-github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ fi

ASSEMBLE_TARGETS=""
PUBLISH_TARGETS=""
for i in ":core" ":vendor:vendor-android" ":marathon-gradle-plugin" ":report:execution-timeline" ":report:html-report" ":analytics:usage" ":configuration"; do
for i in ":core" ":vendor:vendor-android" ":report:execution-timeline" ":report:html-report" ":analytics:usage" ":configuration"; do
ASSEMBLE_TARGETS="$ASSEMBLE_TARGETS $i:assemble"
PUBLISH_TARGETS="$PUBLISH_TARGETS $i:publishDefaultPublicationToGitHubRepository"
PUBLISH_TARGETS="$PUBLISH_TARGETS $i:publishAllPublicationsToGitHubRepository"
done

if [ -n "$GIT_TAG_NAME" ]; then
Expand Down
4 changes: 2 additions & 2 deletions .buildsystem/deploy-sonatype.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ fi

ASSEMBLE_TARGETS=""
PUBLISH_TARGETS=""
for i in ":core" ":vendor:vendor-android" ":marathon-gradle-plugin" ":report:execution-timeline" ":report:html-report" ":analytics:usage" ":configuration"; do
for i in ":core" ":vendor:vendor-android" ":report:execution-timeline" ":report:html-report" ":analytics:usage" ":configuration"; do
ASSEMBLE_TARGETS="$ASSEMBLE_TARGETS $i:assemble"
PUBLISH_TARGETS="$PUBLISH_TARGETS $i:publishDefaultPublicationToOSSHRRepository"
PUBLISH_TARGETS="$PUBLISH_TARGETS $i:publishAllPublicationsToOSSHRRepository"
done

if [ -z "$GIT_TAG_NAME" ]; then
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: deliver gradle plugin
run: ./gradlew :marathon-gradle-plugin:publishPlugins -Pgradle.publish.key=$GRADLE_PUBLISH_KEY -Pgradle.publish.secret=$GRADLE_PUBLISH_SECRET
run: ./gradlew :marathon-gradle-plugin:publishPlugins -Pgradle.publish.key=$GRADLE_PUBLISH_KEY -Pgradle.publish.secret=$GRADLE_PUBLISH_SECRET -PreleaseMode=RELEASE
env:
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
Expand Down
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
.idea/modules
.idea/.name
.idea/compiler.xml
.idea/kotlinc.xml
.idea/misc.xml
.idea/modules.xml


# Generated files
.idea/**/contentModel.xml
Expand All @@ -28,6 +35,8 @@
.idea/**/gradle.xml
.idea/**/libraries

**/local.properties

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
Expand Down Expand Up @@ -275,4 +284,4 @@ DerivedData
*.ipa
*.xcuserstate
*.profraw
sample/ios-app/Marathondevices
sample/ios-app/Marathondevices
27 changes: 27 additions & 0 deletions .idea/runConfigurations/android_test_gradle_plugin.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions ADOPTERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ can [add it in a PR!](https://github.com/MarathonLabs/marathon/edit/develop/ADOP
* [Wink](https://wink.ru)
* [VTB](https://www.vtb.ru)
* [CFT](https://www.cft.ru)
* [DM-TECH](https://dmtech.team)
* [Aetna](https://www.aetna.com)
* [CVS Health](https://www.cvshealth.com)
* [PITS Global Data Recovery Services](https://www.pitsdatarecovery.net/)
181 changes: 157 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,166 @@
[![codecov](https://codecov.io/gh/malinskiy/marathon/branch/develop/graph/badge.svg)](https://codecov.io/gh/malinskiy/marathon)
[![Slack](https://img.shields.io/badge/slack-chat-green.svg?logo=slack&longCache=true&style=flat)](https://bit.ly/2LLghaW)
[![Telegram](https://img.shields.io/static/v1?label=Telegram&message=RU&color=0088CC)](https://t.me/marathontestrunner)
<h1 align="center">
<img src="docs/static/img/marathon-banner.svg" alt="Marathon Logo" />
</h1>

# Marathon
Cross-platform test runner written for Android and iOS projects
<div align="center">

## Main focus
- **stability** of test execution adjusting for flakiness in the environment and in the tests.
- **performance** using high parallelization (handling dozens of devices)
[![GitHub release][img-version-badge]][repo] [![Slack][img-slack-badge]][slack] [![Telegram][img-telegram-badge]][telegram] [![PRs Welcome][prs-badge]][prs]

## Documentation
[Releases][release]&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;[Documentation][docs]&nbsp;&nbsp;&nbsp;

Please check the official [documentation](https://docs.marathonlabs.io/) for installation, configuration and more
</div>

License
-------
**Marathon** is a project that helps execute tests in the shortest time possible. Specifically it helps with **stability** of test execution adjusting for flakiness in the environment and in the tests and also achieves best **performance** using high parallelization

Marathon, a cross-platform test runner
Copyright (C) 2023 Anton Malinskiy
## TL;DR
Marathon is a fast, platform-independent test runner focused on performance and stability. It offers easy to use platform implementations for Android and iOS as well as an API for use with custom hardware farms and more techstacks.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2
Marathon implements multiple key concepts of test execution such as test **batching**, **device pools**, test **sharding**, test **sorting**, **preventive retries** as well as **post-factum retries**. By default, most of these are set to conservative defaults but custom configurations are encouraged for those who want to optimize performance and/or stability.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Marathon's primary focus is on **full control over the balance between stability of test execution, testing performance and cost**.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
For more information see the [documentation][docs]

### Overview
#### Performance
Marathon takes into account two key aspects of test execution:
* The duration of the test
* The probability of the test passing

Test run can only finish as quickly as possible if we plan the execution of tests with regard to the expected duration of the test. On the other hand, we need to address the flakiness of the environment and of the test itself. One key indicator of flakiness is the *probability* of the test passing.

Marathon takes a number of steps to ensure that each test run is as balanced as possible:
* The flakiness strategy queues up preventive retries for tests which are expected to fail during the test run according to the current real-time statistical data
* The sorting strategy forces long tests to be executed first so that if an unexpected retry attempt occurs it doesn't affect the test run significantly (e.g. at the end of execution)
* If all else fail we revert back to post-factum retries, but we try to limit their impact on the run with retry quotas

### Configuration

Create a basic **Marathonfile** in the root of your project with the following content:

Android:
```yaml
name: "My application"
outputDir: "build/reports/marathon"
vendorConfiguration:
type: "Android"
applicationApk: "dist/app-debug.apk"
testApplicationApk: "dist/app-debug-androidTest.apk"
```

iOS:
```yaml
name: "My application"
outputDir: "derived-data/Marathon"
vendorConfiguration:
type: "iOS"
bundle:
application: "sample.app"
testApplication: "sampleUITests.xctest"
testType: xcuitest
```

Vendor section describes platform specific details.

Since iOS doesn't have any way to discover remote execution devices you have to provide your simulators using the **Marathondevices** file:

```yaml
workers:
- transport:
type: local
devices:
- type: simulator
udid: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
- type: simulatorProfile
deviceType: com.apple.CoreSimulator.SimDeviceType.iPhone-13-mini
```

This **Marathondevices** file specifies a list of macOS instances and simulators for use. Marathon can use pre-provisioned simulators, but it can also provision new ones if needed.

Example above uses the local instance where marathon is executed, but you can connect many more instance via SSH.

> ℹ️ The instance where you run marathon is not limited to macOS: if you're using remote macOS instances then
you can easily start your marathon run from Linux for example.

You can find more information on providing devices in the [workers documentation][docs-workers]

The file structure for testing should look something like this:

Android:
```shell-session
foo@bar $ tree .
.
├── Marathonfile
├── dist
│   ├── app-debug.apk
│   ├── app-debug-androidTest.apk
```

iOS:
```shell-session
foo@bar $ tree .
.
├── Marathondevices
├── Marathonfile
├── build
│   ├── my.app
│   ├── my.xctest
```

### Execution

Start the test runner in the root of your project
```bash
$ marathon
XXX [main] INFO com.malinskiy.marathon.cli.ApplicationView - Starting marathon
XXX [main] INFO com.malinskiy.marathon.cli.config.ConfigFactory - Checking Marathonfile config
...
```

### Requirements
Marathon requires Java Runtime Environment 8 or higher.

## Move even faster with Marathon Cloud
<h1 align="center">
<img src="docs/static/img/marathon-cloud-banner.svg" alt="Marathon Logo" />
</h1>
Marathon Cloud is a scalable testing-as-a-service product designed and developed by us, the creators of Marathon. It's got all the cloud testing infrastructure you need to run any number of tests in less than 15 minutes,
whether you're a startup or a large enterprise.

[Learn more][marathon-cloud]

## Contributing

See [contributing docs][contributing]

## License

Marathon codebase is GPL 2.0 [LICENSE][LICENSE] with following optional components under specific licenses:
* [libxctest-parser][libxctest-parser-license]

<!--
Repo References
-->
[repo]:https://github.com/MarathonLabs/marathon

<!--
Link References
-->
[img-version-badge]:https://img.shields.io/github/release/MarathonLabs/marathon.svg?style=for-the-badge
[img-slack-badge]:https://img.shields.io/badge/Chat-Slack-49c39e?style=for-the-badge
[img-telegram-badge]:https://img.shields.io/badge/Chat-Telegram-0088CC?style=for-the-badge

[slack]:https://bit.ly/2LLghaW
[telegram]:https://t.me/marathontestrunner
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGlkPSJzdmcyIiB3aWR0aD0iNjQ1IiBoZWlnaHQ9IjU4NSIgdmVyc2lvbj0iMS4wIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPiA8ZyBpZD0ibGF5ZXIxIj4gIDxwYXRoIGlkPSJwYXRoMjQxNyIgZD0ibTI5Ny4zIDU1MC44N2MtMTMuNzc1LTE1LjQzNi00OC4xNzEtNDUuNTMtNzYuNDM1LTY2Ljg3NC04My43NDQtNjMuMjQyLTk1LjE0Mi03Mi4zOTQtMTI5LjE0LTEwMy43LTYyLjY4NS01Ny43Mi04OS4zMDYtMTE1LjcxLTg5LjIxNC0xOTQuMzQgMC4wNDQ1MTItMzguMzg0IDIuNjYwOC01My4xNzIgMTMuNDEtNzUuNzk3IDE4LjIzNy0zOC4zODYgNDUuMS02Ni45MDkgNzkuNDQ1LTg0LjM1NSAyNC4zMjUtMTIuMzU2IDM2LjMyMy0xNy44NDUgNzYuOTQ0LTE4LjA3IDQyLjQ5My0wLjIzNDgzIDUxLjQzOSA0LjcxOTcgNzYuNDM1IDE4LjQ1MiAzMC40MjUgMTYuNzE0IDYxLjc0IDUyLjQzNiA2OC4yMTMgNzcuODExbDMuOTk4MSAxNS42NzIgOS44NTk2LTIxLjU4NWM1NS43MTYtMTIxLjk3IDIzMy42LTEyMC4xNSAyOTUuNSAzLjAzMTYgMTkuNjM4IDM5LjA3NiAyMS43OTQgMTIyLjUxIDQuMzgwMSAxNjkuNTEtMjIuNzE1IDYxLjMwOS02NS4zOCAxMDguMDUtMTY0LjAxIDE3OS42OC02NC42ODEgNDYuOTc0LTEzNy44OCAxMTguMDUtMTQyLjk4IDEyOC4wMy01LjkxNTUgMTEuNTg4LTAuMjgyMTYgMS44MTU5LTI2LjQwOC0yNy40NjF6IiBmaWxsPSIjZGQ1MDRmIi8%2BIDwvZz48L3N2Zz4%3D

[release]:https://github.com/MarathonLabs/marathon/releases/latest "Latest Release (external link) ➶"
[docs]:https://docs.marathonlabs.io
[docs-workers]:https://docs.marathonlabs.io/ios/workers
[contributing]:https://docs.marathonlabs.io/intro/contribute
[prs]:http://makeapullrequest.com "Make a Pull Request (external link) ➶"
[LICENSE]:https://github.com/MarathonLabs/marathon/blob/-/LICENSE
[libxctest-parser-license]: https://github.com/MarathonLabs/marathon/blob/-/vendor/vendor-ios/src/main/resources/EULA.md

[marathon-cloud]:https://marathonlabs.io
6 changes: 5 additions & 1 deletion analytics/usage/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@ plugins {
`java-library`
id("org.jetbrains.kotlin.jvm")
id("org.jetbrains.dokka")
jacoco
}

setupDeployment()
setupKotlinCompiler()
setupTestTask()

dependencies {
implementation(Analytics.googleAnalyticsWrapper)
implementation(Libraries.okhttp)
implementation(Libraries.kotlinStdLib)
testRuntimeOnly(TestLibraries.jupiterEngine)
testImplementation(TestLibraries.junit5)
testImplementation(TestLibraries.kluent)
testImplementation(TestLibraries.mockitoKotlin)
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.malinskiy.marathon.usageanalytics

sealed class Event {
data class TestsTotal(
val total: Int
) : Event()

data class TestsRun(
val value: Int
) : Event()

data class Devices(
val total: Int
) : Event()

data class Executed(
val seconds: Long,
val success: Boolean,
val flakinessSeconds: Long,
val durationSeconds: Long,
) : Event()
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.malinskiy.marathon.usageanalytics.tracker

internal class EmptyTracker : UsageTracker {
override fun trackEvent(event: Event) {
import com.malinskiy.marathon.usageanalytics.Event

}
}
class EmptyTracker : UsageTracker {
override fun trackEvent(event: Event) = Unit
override fun meta(version: String, vendor: String, releaseMode: String) = Unit
override fun close() = Unit
}

This file was deleted.

Loading

0 comments on commit ddb3313

Please sign in to comment.