-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[if ... else ... ] block #18
Comments
For now, it is possible to skip entire test cases by using the --skip and --skip_unless flags. This way you can avoid running certain test cases based on environment variables. Please see the documentation. |
Hello, thanks for the answer. Yes, it is possible to skip entire test case. But for this two variants of the test case are needed, which leads to duplicated code, especially if the difference is small. There is probably option to assemble both variants with several Example use case can be to create one test for several different platforms, for production and development environment on each platform. Most of the functionality is the same, but for each platform few commands has different output. Also for development environment few commands should be skipped (not performed). |
There has been quite a few that have expressed that they really, really
needed an if-like statement. But in the end when looking into the actual
test scripts (not just discussing principles), it turned out that they
could solve it with other means. By evaluating if statements in the
(Bourne/Erlang/whatever) shell you may do quite a lot that may not be so
obvious in Lux. Such as asking the system being tested which version it
supports and then communicating with the system using different syntax
depending of version. One user actually implemented an own if statement, by
using an if-macro with three arguments. An expression and the names of two
macros. If the expression evaluated as true (in a Bourne shell), the first
(Lux) macro was executed otherwise the second one. Etc, etc.
I have been very reluctant with introducing statements in general to Lux as
I would like the language to be small. And I have really strived for test
results to be easy to interpret. In that regard I am not so fond of if-like
statements as you need to look into the nitty gritty details in order to
know whether the results between to runs are comparable. Or if one run has
skipped vital parts of the test case due to some reason. Another aspect of
if-cases is that we need to choose some style of expressions. It starts
with equal and ends with a full fledged expression evaluator. Python style,
Erlang style, Java style, ...
/Håkan
…On Thu, Jan 19, 2017 at 6:53 PM, Michal Novák ***@***.***> wrote:
Hello, thanks for the answer. Yes, it is possible to skip entire test
case. But for this two variants of the test case are needed, which leads to
duplicated code, especially if the difference is small.
There is probably option to assemble both variants with several [include
...] statements (not to duplicate test code), but this impacts
readability (depending on how many differences and number of their
combinations one has to deal with).
Example use case can be to create *one test* for several different
platforms, for production and development environment on each platform.
Most of the functionality is the same, but for each platform few commands
has different output. Also for development environment few commands should
be skipped (not performed).
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#18 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAJpsLNBaWjbd85yDw_SQbuoMQPXj24Aks5rT6M0gaJpZM4LoO9A>
.
|
Thanks for feedback.I believe this limits the usage of the framework in cases similar to one described above (writing one test for different environments). Currently, the only solution (workaround) is to generate the lux tests, before the test is run. |
As I mentioned before you can roll your own if statement. For example you may do something like this:
|
Here you see the difference when it is run:
|
Thanks. I kind of missed the |
Do you consider to implement support for
if
?e.g.
It would be useful for cases, when we run tests in different environments and for some of them
only limited set of commands is available.
Thanks.
The text was updated successfully, but these errors were encountered: