Note that there are some explanatory texts on larger screens.

plurals
  1. POSort selected sections in fixed order - Space is no constraint
    text
    copied!<p>I have a DSL which is written for a smoke testing program. At the end of the program run, another program picks this up and generates a PDF report. (DSL is chosen primarily to switch between different formats)</p> <p>After the title page, a summary of the results of the test suite is to be displayed. So, I put a place holder there.</p> <pre><code>add table:summary header="Summary" columns: 2 </code></pre> <p>And then on, at the end of each test case, I insert a row to this table as in :</p> <pre><code>add row table:summary values: "Entitlements Test, PASS" </code></pre> <p>Since the table declaration and the rows are scattered, I would like to group them all before running it by the DSL parser which does action immediately for each line. </p> <p>Is there a better way to group the rows with the table and in the order that they are written by the program (time).</p> <p>I have been breaking my head for more than a couple of days but couldn't get a better method than these lame ideas : </p> <p>(All my solutions are terrible if I wanted to introduce more tables into the reports)</p> <ol> <li><p>Load the file as list of strings into memory. Holding the pointer on the first table index, loop further (through the entire list) and insert rows in the next index of the table declaration pushing the rest of the list down - 0(n) for each row :-( After the entire list has been traversed, search for the next table pointer and repeat the process. If the list has reached its end without hitting another table, we are done. I guess a balanced tree is a better option than a list here. </p></li> <li><p>Put a prefix before "add table" say "t1" and rows as "t1r1", "t1r2" and preprocess the DSL before running it by the parser.</p></li> <li><p>choose all the lines that starts with "add table" and "add row", store it in a ordered list. For each table, filter the relevant rows of the table and do a fixed order comparison. <a href="https://discursive.atlassian.net/wiki/display/CJCOOK/Fixed+Order+Comparison" rel="nofollow">https://discursive.atlassian.net/wiki/display/CJCOOK/Fixed+Order+Comparison</a> (I am yet to see what this does internally). </p></li> </ol> <p>The entire file is not going to run more than a few thousand lines at the max and the reporting process is a dedicated process in itself. Therefore space should not be a constraint. </p> <p>The entire DSL goes like this : </p> <pre><code>add header: "Smoke Testing Report for ..... (app name)" add subheader: "on .... (date)" add table:summary header="Summary" columns: 2 add title : "Login page" add screenshot : "C:/projects/SmokingCPOII/geb-reports/Into_Login_page.png" newpage ... ... add title : "Entitlements Before Submit" add screenshot : "C:/projects/SmokingCPOII/geb-reports/Entitlements Before Submit.png" newpage add title : "End" add screenshot : "C:/projects/SmokingCPOII/geb-reports/end.png" newpage ... ... add row table:summary values: "Entitlements Test, Pass" ... ... add row table:summary values: "Another Test, Pass" ... ... add row table:summary values: "Yet Another Test, Fail" ... </code></pre> <p>(Since the program is yet to be shown to anybody, I am free to change the DSL the way I want. However it would be great if we could make the DSL as human readable as possible)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload