sstephenson / bats

Bash Automated Testing System
MIT License
7.13k stars 517 forks source link

Trying to test a curl request to an HTTP server using BATS. But as soon as it hits the run ./server it does not proceeds towards curl. This is because http server repeatedly listens for incoming requests. Any Ideas how can I tell BATS to go the next instruction (here curl) after it runs the server? #260

Closed abhinavdrs closed 5 years ago

abhinavdrs commented 5 years ago

my tests.bats contains:

@test "Http Server Responds to Curl's Http Request" {

gcc server.c -g -o server
run ./server  # it gets stuck here 
run curl -k http://127.0.0.1:8504   
[ "$status" -eq 0 ]

}

abhinavdrs commented 5 years ago

Oops , I did not know about the use of & at the end of the line. Sorry for wasting your time.
run ./server & fixes the problem