public inbox for [email protected]  
help / color / mirror / Atom feed
[GSoC] Help with Jasmine Tests
4+ messages / 2 participants
[nested] [flat]

* [GSoC] Help with Jasmine Tests
@ 2019-06-29 15:24  Yosry Muhammad <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Yosry Muhammad @ 2019-06-29 15:24 UTC (permalink / raw)
  To: pgadmin-hackers; +Cc: Aditya Toshniwal <[email protected]>; Dave Page <[email protected]>

Hi all,

I am writing tests for my initial patch of my Google Summer of Code
project, which allows editing of SQL queries results (if they are
updatable).

I am trying to write a test for the sqleditor that checks that if _render()
function (in sqleditor.js) is called with w query results that include
primary keys, then the grid should be editable (I need to check grid
options, gridView.grid.getOptions() ).

I also want to check that if the user edits a cell in the grid, the Save
Data button (new button) is enabled. Is this feasible ?

Can anyone help me? I am new to front-end tests. In the sqleditor test I
have seen, a spy is created for the SqlEditor to see if specific functions
are called, but I want the actual _render() function to run (to call
render_grid() of the gridView). In other words, I need to test the code
inside_render() function.

Thanks a lot.

-- 
*Yosry Muhammad Yosry*

Computer Engineering student,
The Faculty of Engineering,
Cairo University (2021).
Class representative of CMP 2021.
https://www.linkedin.com/in/yosrym93/


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [GSoC] Help with Jasmine Tests
@ 2019-07-01 06:57  Aditya Toshniwal <[email protected]>
  parent: Yosry Muhammad <[email protected]>
  0 siblings, 2 replies; 4+ messages in thread

From: Aditya Toshniwal @ 2019-07-01 06:57 UTC (permalink / raw)
  To: Yosry Muhammad <[email protected]>; +Cc: pgadmin-hackers; Dave Page <[email protected]>

Hi Yosry,

On Sat, Jun 29, 2019 at 8:54 PM Yosry Muhammad <[email protected]> wrote:

> Hi all,
>
> I am writing tests for my initial patch of my Google Summer of Code
> project, which allows editing of SQL queries results (if they are
> updatable).
>
Please go through this page here -
https://jasmine.github.io/tutorials/your_first_suite
This will help you kick start with Jasmin test cases.

>
> I am trying to write a test for the sqleditor that checks that if
> _render() function (in sqleditor.js) is called with w query results that
> include primary keys, then the grid should be editable (I need to check
> grid options, gridView.grid.getOptions() ).
>
> I also want to check that if the user edits a cell in the grid, the Save
> Data button (new button) is enabled. Is this feasible ?
>
This is similar to what is done in -
web/regression/javascript/sqleditor/execute_query_spec.js  for btn-flash.

>
> Can anyone help me? I am new to front-end tests. In the sqleditor test I
> have seen, a spy is created for the SqlEditor to see if specific functions
> are called, but I want the actual _render() function to run (to call
> render_grid() of the gridView). In other words, I need to test the code
> inside_render() function.
>
Currently, _render is not directly testable using jasmine test cases. You
need to break down the code to make it more testable. You can read through
articles like -
https://hackernoon.com/how-to-refactor-unwieldy-untestable-code-4a73d75cb80a
to get an idea. An example in pgAdmin would be
web/pgadmin/static/js/sqleditor/execute_query.js

>
> Thanks a lot.
>
> --
> *Yosry Muhammad Yosry*
>
> Computer Engineering student,
> The Faculty of Engineering,
> Cairo University (2021).
> Class representative of CMP 2021.
> https://www.linkedin.com/in/yosrym93/
>


-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [GSoC] Help with Jasmine Tests
@ 2019-07-01 13:40  Yosry Muhammad <[email protected]>
  parent: Aditya Toshniwal <[email protected]>
  1 sibling, 0 replies; 4+ messages in thread

