Skip to content

jrobertson/testkit123

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Introducing the Testkit123 gem

h = {
  templates: {
    testdata: 'http://rorbuilder.info/r/test_project/testdata.xml',
    testx: 'http://rorbuilder.info/r/test_project/test.rsf',
  },
  localpath: '/home/james/jamesrobertson.eu/test-ruby',
  datapath: '/home/james/rorbuilder/r/gemtest', 
  gemtest_url: 'http://rorbuilder.info/r/gemtest/',
  rubyver: 'ruby-2.5.1',
  debug: true
}

TestKit123.new(h).new_project('quiz_game', save: true).create_files

The above example demonstrates how to create a new test project and to create the associated files used to by the test framework called testdata.

Files created

The new_project method created the file quiz_game.txt in the file directory /home/james/jamesrobertson.eu/test-ruby.

The create_files method created the following files and directories:

  • ~/rorbuilder/r/gemtest/quiz_game.rsf
  • ~/rorbuilder/r/gemtest/quiz_game/testdata_quiz_game.xml
  • ~/rorbuilder/r/gemtest/quiz_game/test_quiz_game.rb
  • ~/jamesrobertson.eu/test-ruby/quiz_game/.testdata

Template files used

testdata: 'http://rorbuilder.info/r/test_project/testdata.xml'

<tests>
  <summary>
    <title>#{proj} testdata</title>
    <recordx_type>polyrex</recordx_type>
    <schema>tests/test[path,type,description]/io[type,*]</schema>
    <ruby_version>#{config[:ruby_version]}</ruby_version>
    <script>//job:test #{config[:http_gemtest]}#{proj}.rsf</script>
    <test_dir>#{config[:local_path]}/#{proj}</test_dir>    
  </summary>
  <records>
    <test id='1'>
      <summary>
        <path>1</path> 
        <type>string only</type>
        <description></description>
        <format_mask>[!path] [!type] [!description]</format_mask>
      </summary>
      <records>
        <input id='2'>
          <summary>
            <date>1-Apr-2011#3:12pm</date>
            <times>Mon-Fri 10:30-16:00</times>
          </summary>
          <records></records>
        </input>
        <output id='3'>
          <summary>
            <within>true</within>
          </summary>
          <records></records>
        </output>
      </records>
    </test>
  </records>
</tests>

testx: 'http://rorbuilder.info/r/test_project/test.rsf'

<package>
  <job id='test'>
    <script src="http://rorbuilder.info/r/ruby/testdata.rb"/>
    <script src="http://rorbuilder.info/r/ruby/#{proj}.rb"/>
    <script src="#{config[:http_gemtest]}#{proj}/test_#{proj}.rb"/>
    <script>
      
      <![CDATA[ 
      
      file = '~/jamesrobertson.eu/test-ruby/#{proj}'
      this_path = File.expand_path(file)

      if this_path != Dir.pwd then
        puts "you must run this from script #{'#{this_path}'}" 
        exit
      end

      url = '#{config[:http_gemtest]}#{proj}/testdata_#{proj}.#{ext}'
      puts 'testing ..'
      test = Test#{classname}.new(url)
      test.debug = true if params.has_key? :debug
      id = params[:id] ? params[:id] : nil
      test.run id

      ]]>
    </script>
  </job>
</package>

Resources

test testing gem testdata config

About

Generates a test suite of files (for use with the testdata gem) from a config file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages