Skip to content

Commit c5a7216

Browse files
authored
test: add empty test code (#1021)
* add minitest deps * add empty test * use test
1 parent c450c20 commit c5a7216

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

.github/workflows/rubocop.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@ jobs:
2323
ruby-version: ${{ matrix.ruby }}
2424
- name: Install dependencies
2525
run: bundle install
26-
- name: Run tests
26+
- name: Run rubocop
2727
run: bundle exec rake rubocop
28+
- name: Run tests
29+
run: bundle exec rake test

Rakefile

+8
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,18 @@
1414

1515
require 'bundler/gem_tasks'
1616
require 'rubocop/rake_task'
17+
require 'rake/testtask'
1718

1819
desc 'Execute RuboCop static code analysis'
1920
RuboCop::RakeTask.new(:rubocop) do |t|
2021
t.patterns = %w(lib ios_tests android_tests)
2122
t.options = %w(-D)
2223
t.fail_on_error = true
2324
end
25+
26+
desc('Run all unit tests in test directory')
27+
Rake::TestTask.new(:test) do |t|
28+
t.libs << 'test'
29+
t.libs << 'lib'
30+
t.test_files = FileList[ENV['TESTS'] ? ENV['TESTS'].split(',') : 'test/**/*_test.rb']
31+
end

appium_lib.gemspec

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Gem::Specification.new do |s|
2727
s.add_development_dependency 'rubocop', '1.62.1'
2828
s.add_development_dependency 'spec', '~> 5.3', '>= 5.3.4'
2929
s.add_development_dependency 'yard', '~> 0.9.11'
30+
s.add_development_dependency 'minitest', '~> 5.0'
31+
s.add_development_dependency 'minitest-reporters', '~> 1.1'
3032

3133
s.files = `git ls-files`.split("\n").reject { |v| v.match(/\A^(ios_tests|android_tests|grid|test_apps)\/.+/) }
3234
end

test/first_test.rb

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# frozen_string_literal: true
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
require 'minitest/autorun'
16+
require 'minitest/reporters'
17+
require 'minitest'
18+
19+
begin
20+
Minitest::Reporters.use! [Minitest::Reporters::ProgressReporter.new]
21+
rescue Errno::ENOENT
22+
# Ignore since Minitest::Reporters::JUnitReporter.new fails in deleting files, sometimes
23+
end
24+
25+
class SampleTest < Minitest::Test
26+
def test_test
27+
assert(true)
28+
end
29+
end

0 commit comments

Comments
 (0)