How to run the specific test on FsCheck using replay? - fscheck

I have a test using FsCheck, when it fails it give me the information about the seed to put on the Replay property to reproduce the failed test.
But to debug this is really hard, because it will not fail on the first value.
FsCheck also give me the information about the number of attempt until fail: Falsifiable, after 74 tests
Is there any way to run the exactly value that has failed?
Workarounds that I'm using:
Create test passing the value that it gives me to debug, and after fix the code I delete this test;
Add a conditional breakpoint in the test for the value that make the test fails.
Both of them work, but must be a better way.

Related

How to create a "background timer" on Robot Framework?

I am struggling to create (and to find similar examples) of what I understand as a "background timer" on Robot Framework.
My scenario is:
I have a Test Case to Execute, and at a certain point I give one input to my system. Then I need to keep testing other functionalities on the way, but after 30 min from that initial input, check if the expected outcome is happening or not.
For example:
Run Keyword And Continue On Failure My_Keyword
#This keyword should trigger the system timer.
Run Keyword And Continue On Failure Another_Keyword
#This one does not relate with the timer but must also be executed.
Run Keyword And Continue On Failure My_Third_Keyword
#Same for this one.
Run Keyword And Continue On Failure Check_Timer_Result
#This one shall see if the inputs from the first keyword are actually having effect.
Since I know the Keyword "Sleep" will pause the execution and wait, I have been think about using some logic + BultIn Get Time keyword. But wondering if this is the most efficient way.

Python's unittest testing framework, how to uniformly modify the execution result of each use case in the tearDownClass method?

I am using python's unittest framework. Since each test case execution will take the same amount of time [obtain the product log to determine whether it is successful or not], I want to extract the time-consuming operation to determine the success/failure of the test and put it in tearDownClass In this method, the product logs are obtained uniformly, and the success of each use case is compared one by one, which can save a lot of test execution time,
The core requirement is: in tearDownClass or elsewhere, finally modify the execution results of each test case one by one, changing success to failure

How to Know If in the Last Repeat of Repeat Keyword

The Repeat Keyword Robot Framework command allows you to keep running a keyword for a certain number of cycles or a certain amount of time. I want to have one type of Teardown for all intermediate Repeats but a final other teardown at the end of the test. Is there an internal variable or something else under the hood that I can check to see if the last Repeat is being run?
I highly doubt it.
But there's a workaround. Just make a regular for loop with index and use Run Keyword there. Then do then conditional calls based on the index.

How to clear message error that occur from the Corda flow test

I try to run the test that I created from Corda 3.3 in Corda 4.1
I have 2 test case for test the flow
in the first test I expected fail that came from contract
and the result from first test is also correct as I expected to
but I error that I got from first test was send to hospital flow
and the error have been shown in the second test
actually the error that come for the first test not effect to the second test but it make the second test to slow
I really don't know how to clear the the error message before sun the second test
If someone have any idea please let me know thank you.
Note: If you have the way that not stop the nodes and re-create mock node again before run new test, it will be the solution that I looking for.
==============================
I have 6 tests in one file
first I try to create the network and use that net work for all of 6 test in this way I can reduce the time for initiate the network
but I need to clear the database after each test finish for avoid create duplicate data.
everything work until I change to Corda 4.1
in the 4.1 I don't know why the way that I use for clear database in Corda 3.3 not work like before (In 4.1 take long times for tuncate the table)
so I need to change the way to create the network and stop after finish each test.
In this way take more time for initiate the network (around 20-30 seconds per test)
and the point that surprised me is when I finish 5 tests in the 6th test take the long time (the log show house keeper clean) they use 6 minutes for finished
but when I run only that test, they use 1 minute for finished.
my question are
1. How I clear everything after finish each test
2. Have another way for initiate the network and use for every test? and how to clear the database and message after finish each test
It is not visible actual cause of exception.
But be aware that for 4.x corda you have to put
subFlow(ReceiveFinalityFlow(otherPartySession))
As last operation.
Dunno if this helps
It sounds like you are sharing state between tests, which is generally bad. Consider creating a MockNetwork in JUnit's #Before method or use the DriverDSL to create an isolated test for each test case.

sensu: "previous check command execution in progress"

My client-side sensu metric is reporting a WARN and the data is not getting to my OpenTSDB.
It seems to be stuck, but I don't understand what the message is telling me. Can someone translate?
The command is a ruby script.
In /var/log/sensu/sensu-client.log :
{"timestamp":"2014-09-11T16:06:51.928219-0400",
"level":"warn",
"message":"previous check command execution in progress",
"check":{"handler":"metric_store","type":"metric",
"standalone":true,"command":"...",
"output_type":"json","auto_tag_host":"yes",
"interval":60,"description":"description here",
"subscribers"["system"],
"name":"foo_metric","issued":1410466011,"executed":1410465882
}
}
My questions:
what does this message mean?
what causes this?
Does it really mean we are waiting for the same check to run? if so, how do we clear it?
This error means that sensu is (or thinks it is, actually executing this check currently
https://github.com/sensu/sensu/blob/4c36d2684f2e89a9ce811ca53de10cc2eb98f82b/lib/sensu/client.rb#L115
This can be caused by stacking checks, that take longer than their interval to run. (60 seconds in this case)
You can try to set the "timeout" option in the check definition:
https://github.com/sensu/sensu/blob/4c36d2684f2e89a9ce811ca53de10cc2eb98f82b/lib/sensu/client.rb#L101
To try to make sensu time out after a while on that check. You could also add internal logic to your check to make it not hang.
In my case, I had accidentally configured two sensu-client instances to have the same name. I think that caused one of them to always think its checks were already running when in reality they were not. Giving them unique names solved the problem for me.

Resources