From: Yosry Muhammad @ 2019-07-01 13:40 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; pgadmin-hackers; Dave Page <[email protected]>

Thanks for your help, I will see what I can do.

On Mon, Jul 1, 2019, 8:57 AM Aditya Toshniwal <
[email protected]> wrote:

> Hi Yosry,
>
> On Sat, Jun 29, 2019 at 8:54 PM Yosry Muhammad <[email protected]> wrote:
>
>> Hi all,
>>
>> I am writing tests for my initial patch of my Google Summer of Code
>> project, which allows editing of SQL queries results (if they are
>> updatable).
>>
> Please go through this page here -
> https://jasmine.github.io/tutorials/your_first_suite
> This will help you kick start with Jasmin test cases.
>
>>
>> I am trying to write a test for the sqleditor that checks that if
>> _render() function (in sqleditor.js) is called with w query results that
>> include primary keys, then the grid should be editable (I need to check
>> grid options, gridView.grid.getOptions() ).
>>
>> I also want to check that if the user edits a cell in the grid, the Save
>> Data button (new button) is enabled. Is this feasible ?
>>
> This is similar to what is done in -
> web/regression/javascript/sqleditor/execute_query_spec.js  for btn-flash.
>
>>
>> Can anyone help me? I am new to front-end tests. In the sqleditor test I
>> have seen, a spy is created for the SqlEditor to see if specific functions
>> are called, but I want the actual _render() function to run (to call
>> render_grid() of the gridView). In other words, I need to test the code
>> inside_render() function.
>>
> Currently, _render is not directly testable using jasmine test cases. You
> need to break down the code to make it more testable. You can read through
> articles like -
> https://hackernoon.com/how-to-refactor-unwieldy-untestable-code-4a73d75cb80a
> to get an idea. An example in pgAdmin would be
> web/pgadmin/static/js/sqleditor/execute_query.js
>
>>
>> Thanks a lot.
>>
>> --
>> *Yosry Muhammad Yosry*
>>
>> Computer Engineering student,
>> The Faculty of Engineering,
>> Cairo University (2021).
>> Class representative of CMP 2021.
>> https://www.linkedin.com/in/yosrym93/
>>
>
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB India | Pune
> "Don't Complain about Heat, Plant a TREE"
>


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [GSoC] Help with Jasmine Tests
@ 2019-07-01 14:36  Yosry Muhammad <[email protected]>
  parent: Aditya Toshniwal <[email protected]>
  1 sibling, 0 replies; 4+ messages in thread

From: Yosry Muhammad @ 2019-07-01 14:36 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; pgadmin-hackers; Dave Page <[email protected]>

On Mon, Jul 1, 2019 at 8:57 AM Aditya Toshniwal <
[email protected]> wrote:

>
> I am trying to write a test for the sqleditor that checks that if
>> _render() function (in sqleditor.js) is called with w query results that
>> include primary keys, then the grid should be editable (I need to check
>> grid options, gridView.grid.getOptions() ).
>>
>> I also want to check that if the user edits a cell in the grid, the Save
>> Data button (new button) is enabled. Is this feasible ?
>>
> This is similar to what is done in -
> web/regression/javascript/sqleditor/execute_query_spec.js  for btn-flash.
>

The problem is not with checking the button. How do I mimic the user
editing the grid? I cannot create a grid with all its options in the test.

-- 
*Yosry Muhammad Yosry*

Computer Engineering student,
The Faculty of Engineering,
Cairo University (2021).
Class representative of CMP 2021.
https://www.linkedin.com/in/yosrym93/


^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2019-07-01 14:36 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-06-29 15:24 [GSoC] Help with Jasmine Tests Yosry Muhammad <[email protected]>
2019-07-01 06:57 ` Aditya Toshniwal <[email protected]>
2019-07-01 13:40   ` Yosry Muhammad <[email protected]>
2019-07-01 14:36   ` Yosry Muhammad <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox