from django.db import models # Create your models here. from apps.plan.models import TestPlan from apps.software.models import Software from apps.user.models import User class TestTask(models.Model): id = models.CharField(max_length=128, unique=True, primary_key=True, verbose_name='测试任务编号', default='TestLaboratory_V1_Task_1') title = models.CharField(max_length=50, verbose_name='测试任务标题') executor = models.ForeignKey(User, null=True, on_delete=models.CASCADE, verbose_name='测试任务执行者') # 0: 发布,release;(此阶段可以上传未执行的测试用例)1:执行测试用例,execute(此阶段需上传包含测试结果的测试用例);2:执行完成 state = models.IntegerField(verbose_name='测试任务状态') type = models.CharField(max_length=30, default='other', verbose_name='测试任务类型') description = models.TextField(verbose_name='测试任务描述') plan = models.ForeignKey(TestPlan, on_delete=models.CASCADE, verbose_name='测试任务所属计划') statement_file = models.TextField(verbose_name='说明文档id文件') case_file = models.TextField(null=True, verbose_name='测试用例文档') case_all = models.IntegerField(null=True, verbose_name='全部测试用例数量') case_not_execute = models.IntegerField(null=True, verbose_name='未执行测试用例数量') case_success = models.IntegerField(null=True, verbose_name='成功测试用例数量') case_fail = models.IntegerField(null=True, verbose_name='失败测试用例数量') create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') delete = models.BooleanField(default=False) def __str__(self): return self.title class Meta: verbose_name = '测试任务' verbose_name_plural = verbose_name db_table = 'task' class TestCase(models.Model): id = models.CharField(max_length=128, unique=True, primary_key=True, verbose_name='测试用例编号', default='TestLaboratory_V1_Case_1') task = models.ForeignKey(TestTask, on_delete=models.CASCADE, verbose_name='测试用例所在测试任务', default='TestLaboratory_V1_Task_1') id_in_task = models.CharField(max_length=30, verbose_name='在测试任务中编号', default='1') software = models.ForeignKey(Software, null=True, on_delete=models.CASCADE, verbose_name='测试软件') executor_id = models.ForeignKey(User, null=True, on_delete=models.CASCADE, verbose_name='执行者id') version = models.CharField(max_length=30, null=True, verbose_name='软件版本') name = models.CharField(max_length=50, verbose_name='名称') state = models.IntegerField(verbose_name='状态') writer = models.CharField(max_length=30, verbose_name='测试用例编写人', null=True) executor = models.CharField(max_length=30, verbose_name='测试用例执行人', null=True) assessor = models.CharField(max_length=30, verbose_name='测试用例评审员', null=True) requisite = models.TextField(null=True, verbose_name='前置条件') priority = models.CharField(max_length=10, null=True, verbose_name='优先级') environment = models.TextField(null=True, verbose_name='测试环境') type = models.CharField(max_length=30, null=True, verbose_name='测试类型') process = models.TextField(verbose_name='测试步骤') expected_result = models.TextField(verbose_name='预期结果') actual_result = models.TextField(verbose_name='实际结果', null=True) create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') delete = models.BooleanField(default=False) remark = models.TextField(null=True, verbose_name='备注') def __str__(self): return self.name class Meta: verbose_name = '测试用例' verbose_name_plural = verbose_name db_table = 'test_case' class BeidouCase(models.Model): id = models.CharField(max_length=128, unique=True, primary_key=True, verbose_name='测试用例编号', default='TestLaboratory_V1_BeidouCase_1') task = models.ForeignKey(TestTask, on_delete=models.CASCADE, verbose_name='测试用例所在测试任务', default='TestLaboratory_V1_Task_1') software = models.ForeignKey(Software, null=True, on_delete=models.CASCADE, verbose_name='测试软件') executor = models.ForeignKey(User, null=True, on_delete=models.CASCADE, verbose_name='执行者id') version = models.CharField(max_length=30, null=True, verbose_name='软件版本') title = models.CharField(max_length=50, verbose_name='测试用例名称') state = models.IntegerField(verbose_name='状态', default=0) positioning_accuracy = models.FloatField(null=True, verbose_name='定位精度') timing_accuracy = models.FloatField(null=True, verbose_name='定时精度') pseudo_range_measurement_accuracy = models.FloatField(null=True, verbose_name='伪距测量精度') carrier_measurement_accuracy = models.FloatField(null=True, verbose_name='载波测量精度') speed_measurement_accuracy = models.FloatField(null=True, verbose_name='测速精度') sensitivity_capture = models.FloatField(null=True, verbose_name='捕获灵敏度') receiving_sensitivity = models.FloatField(null=True, verbose_name='接受灵敏度') sensitivity_track = models.FloatField(null=True, verbose_name='跟踪灵敏度') power_range_low = models.FloatField(null=True, verbose_name='接收功率范围下界') power_range_high = models.FloatField(null=True, verbose_name='接收功率范围上界') self_integrity = models.FloatField(null=True, verbose_name='自主完好性') system_integrity = models.FloatField(null=True, verbose_name='系统完好性') capture_time = models.FloatField(null=True, verbose_name='首次捕获时间') recapture_time = models.FloatField(null=True, verbose_name='失锁重捕时间') update_rate = models.FloatField(null=True, verbose_name='定位测速更新率') trace_channels = models.IntegerField(null=True, verbose_name='跟踪通道数') max_velocity = models.FloatField(null=True, verbose_name='最大速度') max_acceleration = models.FloatField(null=True, verbose_name='最大加速度') create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') delete = models.BooleanField(default=False) remark = models.TextField(null=True, verbose_name='备注') def __str__(self): return self.title class Meta: verbose_name = '北斗测试用例' verbose_name_plural = verbose_name db_table = 'beidou_case'