ENCS313- Python – Essaylink

Description
This project addresses the automation of command execution in python. You need to design and
implement a software that executes several commands automatically and produces a well-defined
report (log). A software like this can be used in Automation testing to run some scenarios at various
environments to check if a specific behavior break.
Components
You need to follow the following steps:
• Command Implementation: you need to implement the following commands in python:
o Grep : check if a given file is within a specific directory (including its
subdirectories).
o Mv_last : move the most recent file from source
directory to destination directory.
o Categorize : split files in the given directory into 2 types
▪ An inner directory with files less than
▪ An inner directory with files more than

• Main Class/Script: You need to implement a class that reads predefined scripts based on the
upper commands and parse/execute them. In other words, you need to implement a class/script
that uses your codes from the first step.
• Configuration: We will use python JSON as our configuration file. It will be .json file in your
project where it contains main values that you need to run the application. Our json file will
specify the following:
o Threshold_size: the value that is need by the command categorize.
o Max_commands: the maximum commands that should be executed per script.
Otherwise, script raises an error.
o Max_log_files: the maximum number of file in the log directory. Otherwise, you need to
delete the oldest one.
o Same_dir: place PASSED and FAILED at the same directory or not. If not, create internal
pass and fail subdirectories. A passed script when all lines pass execution.
o Output: we will support two types of results – csv and log files:
▪ Csv: if csv if chosen, the output should be 2 columns, each statement with the
result – include a pass or fail word in the name of the file.
▪ Log: print each statement with its result in the file – include a pass or fail word
in the name of the file.

• Option Parser: We will use python option parser to specify input script file and output log result.
Check the example.
• Logging: python logging module should be used for debugging and producing final script result –
no print statements should be used.

Example
You have the following script.txt file
Grep
Categorize
Mv_last
Your application should take 2 inputs:
• Script path (-s)
• Output log file (-o)
Python parser -s “input/script/path” -o “output/script/path”

You also need to have configuration.json file that looks like:
{
” Threshold_size “: “10KB”,
” Max_commands “: “5”,
” Max_log_files “: “7”,
” Same_dir “: False,
” output “: “csv”
}
HINTS
• Check the Factory design pattern in python to help you structure command codes. Remember you
have several types of command.
• For each run, create a python dictionary and save the result of each command on the run, at the end, parse the dictionary to provide your final log.
• Check how to parse JSON files in python → very easy and straightforward.
• Check logging library in python, very simple and provides a better way to control logs.
• Check python option parser to create -f and -o.

The post ENCS313- Python first appeared on Krita Infomatics.

Reviews, comments, and love from our customers and community:

Article Writing

Keep doing what you do, I am really impressed by the work done.

Alexender

Researcher

PowerPoint Presentation

I am speechless…WoW! Thank you so much!

Stacy V.

Part-time student

Dissertation & Thesis

This was a very well-written paper. Great work fast.

M.H.H. Tony

Student

Annotated Bibliography

I love working with this company. You always go above and beyond and exceed my expectations every time.

Francisca N.

Student

Book Report / Review

I received my order wayyyyyyy sooner than I expected. Couldn’t ask for more.

Mary J.

Student

Essay (Any Type)

On time, perfect paper

Prof. Kate (Ph.D)

Student

Case Study

Awesome! Great papers, and early!

Kaylin Green

Student

Proofreading & Editing

Thank you Dr. Rebecca for editing my essays! She completed my task literally in 3 hours. For sure will work with her again, she is great and follows all instructions

Rebecca L.

Researcher

Critical Thinking / Review

Extremely thorough summary, understanding and examples found for social science readings, with edits made as needed and on time. Transparent

Arnold W.

Customer

Coursework

Perfect!

Joshua W.

Student

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>