Lux
is a universal system-level test tool written in Erlang/OTP by Håkan
Mattsson and other contributors. Based on
expect-like pattern, Lux
offers
simplified syntax, regular expressions support, switching between multiple
concurrent sessions, extensive logging, post mortem analysis, debugging, and
more. Testing with Lux
can be a part of more valuable processes, like
developing new services for Cisco NSO, CI/CD pipeline testing, troubleshooting,
etc. It is well known for test automation for developing Cisco Network Service
Orchestrator (NSO) with 4500 test cases per run.
Some explanations "Why Lux
" can be found here.
For more on Lux
features, please check
the official documentation.
You may install the extension via VS Code Quick Open (Ctrl/Cmd+P), paste the
following command, press enter, and click install.
ext install andreygrechin.lux-colorizer
Also, you may install it via VS Code
marketplace by searching the name
andreygrechin.lux-colorizer
.
After the installation, the extension will be enabled automatically.
To use snippets, start typing a meta statement, like [loop]
, and VS Code will
offer possible options. Use TAB to autocomplete a statement and jumping between
input fields.
Lux
for fast transition from manual to automated testingLux
scripts by nature are a simple way to move from manual testing to
consistent, repeatable, and automated testing while keeping time to write tests
to a minimum. A little or no experience is required to start. However,
understanding some basic regular expression patterns will benefit you.
Firstly, you need to collect some raw input and output strings to transform them
into a Lux
script. For example, connect to a host and do a manual test as you
do before.
ssh rt | tee log.txt
Next, you can easily create a Lux
script by editing log.txt
(not shown for
brevity) by marking send and receive strings with prefixes and cutting down
insignificant parts of the output. !
means send a line (command), ?
is
expected output regexp match, and ???
is expected output exact match. Pretty
simple.
An example above does some basic tricks:
shell1
(line 4)rt
(line 7), and wait for a regular expression to match
(regexp '.*' means any character, followed by a hash as a privileged level
prompt ending, line 8)To run a test case:
lux example1.lux
Lux
shows a progress report during tests run on stdout. In case of any
unexpected results, the test will fail, showing a brief explanation of what was
sent and what was received from the device under test. More detailed log files
will be available for further troubleshooting.
For more on Lux
features, like regular expressions support, switching between
multiple concurrent sessions, extensive logging, post mortem analysis,
debugging, and more, check the
official documentation.
Each Lux
script may have hundreds+ of send/expect lines and comments, which
are hard to read and work with. The extension significantly increases
readability and visually distinguishes input and output streams, keywords,
comments, meta statements, special characters and variables. This simplification
will help test writers to produce test in a more structured format and see
syntax errors early before run, increasing the speed of writing, reviewing, and
maintaining test scripts.
Cisco DevNet organization provides a great selection of always-on and reservation-based sandboxes to test different solutions, products, and APIs, including Cisco NSO.
Unfortunately, existing NSO sandboxes don't have lux
package installed, to the best
of my knowledge. Moreover, users cannot add lux
package themselves due to
security policies. To use lux
user have to build own environment and install
lux
using standard
installation guidelines.
Lux
for fast transition from manual to automated testingLux
scripts by nature are a simple way to move from manual testing to
consistent, repeatable, and automated testing while keeping time to write tests
to a minimum. A little or no experience is required to start. However,
understanding some basic regular expression patterns will benefit you.
Firstly, you need to collect some raw input and output strings to transform them
into a Lux
script. For example, connect to a host and do a manual test as you
do before.
ssh rt | tee log.txt
Next, you can easily create a Lux
script by editing log.txt
(not shown for
brevity) by marking send and receive strings with prefixes and cutting down
insignificant parts of the output. !
means send a line (command), ?
is
expected output regexp match, and ???
is expected output exact match. Pretty
simple.
An example above does some basic tricks:
shell1
(line 4)rt
(line 7), and wait for a regular expression to match
(regexp '.*' means any character, followed by a hash as a privileged level
prompt ending, line 8)To run a test case:
lux example1.lux
Lux
shows a progress report during tests run on stdout. In case of any
unexpected results, the test will fail, showing a brief explanation of what was
sent and what was received from the device under test. More detailed log files
will be available for further troubleshooting.
For more on Lux
features, like regular expressions support, switching between
multiple concurrent sessions, extensive logging, post mortem analysis,
debugging, and more, check the
official documentation.
Each Lux
script may have hundreds+ of send/expect lines and comments, which
are hard to read and work with. The extension significantly increases
readability and visually distinguishes input and output streams, keywords,
comments, meta statements, special characters and variables. This simplification
will help test writers to produce test in a more structured format and see
syntax errors early before run, increasing the speed of writing, reviewing, and
maintaining test scripts.
Cisco DevNet organization provides a great selection of always-on and reservation-based sandboxes to test different solutions, products, and APIs, including Cisco NSO.
Unfortunately, existing NSO sandboxes don't have lux
package installed, to the best
of my knowledge. Moreover, users cannot add lux
package themselves due to
security policies. To use lux
user have to build own environment and install
lux
using standard
installation guidelines.
Owner
Contributors
Categories
Products
Network Services Orchestrator (NSO)Programming Languages
MakefileLicense
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community