Giter Site home page Giter Site logo

java-codetest-executer's Introduction

java-codetest-executer

『標準入力を受け取るタイプのプログラミングテスト』の実行プログラム。 csvでつくった入力ファイルを所定の位置に置いて実行すると、標準入力としてプログラムに流してくれる。

How to use

1.テスト対象のロジックを記載したクラスを実装する

  • テストコードは、mainメソッドを有する任意のクラスに記述する。以下、このクラスを テストクラス と呼ぶ

2.入力ファイルをcsvで用意する

  • 入力ファイル(csv)はルートディレクトリから起算して testcase/{テストクラス名}/ 以下に配置する
  • 入力ファイル名は caseX.csv (Xは1からはじまる連番 i.e. 1,2,3,...) である必要がある
  • 入力ファイルの文字コードは utf-8 を利用する
* csvによる入力値について
  • 入力値は、テストクラスの mainメソッドの引数 String[] args あるいは 標準入力 new Scanner(System.in) から受け取る
  • csvの各行がそれぞれString化された値が、各入力の各行に格納
  • 受け取り形式の差による、受け取るデータ形式の差は基本的にない ( args[i]sc.nextLine() に対応 (iは配列のインデックス / scはScannerのインスタンス))
  • csv中のカンマは、テストクラスに渡された文字列においては "半角スペース" に変換されている
  • カンマのうち、以降のカラムに値が存在しないものは、csv読み込み時に除去される

3.実行する

  • プログラムの実行の起点クラスは Executor クラス
  • Executor は実行時引数として、 テストクラスのFQCN を指定する

欄外

コードテスト系のwebサービスではテストデータが用意されているものもあるが、
自分で複数テストケースを書きたいときもある。
...ので、既にあるんだろうなあと思いつつ、趣味で書いた。あしからず

java-codetest-executer's People

Contributors

t407o avatar

Watchers

 avatar

java-codetest-executer's Issues

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.