M
M
MMostovenko2017-09-27 21:48:01
Python
MMostovenko, 2017-09-27 21:48:01

Code writing automation. Where to begin?

Hello!
The crux of the matter is this. I need to write scripts for automated tests and I want to speed up this process and automate it at the same time. Tests are sent to us in the form of texts, most often in PDF. There are keywords in the text that can be used to determine **what needs to be done**, **which element to check**, or which **parameter to set to one value or another**. Also in the tests there are many tasks of the same type, which I still do with copy-paste.
I want to write this in python. Now I have a short script that searches for keywords in the text in three passes and inserts the necessary piece of code:
which element to check -> what state should be -> insert a piece of code.
I store keywords in an array, pieces of code in a dictionary. At the moment I have a limited database of words and code. I got into a logical impasse: what to do next, what to take on first?
UPD
I want to implement the addition of new pairs (word-code), I need to expand the list of keywords. So far, there are only names of valves, lamps and states: "open", "closed", "on", "off". I want a more complex check. For example, what would the program read the line "CHECK WHETHER THE LAMP IS FIRE WHEN THERE IS NO SIGNAL FROM THE SMOKE DETECTOR?" - wrote the code "CHECK SMOKE DETECTOR AND FIRE LAMP"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Konovalov, 2017-09-28
@akonovalov

"Tests are sent to us in the form of texts" - it looks like it's time for you to get acquainted with BDD.
There, tests are written as if in a natural language, but according to certain rules. Of course, this text is parsed by the framework and performs all the necessary checks.
There are libs and examples for Python - google it and you will find it.

S
Sergey, 2017-09-27
@begemot_sun

Take which thread Tomita parser. Learn to highlight facts. Based on the facts, build a generic code generator.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question