Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: E2E Tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

concurrency の設定を入れておいた方が良さそう


on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
inputs:
test_class:
description: 'Specific test class to run (e.g., DummyTest). Leave empty to run all.'
required: false
type: string

jobs:
e2e-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '8'
cache: 'gradle'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Run E2E tests
env:
KINTONE_BASE_URL: ${{ secrets.KINTONE_BASE_URL }}
KINTONE_DEFAULT_USER: ${{ secrets.KINTONE_DEFAULT_USER }}
KINTONE_DEFAULT_PASSWORD: ${{ secrets.KINTONE_DEFAULT_PASSWORD }}
KINTONE_TEST_USER: ${{ secrets.KINTONE_TEST_USER }}
KINTONE_TEST_PASSWORD: ${{ secrets.KINTONE_TEST_PASSWORD }}
KINTONE_SPACE_ID: ${{ secrets.KINTONE_SPACE_ID }}
KINTONE_GUEST_SPACE_ID: ${{ secrets.KINTONE_GUEST_SPACE_ID }}
KINTONE_BASIC_USER: ${{ secrets.KINTONE_BASIC_USER }}
KINTONE_BASIC_PASS: ${{ secrets.KINTONE_BASIC_PASS }}
TEST_CLASS: ${{ inputs.test_class }}
run: |
if [ -n "$TEST_CLASS" ]; then
./gradlew :e2e-tests:test --tests "*.$TEST_CLASS"
else
./gradlew :e2e-tests:test
fi
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,27 @@ Run the following command to build a JAR file of this library.
$ ./gradlew clean jar
```

## E2E Tests

E2E tests require a kintone environment. Set the following environment variables and run:

```bash
# Required environment variables
export KINTONE_BASE_URL=https://your-domain.cybozu.com
export KINTONE_DEFAULT_USER=your-user
export KINTONE_DEFAULT_PASSWORD=your-password
export KINTONE_TEST_USER=test-user
export KINTONE_TEST_PASSWORD=test-password
export KINTONE_SPACE_ID=your-space-id
export KINTONE_GUEST_SPACE_ID=your-guest-space-id

# Run all E2E tests
./gradlew :e2e-tests:test

# Run a specific test class
./gradlew :e2e-tests:test --tests "*.YourTestClass"
```

## Contribution Guide

- [CONTRIBUTING.md](CONTRIBUTING.md)
Expand Down
10 changes: 10 additions & 0 deletions e2e-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.gradle/
build/
# bin/ is used for scripts, not Eclipse build output
!bin/
bin/test/
.env
kintone-java-client.jar
.classpath
.project
.settings/
Comment on lines +1 to +10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要になったものが何個かありそう
!binとかkintone-java-client.jarとか

52 changes: 52 additions & 0 deletions e2e-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# E2E Tests

End-to-end tests for kintone-java-client that run against a real kintone environment.

## Prerequisites

- Java 8 or later
- A kintone environment for testing

## Environment Variables

Set the following environment variables before running tests:

| Variable | Description |
|----------|-------------|
| `KINTONE_BASE_URL` | Base URL of your kintone environment |
| `KINTONE_DEFAULT_USER` | Default user login name |
| `KINTONE_DEFAULT_PASSWORD` | Default user password |
| `KINTONE_TEST_USER` | Test user login name |
| `KINTONE_TEST_PASSWORD` | Test user password |
| `KINTONE_SPACE_ID` | Space ID for testing |
| `KINTONE_GUEST_SPACE_ID` | Guest space ID for testing |
| `KINTONE_BASIC_USER` | Basic auth username (if enabled) |
| `KINTONE_BASIC_PASS` | Basic auth password (if enabled) |

## Running Tests

From the project root directory:

```bash
# Run all E2E tests
./gradlew :e2e-tests:test

# Run a specific test class
./gradlew :e2e-tests:test --tests "*.RecordApiTest"

# Run with environment variables inline
KINTONE_BASE_URL=https://example.cybozu.com \
KINTONE_DEFAULT_USER=user \
KINTONE_DEFAULT_PASSWORD=pass \
./gradlew :e2e-tests:test
```

## CI/CD

Tests are automatically run via GitHub Actions:

- On push to `master` branch
- On pull requests to `master` branch
- Manually via workflow dispatch (with optional specific test class)

See `.github/workflows/e2e.yml` for the workflow configuration.
24 changes: 24 additions & 0 deletions e2e-tests/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
plugins {
id 'java'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
implementation project(':')

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3'
testImplementation 'org.assertj:assertj-core:3.26.0'

testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3'
}

test {
useJUnitPlatform()
jvmArgs '-Duser.timezone=Asia/Tokyo'
}
16 changes: 16 additions & 0 deletions e2e-tests/src/test/java/com/kintone/client/DummyTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.kintone.client;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

@DisplayName("Dummy test for E2E workflow verification")
class DummyTest {

@Test
@DisplayName("Placeholder test - replace with real E2E tests in Phase 2")
void dummyTest() {
assertThat(true).isTrue();
}
}
11 changes: 2 additions & 9 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
/*
* This file was generated by the Gradle 'init' task.
*
* The settings file is used to specify which projects to include in your build.
*
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user manual at https://docs.gradle.org/5.6.2/userguide/multi_project_builds.html
*/

rootProject.name = 'kintone-java-client'

include 'e2e-tests'