Skip to content

Commit

Permalink
Create Mkdocs config
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed Apr 15, 2024
1 parent 7ca3239 commit 53e4d90
Show file tree
Hide file tree
Showing 24 changed files with 162 additions and 89 deletions.
8 changes: 1 addition & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
_site
build
.idea
.bundle
.sass-cache
.DS_Store
*.iml
*.ipr
*.iws
vendor
.jekyll-cache
.jekyll-metadata
site/
6 changes: 2 additions & 4 deletions androidx_test.md → docs/androidx_test.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
title: AndroidX Test
group: User Guide
order: 1
redirect_from: "/activity-lifecycle/"
hide:
- footer
---

# AndroidX Test
Expand Down
9 changes: 4 additions & 5 deletions automated-migration.md → docs/automated-migration.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
title: Automated Migration
group: [hide]
order: 7
toc: true
redirect_from: "/errorprone-refactorings/"
hide:
- footer
- navigation
- toc
---

# Automated Migration
Expand Down
6 changes: 3 additions & 3 deletions best-practices.md → docs/best-practices.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Best Practices
group: User Guide
order: 8
hide:
- footer
- toc
---

# Best Practices
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Build System Integration
group: Customizing
order: 2
hide:
- footer
- toc
---

# Build System Integration
Expand Down
6 changes: 2 additions & 4 deletions building-robolectric.md → docs/building-robolectric.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
title: Building Robolectric
group: Contributing
order: 1
toc: true
hide:
- footer
---

# Building Robolectric
Expand Down
7 changes: 3 additions & 4 deletions configuring.md → docs/configuring.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: Configuring Robolectric
group: User Guide
order: 2
hide:
- footer
---

