做為一個程式開發者，最重要的就是寫好測試案例，讓我們的程式能夠在每次發版前，至少都確認關鍵邏輯不會因為程式的修改而出錯。而 ChatGPT 是一個後起之秀，我們也可以利用 ChatGPT 來完善你的測試案例，怎麼用呢？
◎◎ 網站 小檔案◎◎
■ 網站名稱： ChatGPT
please give me a smoking test case for test the input date is X'mas with user story
而 ChatGPT 也很聰明的回答。
User Story: As a user, I want to receive a notification on Christmas day to remind me not to smoke. Test Case: Preconditions: The user has the app installed and has allowed notifications. Input: Date: December 25th, Time: 12:00 pm Actions: The system should check if the input date matches the Christmas day and if the time is set to 12:00 pm. Expected Results: The system should send a notification to the user reminding them not to smoke on Christmas day at 12:00 pm. The notification should be clear and easy to understand. Postconditions: The notification should be received by the user and they should be reminded not to smoke on Christmas day. Note: This is just an example test case, and in real-world scenarios, there would be many more test cases to cover different scenarios and edge cases.
大家可以看一下圖，可以知道 ChatGPT 其實超聰明。
買進股票的交割金額 = 買進股票的價格 * 股數 + (買進股票的價格 * 股數) *0.01425*券商手續費折數
賣出股票的交割金額 = 賣出股票的價格 * 股數 - (賣出股票的價格 * 股數) *0.01425*券商手續費折數 - (賣出股票的價格 * 股數) * 交易稅
所以，我們可以請 ChatGPT 給我們一個測試案例，雖然英文不是很好，但他看得懂就好。
Please give me a smoke test case for stock trading. The transaction tax is 0.001, which is only charged when selling, and not charged when buying. The brokerage fee is the price multiplied by the number of shares traded times 0.01425 times 0.6, and the brokerage fee is the lowest It is 1 dollars, will be charged both on buy and sell, all amounts are rounded down to integers, please give me the positive income of buying and selling stocks
Sure, here's an example smoke test case for stock trading: Scenario: Buying and Selling Stocks Test Case Description: 1.User logs in to the trading platform 2.User searches for a stock and finds a stock with a current price of $10 per share 3.User decides to buy 100 shares of the stock, and places a buy order 4.The platform charges a brokerage fee of $6 (100 * $10 * 0.01425 * 0.6), which is rounded down to the nearest integer, so the fee charged is $6 5.User's account is debited with $1000 (100 shares * $10 per share) plus $6 brokerage fee, for a total of $1006 6.The user holds on to the stock for a few days, and the stock price rises to $12 per share 7.The user decides to sell all 100 shares, and places a sell order 8.The platform charges a brokerage fee of $7 (100 * $12 * 0.01425 * 0.6), which is rounded down to the nearest integer, so the fee charged is $7 9.The platform also charges a transaction tax of $1.2 (100 * $12 * 0.001), which is rounded down to the nearest integer, so the tax charged is $1 10.User's account is credited with $1193 (100 shares * $12 per share) minus $7 brokerage fee and $1 transaction tax, for a total of $1185 11.The user's profit from buying and selling the stock is $1185 - $1006 = $179 Expected Result: The expected result of this smoke test case is that the user earns a positive income of $179 from buying and selling the stocks. The platform should charge the correct brokerage fee and transaction tax as per the given rules, and all amounts should be rounded down to the nearest integer as mentioned.
同樣，大家可以看一下圖，可以知道 ChatGPT 其實超聰明。