Uh oh!
There was an error while loading. Please reload this page.
Add explanations about how to generate tests in DAP - #513
Conversation
ono-max
commented
Feb 2, 2022
Feel free to tell me if this explanation is not enough. |
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
st0012
commented
Feb 2, 2022
@ono-max thanks for the instructions! I have a question though: how do I know what steps were taken from the original tests? the written tests are low-level requests/responses and it's hard to reverse-engineer the original actions. for example, how do I know if the scope request here was done by the client automatically (for UI), or it's triggered by clicking something? |
ono-max
commented
Feb 2, 2022
Well, if I want to know them, I run the command like |
I mean the test case itself doesn't tell me what actions were performed originally. I can try recording it several times and select the most similar result. But that's not efficient because any mis-click or forgotten step means a restart. Ideally, documenting all the steps inside the test case should help. However, I don't think that's a sustainable way. I think we should have unit tests for individual commands. And they can be written with test helpers: perform_dap_request"threads"assert_dap_response{threads: [{id: 1,name: /#1 .*/}]}perform_dap_request"stackTrace",{threadId: 1,startFrame: 0,levels: 20}assert_dap_response{stackFrames: [{name: "<main>",line: 1,column: 1,source: {name: /#{File.basenametemp_file_path}/,path: /#{temp_file_path}/,sourceReference: nil},id: 1}]}It'll be easy to add/update them, just like all the tests under We'll still keep the recorded tests as integration tests, probably something like PROGRAM=<<~RUBY # set breakpoints in line 20 # continue # show backtrace # show info # quit class Foo def first_call second_call(20) end def second_call(num) third_call_with_block do |ten| forth_call(num, ten) end end def third_call_with_block(&block) @ivar1 = 10; @ivar2 = 20 yield(10) end def forth_call(num1, num2) num1 + num2 end endRUBYThen we can easily re-record them when needed according to the steps. And because there should be relatively few of them, maintaining them will be easier. |
Sorry, never mind the above topics. I'll rewrite them later. |
First, I'd like to know your opinion in details. Your opinion is
Is that correct? |
And because the recording approach almost always generate certain commands, like
|
ono-max
commented
Feb 5, 2022
Thank you for explaining to me. |
ono-max
commented
Feb 5, 2022
Because we have already wrote some tests? From 1 and 2, I thought you want to change from protocol-level testing to using some methods such as |
st0012
commented
Feb 5, 2022
I'd be happy to rewrite them into simpler ones, like for stepping tests we only test related endpoints and wihout
that'll be an improvement for sure and perhaps we can start from there. but I think the clear separation for unit/integration testing is more important. for example, |
ko1
commented
Feb 5, 2022
please continue the discussion on another ticket about the test data format. |
ko1
commented
Feb 5, 2022
or you can continue here. |
ono-max
commented
Feb 6, 2022
Ahh, I got your points. I'll rethink it. |
st0012
commented
Feb 13, 2022
@ono-max if you think it's ok to convert most of the command-specific tests into unit-tests, we can do that as follows:
|
ono-max
commented
Feb 13, 2022
I create a prototype to think about it. Could you give me some more time? Thanks. |
No description provided.