zoukankan      html  css  js  c++  java
  • laravel -- 单元测试

    <?php
    
    namespace TestsFeature;
    
    use TestsTestCase;
    
    /**
     * Class ExampleTest
     * 调用这里所有测试方法命令
     *          ./vendor/bin/phpunit  --filter 'Tests\Feature'
     *          ./vendor/bin/phpunit   --filter ExampleTest
     *
     * 查看方法:
     *           ./vendor/bin/phpunit  --help
     * @package TestsFeature
     */
    class ExampleTest extends TestCase
    {
        /**
         * A basic test example.
         *
         * @return void
         */
        public function testBasicTest()
        {
            $response = $this->get('/');
    
            $response->assertStatus(200);
        }
    
        /**
         *
         *  执行命令 ./vendor/bin/phpunit
         *           ./vendor/bin/phpunit  --group default
         *           ./vendor/bin/phpunit  --filter createRule
         *           ./vendor/bin/phpunit --filter 'Tests\Feature\ExampleTest::testCreateRule'
         * @return string|SymfonyComponentHttpFoundationStreamedResponse
         */
        public function testCreateRule()
        {
            exit('测试这个方法01');
        }
    
        /**
         *  执行这个方法
         * ./vendor/bin/phpunit  --filter fei
         * ./vendor/bin/phpunit --filter 'Tests\Feature\ExampleTest::testFei'
         */
        public function testFei()
        {
            $this->call('GET','api/User/login'); //调用对应的路由
            exit('eeeeeeeee');
        }
    }
  • 相关阅读:
    软件工程(2018)第一次作业
    SQA计划
    再冲刺
    第三次冲刺
    第二次冲刺
    小组第一次冲刺
    团队合作初体验
    关于git的认识与想法
    我的第一篇博客
    SQA计划和系统测试规程
  • 原文地址:https://www.cnblogs.com/dafei4/p/13813034.html
Copyright © 2011-2022 走看看