<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Integration testing for plugin in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Integration-testing-for-plugin/m-p/80988#M51044</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;I'm in the process of creating my first neovim plugin and I'm running into some trouble testing it.&lt;/P&gt;&lt;P class=""&gt;What I want to do:&lt;/P&gt;&lt;PRE&gt;describe('my test', function()
    it('asserts correctly', function()
        vim.api.nvim_feedkeys('isome text ', 't', false)
        local line = vim.api.nvim_get_current_line()
        assert('some text ', line)
    end)
end)&lt;/PRE&gt;&lt;P class=""&gt;What happens:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;line&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is blank. Probably due to the test finishing before neovim updates the line.&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Things I've tried:&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P class=""&gt;Using plenary&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P class=""&gt;Problem: I can't figure out how to use asyc functionality&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P class=""&gt;I don't understand the solution that was accepted by the issue creator.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;Attempted fixes:&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P class=""&gt;Using a function other than&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;nvim_feedkeys&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(eg,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;nvim_buf_set_lines)&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P class=""&gt;Problem: I want to test if my plugin reacts to autocmds (namely&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;InsertCharPre&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;with access to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;vim.v.char), and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;nvim_buf_set_lines&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;does not allow me to do so.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;Using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;vim.wait(0)&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P class=""&gt;Problem: Adding the calls don't change anything&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;Mimicking how&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;git-signs&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;runs tests (using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;neovim)&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P class=""&gt;Problem: I get&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;attempt to index global 'vim' (a nil value)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;errors when I access&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;vim&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;inside of my plugin. I've tried looking at&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;git-signs&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;but can't see how they circumvent this problem.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P class=""&gt;Note: This dilemma only exists when running automated tests. Manually calling the function works as wanted, as long as I wrap&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;nvim_get_current_line&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;inside a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;vim.schedule()&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(however, wrapping it in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;vim.schedule&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;does not help during testing)&lt;/P&gt;&lt;P class=""&gt;Anything pointing me in the right direction would be appreciated.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jan 2022 07:07:56 GMT</pubDate>
    <dc:creator>DennisSSebasiSt</dc:creator>
    <dc:date>2022-01-28T07:07:56Z</dc:date>
    <item>
      <title>Integration testing for plugin</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Integration-testing-for-plugin/m-p/80988#M51044</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;I'm in the process of creating my first neovim plugin and I'm running into some trouble testing it.&lt;/P&gt;&lt;P class=""&gt;What I want to do:&lt;/P&gt;&lt;PRE&gt;describe('my test', function()
    it('asserts correctly', function()
        vim.api.nvim_feedkeys('isome text ', 't', false)
        local line = vim.api.nvim_get_current_line()
        assert('some text ', line)
    end)
end)&lt;/PRE&gt;&lt;P class=""&gt;What happens:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;line&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is blank. Probably due to the test finishing before neovim updates the line.&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Things I've tried:&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P class=""&gt;Using plenary&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P class=""&gt;Problem: I can't figure out how to use asyc functionality&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P class=""&gt;I don't understand the solution that was accepted by the issue creator.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;Attempted fixes:&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P class=""&gt;Using a function other than&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;nvim_feedkeys&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(eg,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;nvim_buf_set_lines)&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P class=""&gt;Problem: I want to test if my plugin reacts to autocmds (namely&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;InsertCharPre&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;with access to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;vim.v.char), and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;nvim_buf_set_lines&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;does not allow me to do so.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;Using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;vim.wait(0)&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P class=""&gt;Problem: Adding the calls don't change anything&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;Mimicking how&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;git-signs&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;runs tests (using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;neovim)&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P class=""&gt;Problem: I get&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;attempt to index global 'vim' (a nil value)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;errors when I access&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;vim&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;inside of my plugin. I've tried looking at&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;git-signs&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;but can't see how they circumvent this problem.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P class=""&gt;Note: This dilemma only exists when running automated tests. Manually calling the function works as wanted, as long as I wrap&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;nvim_get_current_line&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;inside a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;vim.schedule()&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(however, wrapping it in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;vim.schedule&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;does not help during testing)&lt;/P&gt;&lt;P class=""&gt;Anything pointing me in the right direction would be appreciated.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 07:07:56 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Integration-testing-for-plugin/m-p/80988#M51044</guid>
      <dc:creator>DennisSSebasiSt</dc:creator>
      <dc:date>2022-01-28T07:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Integration testing for plugin</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Integration-testing-for-plugin/m-p/81645#M51460</link>
      <description>&lt;P class=""&gt;I've been writing a web app for about 6 months, and it has no integration tests. I have a few unit tests for some application logic, but no integration tests. How do I go about testing my application?&lt;/P&gt;&lt;P class=""&gt;And when I say how, I don't really mean&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;how&lt;/EM&gt;. I know how to use QUnit and all of the Ember.js testing fixtures. I'm good at testing. My problem is that I don't know&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;what&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to test. Do I test every button, every input and every URL? Do I test to make sure that things look OK, or just function? Should I test with a testing database, or a mock database?&lt;/P&gt;&lt;P class=""&gt;I've been a Javascript developer for 2 years (and got about 4 years worth of experience in that time), but this is my first foray into integration testing an enterprise application. If anybody has any advice, I would really appreciate it. Feel free to post articles too. For the purpose of this thread, assume I've never written a test in my life. I want to start with a clean slate&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 11:48:11 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Integration-testing-for-plugin/m-p/81645#M51460</guid>
      <dc:creator>WaltSnowrancruz</dc:creator>
      <dc:date>2022-03-15T11:48:11Z</dc:date>
    </item>
  </channel>
</rss>