# Configuring Robolectric
Expand Down Expand Up @@ -96,7 +95,7 @@ public class SandwichTest {
}
```

See [Using Qualifiers](/using-qualifiers) for more details.
See [Using Qualifiers](using-qualifiers.md) for more details.

## System Properties

Expand Down
8 changes: 3 additions & 5 deletions contributing.md → docs/contributing.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
---
title: Contributor Guidelines
group: Contributing
order: 1
toc: true
hide:
- footer
---

# Contributor Guidelines

## Getting Started

The first step to contributing is to ensure that you are able to build Robolectric. Please visit [building Robolectric](/building-robolectric/) for more details and instructions on setting up an environment to build Robolectric.
The first step to contributing is to ensure that you are able to build Robolectric. Please visit [building Robolectric](building-robolectric.md) for more details and instructions on setting up an environment to build Robolectric.

Once you are able to build Robolectric, create a feature branch to make your changes:

Expand Down
6 changes: 3 additions & 3 deletions custom-test-runner.md → docs/custom-test-runner.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Customizing the Test Runner
group: Customizing
order: 3
hide:
- footer
- toc
---

# Customizing the Test Runner
Expand Down
8 changes: 3 additions & 5 deletions device-configuration.md → docs/device-configuration.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
---
title: Device Configuration
group: User Guide
order: 3
toc: true
hide:
- footer
---

# Device Configuration

Robolectric makes it easy to simulate a variety of device configurations. In particular, the properties that make up the `android.content.res.Configuration` class can be specified at the test method, test class, package, or suite level, as described [here](/configuring/).
Robolectric makes it easy to simulate a variety of device configurations. In particular, the properties that make up the `android.content.res.Configuration` class can be specified at the test method, test class, package, or suite level, as described [here](configuring.md).

## Specifying Device Configuration
The Android device configuration can be specified using the `qualifiers` config property:
Expand Down
13 changes: 5 additions & 8 deletions extending.md → docs/extending.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
title: Shadows
group: Contributing
order: 1
redirect_from:
- /custom-shadows/
hide:
- footer
---

# Shadows
Expand Down Expand Up @@ -114,7 +111,7 @@ Methods on your shadow class are able to call through to the Android OS code, us

## Custom Shadows

Robolectric is a work in progress and we rely, welcome and strongly encourage [contributions](/contributing/) from the community for bug fixes and feature gaps. However, if you wish to modify shadow behaviour in a way that is not appropriate for sharing, or you can't wait for a new release to include a critical fix we do support custom shadows.
Robolectric is a work in progress and we rely, welcome and strongly encourage [contributions](contributing.md) from the community for bug fixes and feature gaps. However, if you wish to modify shadow behaviour in a way that is not appropriate for sharing, or you can't wait for a new release to include a critical fix we do support custom shadows.

### Writing a Custom Shadow

Expand Down Expand Up @@ -144,7 +141,7 @@ public class MyShadowBitmap {

Custom Shadows get hooked up to Robolectric using the `@Config` annotation on the test class or test method, using the `shadows` array attribute. To use the `MyShadowBitmap` class mentioned in the previous section, you would annotate the test in question with `@Config(shadows={MyShadowBitmap.class})`, and to include multiple custom shadows: `@Config(shadows={MyShadowBitmap.class, MyOtherCustomShadow.class})`. This causes Robolectric to recognize and use your custom shadow when executing code against the class you shadowed.

If you would like your custom shadows to be applied to all tests in your suite or a certain package you can configure shadows through the [robolectric.properties](/configuring/) file.
If you would like your custom shadows to be applied to all tests in your suite or a certain package you can configure shadows through the [robolectric.properties](configuring.md) file.

Note, by default `Shadows.shadowOf()` method will not work with custom shadows. You can instead use `Shadow.extract()` and cast the return value to the custom Shadow class you implemented.

Expand Down Expand Up @@ -213,4 +210,4 @@ Rather than using shadows as glorified argument captors prefer writing a shadow
Robolectric provides a lot of power which requires responsible usage. Shadows are ideal for testing interaction with the Android framework as the framework doesn't support dependency injection and makes liberal use of static code. Before writing custom shadows for your own code, consider if you can't better refactor your code and use a popular mocking library such as Mockito.

### Support the community
Please please [contribute](/contributing/) your enhancements for sharing with the community and reducing the bloat in your own codebase.
Please please [contribute](contributing.md) your enhancements for sharing with the community and reducing the bloat in your own codebase.
14 changes: 6 additions & 8 deletions getting-started.md → docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
---
title: Getting Started
group: Setup
order: 1
toc: true
hide:
- footer
---

# Getting Started

Robolectric works best with Gradle or Bazel. If you are starting a new project, we would recommend Gradle first (since it is the build system of choice in Android Studio) and Bazel second. Both environments provide first class support for Robolectric. If you are using another build system see how to configure [other environments](/other-environments) or learn how to provide first class [build system integration](/build-system-integration) support for other environments.
Robolectric works best with Gradle or Bazel. If you are starting a new project, we would recommend Gradle first (since it is the build system of choice in Android Studio) and Bazel second. Both environments provide first class support for Robolectric. If you are using another build system see how to configure [other environments](other-environments.md) or learn how to provide first class [build system integration](build-system-integration.md) support for other environments.

## Building with Android Studio/Gradle

Expand All @@ -26,7 +24,7 @@ android {
dependencies {
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.robolectric:robolectric:{{ site.robolectric.version.current | escape }}'
testImplementation 'org.robolectric:robolectric:{{ robolectric.version.current }}'
}
```

Expand Down Expand Up @@ -98,8 +96,8 @@ android_local_test(
## Other Environments

* [Buck](https://buckbuild.com/rule/robolectric_test.html)
* [Older Android Studio/Gradle Versions](/other-environments/#android-studio--gradle-agp--30)
* [Maven & Eclipse](/other-environments/#maven--eclipse)
* [Older Android Studio/Gradle Versions](other-environments.md#android-studio-gradle-agp-30)
* [Maven & Eclipse](other-environments.md#maven-eclipse)

## Sample Projects

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
10 changes: 4 additions & 6 deletions index.md → docs/index.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
# You don't need to edit this file, it's empty on purpose.
# Edit theme's home layout instead if you wanna make some changes
# See: https://jekyllrb.com/docs/themes/#overriding-theme-defaults
# layout: home
front: true
hide:
- footer
- navigation
---

Running tests on an Android emulator or device is slow! Building, deploying, and launching the app often takes a minute or more. That's no way to do <abbr title="Test-Driven Development">TDD</abbr>. There must be a better way.
Expand All @@ -25,7 +23,7 @@ public class MyActivityTest {
}
}
```
[» Getting Started...](/getting-started/)
[» Getting Started...](getting-started.md)

### Test APIs & Isolation

Expand Down
12 changes: 5 additions & 7 deletions migrating.md → docs/migrating.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
---
title: Migration Guide
page_title: Robolectric Migration Guide
group: [hide]
order: 7
toc: true
title: Robolectric Migration Guide
hide:
- footer
---

## Automated Migration

Robolectric provides an [automated migration tool](/automated-migration) to help keep your test suite up to date with Robolectric API changes.
Robolectric provides an [automated migration tool](automated-migration.md) to help keep your test suite up to date with Robolectric API changes.

## Migrating to 4.0

Expand Down Expand Up @@ -185,7 +183,7 @@ RobolectricPackageManager

### New Gradle integration

Starting with Robolectric 3.3 + Android Studio 3.0 alpha 5 we've included better integration with the tool chain. Resources, assets and `AndroidManifest.xml` are treated as first class citizens and processed by the build system for correctness, performance and stability between releases. Read more [here](/getting-started/).
Starting with Robolectric 3.3 + Android Studio 3.0 alpha 5 we've included better integration with the tool chain. Resources, assets and `AndroidManifest.xml` are treated as first class citizens and processed by the build system for correctness, performance and stability between releases. Read more [here](getting-started.md).

---

Expand Down
14 changes: 6 additions & 8 deletions other-environments.md → docs/other-environments.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
---
title: Other Environments
page_title: Using Robolectric with other build environments.
group: Setup
order: 2
toc: true
group: [hide]
title: Using Robolectric with other build environments
hide:
- footer
- navigation
---

## Android Studio + Gradle (AGP < 3.0)
Expand All @@ -27,13 +25,13 @@ public class SandwichTest {

Robolectric works with Android Studio 1.1.0 or newer. Simply follow the instructions above for working with Gradle. For versions of Android Studio older than 2.0.0, enable the unit test support in the "Build Variants" tab and run your test. As of Android Studio 2.0.0, the test artifacts feature is enabled by default, and the setting to enable/disable test artifacts can be found in File Menu -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Experimental.

![Android Enable Unit Tests](/images/android-studio-enable-unit-tests.png)
![Android Enable Unit Tests](images/android-studio-enable-unit-tests.png)

### Updating JUnit run configurations

You will probably also need to configure the default JUnit test runner configuration in order to work around a bug where Android Studio does not set the working directory to the module being tested. This can be accomplished by editing the run configurations, `Defaults -> Android JUnit` and changing the working directory value to `$MODULE_DIR$`.

![Android Studio Configure Defaults](/images/android-studio-configure-defaults.png)
![Android Studio Configure Defaults](images/android-studio-configure-defaults.png)

Note that if you already have existing JUnit configurations (`Android JUnit` in the root of the tree), you must do the same change as described above for all of them.

Expand Down
6 changes: 3 additions & 3 deletions using-add-on-modules.md → docs/using-add-on-modules.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Using Add-On Modules
group: User Guide
order: 4
hide:
- footer
- toc
---

# Using Add-On Modules
Expand Down
6 changes: 3 additions & 3 deletions using-qualifiers.md → docs/using-qualifiers.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Using Qualified Resources
group: User Guide
order: 3
hide:
- footer
- toc
---

# Using Qualified Resources
Expand Down
6 changes: 3 additions & 3 deletions writing-a-test.md → docs/writing-a-test.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Writing Your First Test
group: Setup
order: 2
hide:
- footer
- toc
---

# Writing Your First Test
Expand Down
Loading

0 comments on commit 53e4d90

Please sign in to comment.