Enhancing Software Testing with ChatGPT Insights

chatgpt and software testing education promises n.w
1 / 22
Embed
Share

Explore how ChatGPT impacts software testing education, focusing on shared vs. separate context, response consistency, and confidence levels. Learn how leveraging ChatGPT can refine testing methodologies and improve outcomes in the software testing domain.

  • Software Testing
  • ChatGPT
  • Education
  • AI Insights
  • Neural Networks

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. ChatGPT and Software Testing Education: Promises & Perils Sajed Jalil, Suzzana Rafi Thomas D. LaToza, Kevin Moran, & Wing Lam

  2. What is ChatGPT? A generalized large language model (LLM) developed by OpenAI A LLM consists of a neural network typically with billions of parameters, trained on large quantities of unlabeled text ChatGPT is fine-tuned from a model in the GPT-3.5 series It finished its training in early 2022 2

  3. How Great is ChatGPT? How does it impact Software Testing Education? 3

  4. Our Work To better understand how different ways of using ChatGPT affect its effectiveness in software testing, we study: 1. RQ1: How does shared & separate context affect ChatGPT s answer and explanation correctness? 2. RQ2: How often will ChatGPT give non-identical answer-explanation pairs? 3. RQ3: How often will ChatGPT s inconsistent responses affect the scores of answers and explanations? 4. RQ4: How does ChatGPT s confidence in its response correlate to the correctness of the response? 4

  5. Example Question // Counts all numbers greater than 0 public int countPositive(int[] x){ int count = 0; for (int i=0; i < x.length; i++) { if (x[i] >= 0) count++; } return count; } // Test Case [-4, 2, 0, 2], Expected = 2 A. What is wrong with the given code? B. Give a test case that does not result in a failure. 5

  6. Using ChatGPT - Shared Context public int countPositive(int[] x){ int count = 0; for (int i=0; i < x.length; i++) { if (x[i] >= 0) count++; } return count; }// Test Case [-4, 2, 0, 2], Expected = 2 A. What is wrong with the given code? Response by ChatGPT B. Give a test case that does not result in a failure. Response by ChatGPT 6

  7. Using ChatGPT - Separate Context public int countPositive(int[] x){ int count = 0; public int countPositive(int[] x){ int count = 0; for (int i=0; i < x.length; i++) { if (x[i] >= 0) count++; } return count; for (int i=0; i < x.length; i++) { if (x[i] >= 0) count++; } return count; } //Test Case [-4,2,0,2], Expected = 2 } //Test Case [-4,2,0,2], Expected = 2 A. What is wrong with the given code? B. Give a test case that does not result in a failure. Response by ChatGPT Response by ChatGPT Chat Thread #2 Chat Thread #1 7

  8. Our Study Dataset Introduction to Software Testing, 2ndEdition, Ammann & Offutt 31 questions from the first 5 chapters Selected questions only with student solution available 3 iterations of shared and separate contexts Chapter Muti-part Independent Code Concept Both 20 4 1 2 16 1 2 3 4 5 1 2 1 5 5 1 2 2 9 Total 27 4 6 16 8

  9. Methodology ChatGPT Server Textbook Questions Our Automated Tool Manual Response Annotation 9

  10. Response Categorization Our dataset labeling considered two perspectives: whether the overall answer was correct or not whether the explanation given was correct or not Answer Correct (AC) Answer Incorrect (AIC) Answer Partially Correct (APC) Explanation Correct (EC) Explanation Incorrect (EIC) Explanation Partially Correct (EPC) Answers and explanations are deemed correct after manual comparison against textbook solutions 10

  11. RQ1: Effect of Shared and Separate Context on ChatGPT 56.8% 60% 70% Shared Separate Shared Separate 58.0% 46.9% 60% 50% 49.4% 44.4% 40.7% 50% 40% 32.1% 40% 34.6% 30% 30% 20% 20% 12.3% 11.1% 6.2% 7.4% 10% 10% 0% 0% Correct (AC) Partially Correct (APC) Incorrect (AIC) Correct (EC) Partially Correct (EPC) Incorrect (EIC) Correctness of ChatGPT answers for shared and separate contexts Correctness of ChatGPT explanations for shared and separate contexts Shared context is more likely than separate context to be correct. Using ChatGPT in a shared context can result in a correct answer 49.4% of the time and a correct explanation 40.2% of the time. 11

  12. RQ2: Non-Identical Answer-Explanation Pairs (Example) T1 satisfies C1 C1 e.g., edge coverage C2 T2 satisfies C2 e.g., node coverage Truncated Prompt to ChatGPT: Does T1 necessarily satisfies C2? ChatGPT Response: T1 may or may not satisfy C2. C1 is a more comprehensive criterion that includes all the requirement of C2. However, it does not guarantee that T1 will satisfy C2. Our Verdict: answer incorrect, explanation partially correct (AIC-EPC). 12

  13. RQ2: Non-Identical Answer-Explanation Pairs 11.8% of the time ChatGPT produces responses where the answer-explanation pairs are non-identical, e.g., the answer is correct, but the explanation is not. 13

  14. RQ3: Inconsistent Responses from ChatGPT Iteration 1 Iteration 2 Iteration 3 Verdict Question 1 AC AC APC Inconsistent Question 2 AIC APC AC Inconsistent Question 3 AC AC AC Consistent We are interested to find out how deterministic ChatGPT is ChatGPT can give inconsistent responses to the same question if run more than once Inconsistent in 9.7% of answers and 6.5% of explanations 14

  15. RQ4: Confidence Level of ChatGPT 12 10 10 EC EPC EIC 8 AC APC AIC 10 8 7 6 8 6 6 6 5 4 3 3 4 3 2 2 2 2 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 Highly confident Very confident Confident Reliable Highly confident Very confident ChatGPT s reported confidence for correct, partially correct, and incorrect answers. Confident Reliable ChatGPT s reported confidence for correct, partially correct, and incorrect explanations. ChatGPT s self-reported confidence does not appear to be particularly useful, as it has little bearing on question correctness. This finding seems to indicate, that, for software testing questions, ChatGPT is not well calibrated. 15

  16. RQ4: Confidence Level of ChatGPT 12 10 10 EC EPC EIC 8 AC APC AIC 10 8 7 6 8 6 6 6 5 Why are ChatGPT s responses are incorrect? Can we change the prompt do make them correct? 4 3 3 4 3 2 2 2 2 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 Highly confident Very confident Confident Reliable Highly confident Very confident ChatGPT s reported confidence for correct, partially correct, and incorrect answers. Confident Reliable ChatGPT s reported confidence for correct, partially correct, and incorrect explanations. ChatGPT s self-reported confidence does not appear to be particularly useful, as it has little bearing on question correctness. This finding seems to indicate, that, for software testing questions, ChatGPT is not well calibrated. 16

  17. Case Study: Characteristics of Incorrect Answers 1. ChatGPT lacks knowledge 2. ChatGPT makes wrong assumption 3. Both 17

  18. Case Study: Prompt Engineering Example public static int oddOrPos (int[] x) { int count = 0; for (int i = 0; i < x.length; i++) { if (x[i]%2 == 1 || x[i] > 0) count++; } return count; } // test: x = [-3, -2, 0, 1, 4]; Expected = 3 ChatGPT says adding null check before for loop will solve the issue. Actual issue is with finding negative odd integers. Prompt: Implement your repair and verify that the given test now produces the expected output. 18

  19. Case Study: Prompt Engineering Example public static int oddOrPos (int[] x) { int count = 0; for (int i = 0; i < x.length; i++) { if (x[i]%2 == 1 || x[i] > 0) count++; } return count; } // test: x = [-3, -2, 0, 1, 4]; Expected = 3 Detects the fault correctly Says if( x[i] % 2 != 0) or (x[i] > 0) will solve the issue. Modified Prompt: The answer does not involve having a null check and zero is not a positive number. Implement your repair and verify that the given test now produces the expected output. 19

  20. Conclusion Shared context is better than separate context -- answers are correct 49.4% of the time and explanations are correct 40.2% of the time 11.8% of ChatGPT s responses produces non-identical answer- explanation pairs ChatGPT produces inconsistent answers for 9.7% of questions ChatGPT s self reported confidence level is not helpful We are more likely to get correct responses with better prompt engineering 20

  21. Suggestions to the Software Testing Educators Creating study materials and practice questions that allow enhanced learning experience with ChatGPT usage When ChatGPT is not welcomed, make the exercises involving both code and concepts Raise awareness of the new honor code policy that might emerge from the use of ChatGPT 21

  22. Sajed Jalil sjalil@gmu.edu Conclusion Shared context is better than separate context -- answers are correct 49.4% of the time and explanations are correct 40.2% of the time 11.8% of ChatGPT s responses produces non-identical answer- explanation pairs ChatGPT produces inconsistent answers for 9.7% of questions ChatGPT s self reported confidence level is not helpful We are more likely to get correct responses with better prompt engineering 22

More Related Content