HGustavs / LenaSYS

Code Viewer and Course Organization System used in some courses at University of Skövde
57 stars 31 forks source link

Research which showDuggaservice_test.php tests work and which do not #14956

Open a22iliru opened 6 months ago

a22eddpe commented 6 months ago

'Get active users' works. Value expectet = value output. Its because expected output is "custom made" to filtered output. 'expected-output' => '{"hash":"hnf3j58s","activeusers":"5"}', 'filter-output' => serialize(array( 'hash', 'activeusers'

a22eddpe commented 6 months ago

'Create active users' does not work. The file test.php do not work with this test. "username and password undefined". Therefore test 1 (login) does not work beacuse its not defined. To fix this, add: 'username' => 'brom', 'password' => 'password', to servise data array Test 2 works (callService) Test 3 does not work (assertEqual). activeusers=null which is not an expected value. Too fix this, add "activeusers":null to expected-output

a22eddpe commented 6 months ago

'update active users' does not work. The file test.php do not work with this test. "username and password undefined". Therefore test 1 (login) does not work beacuse its not defined. To fix this, add: 'username' => 'brom', 'password' => 'password', to servise data array. Test 2 works (callService) Test 3 does not work (assertEqual). activeusers:52 which is not an expected value. To fix this, add "activeusers":52 to expected-output.

a22eddpe commented 6 months ago

'get data from userAnswer (student)' does not work. The SQL statement is incorrect. Whole test is down Will come back to this and see why it doesnt work

a22eddpe commented 6 months ago

'get data from userAnswer (teacher)' does not work. The SQL statement is incorrect. Whole test is down Will come back to this and see why it doesnt work

a22eddpe commented 6 months ago

'update submitted dugga' does not work. Thers a problem with inserting or updating data in the database. There's a duplicate entry for the primary key value '9999' in the table. To solve this issue, the primary key values in the database table must be unique. You can either update the existing row with the primary key value '9999' or choose a different primary key value when inserting a new row. Then test 2 will work and test 1 will work if you insert a username and password in the servide-data array. 3 will work if you change expected output to match the value output. An example on how to fix unique key: give the cid value 8888 instead of 9999.

a22eddpe commented 6 months ago

'submit dugga' does not work. The error is caused beacuse it trying to insert a duplicate entry with the same primary key value '9999' into the 'course' table. To fix this, you can modify the test data to use a unique primary key value for each test case. Then test 2 will work and test 1 and 3 will work if you insert a username and password in the servide-data array. An example on how to fix unique key: give the cid value 1000 instead of 9999.

a22eddpe commented 6 months ago

'super-view data from useranswer on hash (teacher)' does not work. There is a syntax error under service-data array, 'hash' => 'dfg4zxc5' is missing a "," If you fix this, the test still does not work. The error message indicates that there is a problem with the data being inserted into a database table. There is a violation of an integrity constraint related to the primary key of the table. Also, delete this line "'service' => 'localhost/LenaSYS/DuggaSys/showDuggaservice.php',"

a22eddpe commented 6 months ago

'super-view data from useranswer on moment (teacher)' does not work. The error indicates that there's an attempt to insert a duplicate entry into a column that has been defined as a primary key in a database table. To make this test work, you can change the values for cid from 9999 to 1111. The two first test will work. The third has an error because the expected output does not match with the value output. Fix this by add activeusers":null to expected output. See if you need to change more values of the expected output to match the value output.

a22eddpe commented 6 months ago

'super-view data on quizname (teacher)' does not work. There's a problem with database integrity due to a violation of a unique constraint. To fix this error, you can change the primary key (cid) from 9999 to 6666. Then the two first tests will work. To fix the third, you need to look over the expected output to make it match value output. As it tis now, activeusers":null is not an expected output.

a22eddpe commented 6 months ago

'view data on userAnswer (teacher)' does not work. There's a problem with database integrity due to a violation of a unique constraint. To fix this error, you can change the primary key (cid) from 9999 to 5555. Then the two first tests will work. To fix the third, you need to look over the expected output to make it match value output. As it tis now, activeusers":null is not an expected output.

a22eddpe commented 6 months ago

'super-view data on quizname (teacher)' does not work. There's a problem with database integrity due to a violation of a unique constraint. To fix this error, you can change the primary key (cid) from 9999 to 4444. The test still does not work, the error message indicates that there's a mismatch between the number of columns specified in the SQL query and the number of values provided in the INSERT statement.

f22linhe commented 6 months ago

Group 2024 has decided to focus on working tests for the microservices instead of the service files. Therefore, this issue, along with other research issues regarding the functionality of tests for the service files, will be postponed until the next group takes over. It will then be up to them to decide whether these issues are still relevant or not.