Giter Club home page Giter Club logo

antimony's Introduction

antimony

Gem Version Build Status Code Climate Coverage Status License

Antimony is a DSL allowing developers to write automated workflows for TN5250 mainframe applications.

Formulas

Formulas describe automated processes and are loaded from the formulas directory.

Simply provide the filename and any inputs to Antimony::Formula.new and call run

Usage

Prepare Formula

@formula = Antimony::Formula.new('process_unit', { value: 'sample' })

Run Formula

@formula.run

Access inputs and outputs

@formula.inputs # {}
@formula.outputs # {}

Inputs

Formulas expose @inputs which contains the hash provided during initialization. This hash can be accessed outside of a formula via the inputs method on the formula object.

Outputs

Formulas expose @outputs which is a hash that can be used to save outputs from the execution of a formula. This hash can be accessed outside of a formula via the outputs method on the formula object.

Logging

Running a formula will automatically log the screens that it traversed and the final screen after completion to log/formulas/formula_name.log These logs will contain only the most recent execution.

Commands

Send string to terminal

send_keys(string, [count])      # send string to terminal 'count' times

Keyboard methods

enter([count])                  # send enter key 'count' times
tab([count])                    # send tab key 'count' times
backspace([count])              # send backspace key 'count' times
arrow_up([count])               # send arrow up key 'count' times
arrow_down([count])             # send arrow down key 'count' times
arrow_right([count])            # send arrow right key 'count' times
arrow_left([count])             # send arrow left key 'count' times
f{1-24}([count])                # send function key 'count' times

Current screen data

value_at(row, column, length)   # get the string value at a given row and column
screen_text                     # get current screen as a string
print_screen                    # print current screen
printable_screen_text           # get pretty-print version of screen text

Logging

session_log                     # get the log of the session
log(message)                    # log a message to the session log
log_screen                      # log the current screen to the session log

Examples

Example formula (login.rb) for a login workflow

session 'hostname.com' do
  send_keys 'USERNAME'
  send_keys 'PASSWORD'
  enter
  @outputs[:success] = screen_text.include? 'SUCCESSFUL LOGIN'
end

Example of modularizing use of formulas (note: login.rb formula is pulled into this one - lookup.rb)

require 'login'
session 'hostname.com' do
  login #login formula is invoked/run
  send_keys 'MENU1'
  enter
  send_keys '02'
  enter
  send_keys inputs[:work_order_number]
  enter
  f5
  outputs[:success] = screen_text.include?(inputs[:status])
end

Example RSpec test calling the formula

context 'Given I am an Admin And I have a Completed work order' do
  it 'When I lookup the work order Then the completed status is displayed'
      lookup_formula = Antimony::Formula.new('lookup', {work_order_number: '12345', status: 'COMPLETED'})
      lookup_formula.run
      expect(lookup_formula.outputs[:success]).to be_true
  end
end

Authors

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.