Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couldn't send data in specflow testing application via pipes #44

Closed
DharaniRajamani opened this issue Dec 27, 2023 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@DharaniRajamani
Copy link

Describe the bug

While I am H Pipes in specflow, c# and nunit Framework for testing the pipe connection and passing data using pipes.

image

The WriteAsync function is called but it's not sending the data to the client application.

Steps to reproduce the bug

  1. create specflow feature file
  2. use the below coding for testing

private PipeServer? _server;

[When(@"Get Sending Data")]
public async Task WhenSendingData()
{

 do
 {
     
    Task.Run(() => StartServer());

 } while (Console.ReadKey(true).Key != ConsoleKey.Escape);

}

public async Task StartServer()
{

 while (!_token.IsCancellationRequested && _server is not { IsStarted: true })
 {
     try
     {
       
         _server = new PipeServer<string>("TestPipe");

         _server.ClientConnected += OnClientConnected;

         await _server.StartAsync(_token.Token);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Failed to start server");
     }
 }

}

public void OnClientConnected(object? sender, ConnectionEventArgs e)
{
Console.WriteLine($"Client has connected to {e.Connection.PipeName}");
Console.WriteLine($"Client has connected to {e.Connection}");

     e.Connection.WriteAsync("Welcome!");

}

  1. Run the test

There is no bug but it's not communicating. If i close the c++ execution, it's giving me pipe closed error. The id for Pipe is also created

Test.SignalPipe_ba006207-cdaf-4365-99b8-a06258d3c65e

Please not the same is working well in console application where I could send message but not working in specflow testing application.

Expected behavior

No response

Screenshots

No response

NuGet package version

<PackageReference Include="H.Formatters.BinaryFormatter" Version="2.0.59" />
<PackageReference Include="H.Pipes" Version="2.0.59" />
<PackageReference Include="H.Pipes.AccessControl" Version="2.0.59" />

Platform

Console

IDE

Visual Studio 2022

Additional context

No response

@DharaniRajamani DharaniRajamani added the bug Something isn't working label Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant