You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2023/06/05 09:14:37 UTC

[plc4x] branch develop updated: test(plc4go/spi): add more output to DriverTestRunner

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new c9019a90a9 test(plc4go/spi): add more output to DriverTestRunner
c9019a90a9 is described below

commit c9019a90a9116889538169639b173d58f2ece9d4
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Jun 5 11:14:29 2023 +0200

    test(plc4go/spi): add more output to DriverTestRunner
---
 plc4go/spi/testutils/DriverTestRunner.go | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/plc4go/spi/testutils/DriverTestRunner.go b/plc4go/spi/testutils/DriverTestRunner.go
index 7ea82c1e38..a4d5d8db2b 100644
--- a/plc4go/spi/testutils/DriverTestRunner.go
+++ b/plc4go/spi/testutils/DriverTestRunner.go
@@ -185,11 +185,13 @@ func (m DriverTestsuite) ExecuteStep(t *testing.T, connection plc4go.PlcConnecti
 			}
 
 			// Execute the read-request and store the response-channel in the testcase.
-			t.Log("Execute read request")
+			t.Logf("Execute read request (%T)", readRequest)
+			t.Logf("\n%s", readRequest)
 			if testcase.readRequestResultChannel != nil {
 				return errors.New("testcase read-request result channel already occupied")
 			}
 			testcase.readRequestResultChannel = readRequest.Execute()
+			t.Log("request executed")
 		case "TestWriteRequest":
 			t.Log("Assemble write request")
 			wrb := connection.WriteRequestBuilder()
@@ -220,11 +222,13 @@ func (m DriverTestsuite) ExecuteStep(t *testing.T, connection plc4go.PlcConnecti
 			if err != nil {
 				return errors.Wrap(err, "Error creating write-request")
 			}
-			t.Log("Execute write request")
+			t.Logf("Execute write request (%T)", writeRequest)
+			t.Logf("\n%s", writeRequest)
 			if testcase.writeRequestResultChannel != nil {
 				return errors.New("testcase write-request result channel already occupied")
 			}
 			testcase.writeRequestResultChannel = writeRequest.Execute()
+			t.Log("request executed")
 		}
 	case StepTypeApiResponse:
 		switch step.payload.Name {
@@ -239,7 +243,10 @@ func (m DriverTestsuite) ExecuteStep(t *testing.T, connection plc4go.PlcConnecti
 			}
 			// Serialize the response to XML
 			xmlWriteBuffer := utils.NewXmlWriteBuffer()
-			err := readRequestResult.GetResponse().(utils.Serializable).SerializeWithWriteBuffer(context.Background(), xmlWriteBuffer)
+			response := readRequestResult.GetResponse()
+			t.Logf("Got response (%T)", response)
+			t.Logf("\n%s", response)
+			err := response.(utils.Serializable).SerializeWithWriteBuffer(context.Background(), xmlWriteBuffer)
 			if err != nil {
 				return errors.Wrap(err, "error serializing response")
 			}
@@ -264,7 +271,10 @@ func (m DriverTestsuite) ExecuteStep(t *testing.T, connection plc4go.PlcConnecti
 			}
 			// Serialize the response to XML
 			xmlWriteBuffer := utils.NewXmlWriteBuffer()
-			err := writeResponseResult.GetResponse().(utils.Serializable).SerializeWithWriteBuffer(context.Background(), xmlWriteBuffer)
+			response := writeResponseResult.GetResponse()
+			t.Logf("Got response (%T)", response)
+			t.Logf("\n%s", response)
+			err := response.(utils.Serializable).SerializeWithWriteBuffer(context.Background(), xmlWriteBuffer)
 			if err != nil {
 				return errors.Wrap(err, "error serializing response")
 			}
@@ -289,6 +299,8 @@ func (m DriverTestsuite) ExecuteStep(t *testing.T, connection plc4go.PlcConnecti
 		if err != nil {
 			return errors.Wrap(err, "Error parsing message")
 		}
+		t.Logf("Parsed message (%T)", expectedMessage)
+		t.Logf("\n%s", expectedMessage)
 
 		// Serialize the model into bytes
 		t.Log("Write to bytes")
@@ -374,6 +386,8 @@ func (m DriverTestsuite) ExecuteStep(t *testing.T, connection plc4go.PlcConnecti
 		if err != nil {
 			return errors.Wrap(err, "error parsing message")
 		}
+		t.Logf("Parsed message (%T)", expectedMessage)
+		t.Logf("\n%s", expectedMessage)
 
 		// Serialize the model into bytes
 		t.Log("Serializing bytes")